Computer Science 432 |
Lecture 06: CPU Scheduling 3: Multiprocessors, Linux 2.6, FreeBSD ULE. Cooperating Processes, Bounded Buffer Problem
Date: September 26, 2006
There is no lecture assignment to submit for Thursday. Work on those simulations!
The readings for next time are SG&G Sections 3.4.1 and 6.1-6.3.
int buffer[n]; int in=0; int out=0;
while (1) { ... produce item; ... while (((in+1)%n) == out); /* busy wait */ buffer[in]=item; in=(in+1)%n; }
while (1) { while (in==out); /* busy wait */ item=buffer[out]; out=(out+1)%n; ... consume item; ... }
int buffer[n]; int in=0; int out=0; int counter=0;
while (1) { ... produce item; ... while (counter==n); /* busy wait */ buffer[in]=item; in=(in+1)%n; counter=counter+1; }
while (1) { while (counter==0); /* busy wait */ item=buffer[out]; out=(out+1)%n; counter=counter-1; ... consume item; ... }