-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
homework 4, run ./main-two-cvs-while -p 1 -c 3 -m 1 -C 0,0,0,1,0,0,0:0,0,0,1,0,0,0:0,0,0,1,0,0,0 -l 10 -v -t
the output is
NF P0 C0 C1 C2
0 [*--- ] p0
0 [*--- ] c0
0 [*--- ] c0
0 [*--- ] c0
0 [*--- ] c1
0 [*--- ] c2
0 [*--- ] c1
0 [*--- ] c2
.....
It seems that thread c1 execute Mutex_lock(&m);while (num_full == 0) {
,so thread c1 get the lock.
Then the CPU run thread c0,want to execute the same code.when he run Mutex_lock(&m);
,the lock is owned by c1.So he won't return from this routine.But the output shows that thread c0 has executed the Mutex_lock(&m);while (num_full == 0) {
.
WHY?
I have a poor english.I 'll be appreciated if someone can answer me!
Metadata
Metadata
Assignees
Labels
No labels