In place of a lecture today, please watch two talks by Rob Pike: "Concurrency
is not Parallelism". with slides available here; (use your left and right arrow keys to navigate the slides)
and
Go concurrency patterns
with slides here.
The first 14 minutes or so of the first talk review discussions we've had in this class before -- Pike's perspective should complement things we've alread talked about. Then comes a very brief intro to Go's concurrency mechanisms. About 23 minutes in he talks about a load balancer design and implementation. He touts the value of having channels as first-class values.
Study questions for the first talk:
after 0. How would you use the technique of the Channel example (slide 33) to implement a timeout option for select similar to that of Erlang's after with a time value.
Study questions for the second talk. Note that the slides have a Run button that you can use to run the code on the slides.
timeout. Why is the behavior on slide #36 different from that on slide #35 (beyond the comment that's already on the slide!)
select operation be implemented as a normal function operating on a list
of Event values -- no special
syntax required. In Go, select is implemented using special syntax -- the select statement
much as in Erlang communication is implemented using special syntax -- the receive operation
and the ! operation. What advantages/disadvantages do you see with each approach?