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
So the first two items, 300 and 205, are printed by the main thread.
But according to the program on page 181:
let buffer = 0
in let producer = proc (n)
letrec
wait4(k) = if zero?(k)
then set buffer = n
else begin
print(-(k,-200));
(wait4 -(k,1))
end
in (wait4 5)
in let consumer = proc (d)
letrec busywait(k) = if zero?(buffer)
then begin
print(-(k,-100));
(busywait -(k,-1))
end
else buffer
in (busywait 0)
in begin
spawn(proc (d) (producer 44));
print(300);
(consumer 86)
end
205 is printed by subthread. So the text on page 180 might be:
So the first two items, 300 and 205, are printed by the main thread and the subthread respectively.
The text was updated successfully, but these errors were encountered:
The third line from the end of page 180 says:
But according to the program on page 181:
205
is printed by subthread. So the text on page 180 might be:The text was updated successfully, but these errors were encountered: