1 / 6

Structured Thread Models

Structured Thread Models. Kahn Process Networks, CSP, Go. Kahn Process Network. Deterministic Processes Unbounded FIFO channels Non-blocking writes, blocking reads. Note: figure from Wikipedia. sequential process. communication channel. Communicating Sequential Processes (CSP).

Ava
Download Presentation

Structured Thread Models

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Structured Thread Models Kahn Process Networks, CSP, Go Dennis Kafura – CS5204 – Operating Systems

  2. Kahn Process Network • Deterministic Processes • Unbounded FIFO channels • Non-blocking writes, blocking reads Note: figure from Wikipedia Dennis Kafura – CS5204 – Operating Systems

  3. sequential process communication channel Communicating Sequential Processes (CSP) • single thread of control • autonomous • encapsulated • named • static • synchronous • reliable • unidirectional • point­to­point • fixed topology CS 5204 – Operating Systems

  4. Go Language See: http://golang.org/doc/effective_go.html#concurrency • go routine • Executed concurrently • No return value • Syntax: go list.sort() • Channels • Typed • Specified bounds on channel capacity • Used for • Return value(s) from go routine • Communication with/among go routine(s) • Syntax • ci := make(chanint) // unbuffered channel of integers • cj := make(chanint, 0) // unbuffered channel of integers • Ck := make (chanint, 100) //buffered channel of integers Dennis Kafura – CS5204 – Operating Systems

  5. Go example varsem = make(chanint, MaxOutstanding) funchandle(r *Request) { sem<- 1 // Wait for active queue to drain. process(r) // May take a long time. <-sem // Done; enable next request to run. } funcServe(queue chan *Request) { for { req<-queue go handle(req) // Don't wait for handle to finish. } } Dennis Kafura – CS5204 – Operating Systems

  6. Common Ideas • Concurrency • Single threaded, deterministic processes • Non-determinism limited to interleaved execution of deterministic processes • Interaction • Communication only via specified channels • no shared memory • Unify communication and synchronization • Reads block when data unavailable • Write blocks if channel capacity exceeded or receiver not ready • Relates state of receiver to state of sender Dennis Kafura – CS5204 – Operating Systems

More Related