You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ran main-two-cvs-while with the following arguments: ./main-two-cvs-while -l 5 -m 2 -p 1 -c 1 -v
1 producer, 1 consumer, buffer size of 2 and loops 5 times.
Every alternate run produces the following output:
Isn't the sequence of c0, p0, c1, c2, p1, p4 .. an incorrect locking mechanism?
Screenshot of the code:
Consumer acquires lock at c1, sleeps at the while loop at c2 and then we context switch to the producer, which seems to acquire the lock at p1? If consumer hasn't released the lock yet, how's this possible? It'd have made sense if the consumer had gotten to c3 (cond_wait - where it'd sleep and release the lock which the producer could have then acquired in p1)
Am I missing something obvious?
The text was updated successfully, but these errors were encountered:
Ran main-two-cvs-while with the following arguments:
./main-two-cvs-while -l 5 -m 2 -p 1 -c 1 -v
1 producer, 1 consumer, buffer size of 2 and loops 5 times.
Every alternate run produces the following output:
Isn't the sequence of c0, p0, c1, c2, p1, p4 .. an incorrect locking mechanism?
Screenshot of the code:
Consumer acquires lock at c1, sleeps at the while loop at c2 and then we context switch to the producer, which seems to acquire the lock at p1? If consumer hasn't released the lock yet, how's this possible? It'd have made sense if the consumer had gotten to c3 (cond_wait - where it'd sleep and release the lock which the producer could have then acquired in p1)
Am I missing something obvious?
The text was updated successfully, but these errors were encountered: