Process 我的解决方案是否满足互斥的要求

Process 我的解决方案是否满足互斥的要求,process,semaphore,flags,critical-section,mutual-exclusion,Process,Semaphore,Flags,Critical Section,Mutual Exclusion,为了满足互斥性,我写了两个过程,但我不确定是否是。。 我的初始标志值是0 process 1 while(1){ while flag=1 do{-nothing-} flag=1 -enter critical section- flag=0 } process 2 while(1){ while flag=1 do{-nothing-} flag=1 -enter critical section- flag=0 } 事实上,它们完全一样。 这两个过程是否满足互斥性?

为了满足互斥性,我写了两个过程,但我不确定是否是。。 我的初始标志值是0

process 1
while(1){

while flag=1 do{-nothing-}

flag=1

-enter critical section-

flag=0

}

process 2
while(1){

while flag=1 do{-nothing-}

flag=1

-enter critical section-

flag=0

}
事实上,它们完全一样。 这两个过程是否满足互斥性? 我看不出违反了什么要求

Process 1                            Process 2

check if flag is 0 - it is
                                          check if flag is 0 - it is
set flag to 1
                                          set flag to 1        

At that point both processes are in their critical sections.