Lecture 22
Review -- message passing
chan queue of pending messages
send append to end of queue -- nonblocking
receive remove from front of queue -- blocking
empty(ch) true if ch is currently empty
interaction patterns: filters -- one way
client/server -- two way
interacting peers -- one or two way, as we shall see
Preview of Today -- "exam size" problems
filters -- receive then send
active subroutine -- client: send; receive
server: receive; send
multiple entry points -- "case" on message kind
delay points in server -- local queue plus ifs in arms of case statement
self scheduling -- local queue plus polling (using empty())
conversations -- rendezvous then client/server with multiple entries
[I did not have time for this; see the next lecture.]
Examples -- Sections 7.2 and 7.3
[I did these using transparencies for the indicated figures.
The presentation was kind of dry, however.
I need to figure out how to get the class involved next time.]
Figure 7.1 -- filter process to assemble characters
Figures 7.2 and 7.3 -- merge process and network
Figure 7.4 -- clients and server with one operation
Figure 7.5 -- multiple operations
Figure 7.6 -- resource allocation monitor
Figure 7.7 -- resource allocation using message passing
Table 7.1 -- duality of monitors and message passing
Figure 7.8 -- scheduling structures (I drew them by hand and
talked as I went; this worked well.)
Figure 7.9 -- self-scheduling disk driver