CS452 - Real-Time Programming - Spring 2012

Lecture 22 - Courier, Warehouse

Public Service Annoucements

  1. Exam: 9.00, August 8 to 11.30, August 9.
  2. I now have back my document creation tools. Assignments will start to be more uptodate.

Anthropomorphic Programming

We all, even most programmers (!), have effective intuitions about human relations

Tasks are independent entities

Servers and Attendant Tasks

Why do servers need attendant tasks?

1. Proprietor with a Notifier

Proprietor `owns' a service, which usually means a resource.

Kernel is handling hardware in this example

Notifier Code for a UART

Proprietor Code for a UART


  1. Notifier is usually of higher priority than server
  2. When, and how, do interrupts get turned on and/or cleared?
  3. Who coordinates hardware ownership?
  4. We have made the code

2. Using a Courier

Simplest is best

Transmit Notifier Code

This omits flow control. Is it better to handle flow control in the notifier or in the server?

Transmit Courier Code

Transmit Proprietor Code


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

Another possible arrangement for task creation

Another possible arrangement for initialization

Distributed gating

I am showing you collections of tasks implemented together because sets of related tasks is a level of organization above the individual task.

E.g., the decision to add a courier requires revision of code within the group, but not outside it.

3. Using a Warehouse

Add a warehouse between the courier and the notifier.

Notifier Code

Warehouse Code

Transmit Courier Code

Proprietor Code


This structure clears up most problems when a burst of requests to the server would leave the notifier waiting in a long sendQ..

Two issues:

  1. Handles bottlenecks of all sizes.

    Give a precise and quantitative definition of `bottleneck'.

  2. Server could be buffered on the other side

    Called a guard.

What this amounts to is that a server should be lean and hungry

Return to: