you are saying that n process peterson's solution and bakery algorithm are the same thing?
no... i hope in n-process Peterson's solution, in the while loop they check the condition of flag and turn variable of every process...
So, they simply came to the bakery algo with small modifications