以下代码是尝试解决N进程关键部分问题。你能告诉我它是对还是错! Plez给我一些细节! PLZ
boolean array want[1..n] [false,…., false]
loop forever
non-critical section
p1: want[i] true
p2: for all processes j< i
p3: if want[j]
p4: want [i] false
p5: while not want[j] do skip
goto p1
p6: for a ll processes j>i
p7: while not want[j] do skip
critical section
p8: want[i] false