page1
Shared
Memory
SemFull=0
/* t=0 */
SemEmpty=1
/* t=0 */
Producer
While (true) {
sem_wait(SemEmpty);
Write_to_memory;
sem_post(SemFull);
}
Consumer
While (true) {
sem_wait(SemFull);
Read_from_memory;
sem_post(SemEmpty);
}