-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Description
Lecture 10 Semaphores II
page 15, the sudocode for the two threads in the critical section:
B[in] = product;
in = (in + 1) % k;
product = B[out];
out = (out + 1) % k;
look suspicious to me.
Maybe it should be like this.
for the Producer process:
B[in] = product;
in = in + 1;
out = out + 1;
for the Consumer process:
product = B[out];
in = in - 1;
out = out - 1;
Since we already have empty and full semaphore set to be the maxium size of the butter, we don't need to worry about index out of bound.
Metadata
Metadata
Assignees
Labels
No labels