CS452 - Real-Time Programming - Spring 2015

Lecture 21 - Anthropomorphic Programming

Public Service Annoucements

  1. Train Control I demo on Friday, 3 July.
  2. The exam has three start times. The end times are 26.5 hours after the start time.
    Answers to questions asked from 20.30, 4 August to 22.00, 4 August will be answered on the newsgroup, whether they arrive by e-mail or on the newsgroup.
  3. PDF on Acceleration Mathematics.

Calibration I

1. Calibrating Stopping Distance

2. Calibrating Constant Velocity

3. Calibrating Acceleration and Deceleration: short distances.

4. Calibrating Acceleration and Deceleration: Doing Better

There are three models of interest.

  1. Abrupt change of velocity.
  2. Constant acceleration.
  3. Zero acceleration at the end points: finite jerk.

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.

Notifier Code for a UART

Proprietor Code for a UART


  1. Notifier is usually of higher priority than server
  2. We assume that interrupts get turned on and/or off in the kernel?
  3. We hope that the code

2. Using a Courier

Simplest is best

Transmit Notifier Code

Transmit Courier Code

Transmit Proprietor Code


This gets you through a bottleneck where at most 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. The Warehouse

Add a warehouse between the courier and the notifier.