CS 452/652 Winter 2020 - Lecture 9
January 24, 2020
SRR for Producer/Consumer
- single producer, single consumer (SPSC)
- producer sends, consumer responds with ack: "push" communication
- consumer sends/requests, producer responds with element: "pull" communication
- multiple producers, single consumer (MPSC)
- push communication works ⇒ producers are senders
- pull communication: slow producer might block consumer (and thus other producers)
- single producer, multiple consumers (SPMC)
- push communication: slow consumer might block produce (and thus other consumers)
- pull communication works ⇒ consumers are senders
- multiple producers, multiple consumers (MPMC)
- need intermediary: buffer ("distributor", "warehouse")
- buffer: acts as single consumer to producers, single producer to consumers
- buffer full or empty: block respective producer(s)/consumer(s)?
- design decision: blocking vs. non-blocking (return error) operation
- buffer receives requests, processes request, (delayed?) response
- buffer never sends, only receives ⇒ server pattern
- pervasive topic in computer science
- systems: memory address - name for circuit, name for device register
- programming: variable - name for memory location or register
- operating system: file - name for data on disk
- Internet: DNS - name for IP address
- Internet: URL - name for remote file/service and access protocol
- name resolution always starts in a default context with a default starting point!
- file system: / (slash) & kernel
- Internet domain names: . (dot) & local resolver
- this is called closure mechanism
- here: default name server
- implicit/default starting point: tid of name server
- use hack: global, hard-coded, other?
- tid-based communication facilitated by kernel (see 'Communication' earlier)
- names are null-terminated character arrays
- maximum length? error? truncate?
- WhoIs()for non-existing name? error? block?
- RegisterAs() overwrites previous registration for same name
- design of name server (data structure and operation):
- how many names?
- how often is name server used? when?
- visibility: routine, file, global → limited protection
- use visibility as much as possible to protect memory
- software protection
- programming languages (compiler & runtime): Go, Java, Rust
- location: stack, data, heap
- hardware protection via MMU (not mandatory)