Lecture Notes for Client-Server Interfaces

7 March 2002 - Single-Threaded Concurrency

  1. one computation, many requests

  2. multiplex the computation over the requests

    1. simple requests imply trivial multiplexing

    2. "simple" means short and one-time

    3. long or multi-message requests are not so simple

  3. why bother

    1. simplicity - no synchronization or communication (sorta)

    2. improved performance - low overhead

  4. multiplexing sockets - asynchronous io

  5. this is event-driven (or data-driven) programming

    1. io events

    2. timer events - time-outs, heartbeats

    3. could use alarm signals - complex and insecure

    4. fortunately, select() can combine time and io

    5. implementation

      1. keep a priority queue of timer events, nearest deadlines first

      2. the head of the queue determines the select() time-out

      3. on select() time-out, deal with the time-out event

      4. time-out events are function pointers.

    6. interface

      1. schedule a function call to occur

      2. cancel a scheduled function call

      3. respond to the time-out

This page last modified on 16 March 2002.