CS452 - Real-Time Programming - Fall 2008

Lecture 18 - Task Structure


Questions & Comment

  1. out 2

Task Structure

Server Notifier Buffer Courier

1. Simplest

  1. Notifier
  2. Server

Remember that all the calls provide error returns. You can/should use them for error recovery

2. Using a Courier

Simplest is best

  1. Notifier
  2. Courier
  3. Server

This gets you through a bottleneck where no more than two events come too fast.

Remember that all the calls provide error returns. You can/should use them for error recovery

3. Buffering

Add buffer before courier and server.

  1. Notifier
  2. Buffer
  3. Courier
  4. Server

4. Specialization

When there is a constant in a problem,

Example

One of your serial ports is always connected to the train

How to take advantage of this

The tension between specialization and generality

5. The Secretary

Think about the Server's send queue. It might have

Possible solutions

  1. Send queue priorities
  2. Ration access to clients using

Possible code

  1. Secretary
    initialize
    synchronize
    FOREVER {
      request = Receive( ... )
      switch ( request.type ) {
      case COURIER:
        status = FREE;
        waitingResult = request;
        Reply ( waiter, waitingResult );
        if ( !empty( requestQ ) ) {
          { waiter, waitingRequest } = dequeue( requestQ );
          Reply( courier, waitingRequest );
          status = BUSY;
        }
        break;
      case CLIENT:
        if ( status == BUSY ) {
          enqueue( requester, request );
        } else {
          Reply( courier, request );
          waiter = requester;
          status = BUSY;
        }
        break;
      }
    }
    
      
  2. Courier

6. The Administrator


Return to: