Peterson's solution provides a good algorithmic description of solving the critical-section problem and illustrates some of the complexities involved in designing software that addresses the requirements of mutual exclusion, progress, and bounded waiting. Peterson's algorithm is considered a standard low-level algorithm for two-thread mutual exclusion.
The method provides mutual exclusion for sure. In entry section, the while condition involves the criteria for two variables therefore a process cannot enter in the critical section until the other process is interested and the process is the last one to update turn variable.
An uninterested process will never stop the other interested process from entering in the critical section. If the other process is also interested then the process will wait.
The interested variable mechanism failed because it was not providing bounded waiting. However, in Peterson solution, A deadlock can never happen because the process which first sets the turn variable will enter in the critical section for sure.
This is the complete software solution and therefore it is portable on every hardware.