Bounded-waiting Mutual Exclusion with test and set
问题 I am reading the famous Operating System Concepts book of (Avi Silberschatz, Peter Baer Galvin, Greg Gagne) edition 9: http://codex.cs.yale.edu/avi/os-book/OS9/ In the process synchronization chapter, there is an algorithm for "Bounded-waiting Mutual Exclusion with test_and_set" as follow: do { waiting[i] = true; key = true; // <-- Boolean variable that I do not see its utility while (waiting[i] && key) // <-- the value of the key variable here is always true key = test_and_set(&lock); // <--