====== Week 10 ======
~~NOTOC~~
===== Channels, CSP, and Go =====
* Last week:
* Peter Welch's [[courses:cs377-202201:welch-lectures:top|Occam-pi Lecture Notes]]
* Go demo and starter code: see last week's notes for details
* Demo and codewalk of ''csp-dining-philosophers.go'' \\ \\
* Demo and codewalk: Sieve of Eratosthenes (Prime Number Sieve) ''sieve.go''
* Go language features highlighted:
* Only one looping construct in Go: for loop
* all three parts are optional: init statement, conditional expression, post statement
* channel declarations in function headers
* can specify syntactically whether channel is for reading from: <-chan or writing to: chan<-
* To run this program:
$ go run sieve.go
* Monitor the running program:
* use ''top'' command for system info while running
* run ''lscpu'' to remind us about system resources
* how many processes (goroutines) are running concurrently (if not in parallel)?
* use ''wc -l'' and ''watch'' to monitor // //
* Assignment 5 posted
* Sort Pump Gophers {{sort-pump.pdf|PDF}}
* see a similar example in occam on slides 13--31 of PHW's replicators lecture notes which can be found [[courses:cs377-202651:welch-lectures:top|here]]
* be sure to read the advice section of the assignment description closely---I tried to document most of the Golang learning curve questions I encountered in the hopes of helping you!
* Due: Tue, April 14th \\ \\
===== Linda and Tuple Space =====
* History
* proposed by David Gelernter [[https://en.wikipedia.org/wiki/David_Gelernter|Wikipedia]]
* while a PhD student at SUNY Stoneybrook
* now a professor at Yale
* overcome a great deal personally!
* origins of name
* off-color humor
* implementations
* C-Linda (Martin Schultz and David Gelernter)
* Ruby implementation no less off-color!
* communications decoupled in 3 dimensions:
* time
* space
* destination
* Lecture Notes: {{cs377-linda-lect1.pdf|PDF}}
* Demo of Ruby/Rinda program
* from Wikipedia example: \\ [[http://en.wikipedia.org/wiki/Rinda_(Ruby_programming_language)]]
* link no longer live :-(
* sample code: copy from my directory
$ cp -r /home/mlsmith/cs377-examples/rinda/ ~/cs377/