next up previous
Next: Critical Section Up: No Title Previous: Too much milk problem

No more milk - some solutions

if (noMilk) {
   if (noNote) {
	leave Note;
	buy milk;
	remove note; } }

Solution 2

Process A		

leave noteA	
if (noNoteB) { 
 if (noMilk)
  buy milk }
remove noteA

ProcessB

leave noteB
if (noNoteA) {
 if (noMilk)
  buy milk }
remove noteB

Solution 3

Process A

leave note A
while (note B) // Pos: 1
  do nothing ; if
 (noMilk)
   buy milk ;
 remove noteA

Process B

leave note B
if (noNoteA) { // Pos: 2
  if (noMilk)
   buy milk }
  remove note B



Omer F Rana
Tue Feb 11 19:19:09 GMT 1997