Why is a while/do while used when explaining code sections for the Critical Section Problem?

29 Views Asked by At

Why is that books and articles use while/do while loops to represent code sections of a process when explaining the Critical Section Problem?

For example here (this is an image of a ppt from the book Operating Systems Concepts 10th edition)

enter image description here

In this video's explanation of the critial section problem https://www.youtube.com/watch?v=UtEORPakw5Y, it also uses a do while loop to represent the general code structure of a process.

And my question goes, because on this website https://crystal.uta.edu/~ylei/cse6324/data/critical-section.pdf , when they explain "Solution 3" of using a "turn" variable to indicate the next process to enter the critical section, the solution ends up being incorrect because Process/Thread 0 (indicated as T0) repeats forever and therefore not complying with the requeriments needed for a Critical Section Problem solution. But the whole reason its not a solution its because of the same while/do while loop used in the process's structure.

If the program only executes one time, why have this loop? Thanks for your time.

0

There are 0 best solutions below