CS452 - Real-Time Programming - Spring 2015

Lecture 28 - Pathologies II.

Public Service Annoucements

  1. Train Control II demo on Wednesday, 11 July.
  2. Lecture menu:
  3. What I saw yesterday
  4. 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.


Pathologies

As we go down this list both pathology detection and the length of the edit-compile-test cycle grow without bound.

1. Deadlock

One or more tasks will never run again.

Kernel can detect the first three; only the train application can detect the fourth.

2. Livelock (Deadly Embrace)

Definition

Two or more tasks are READY. For each task, the state of other tasks prevents progress being made regardless of which task is ACTIVE.

3. Critical Races

Example

  1. Two tasks, A & B, at the same priority
  2. A is doing a lot of debugging IO
  3. B always reserves a section of track before A, and all is fine.
  4. Debugging IO is removed
  5. A reserves the section before B can get it, and execution collapses.
  6. Lower priority of A to the same level as C.
  7. Now C executes faster and gets a resource before D .
  8. You shuffle priorities forever, eventually reverting, to put back in the debugging IO.

Definition

The order in which computation is done is an important factor in determining whether or not it is successful.

Critical races, like Livelock can be

Symptoms

  1. Small changes in priorities change execution unpredictably, and drastically.
  2. Debugging output changes execution drastically.
  3. Changes in train speeds change execution drastically.

`Drastically' usually means chaos in both senses of the term.

  1. Sense one: a small change in the initial conditions produces an exponentially growing divergence in the execution.
  2. Sense two: exercise for the reader.

Solutions

  1. Explicit synchronization
  2. Gating is a technique of global synchronization

4. Performance

Changes in performance of one task with respect to another often give rise to critical races

The hardest problem to solve

In practice, how do you know you have performance problems? Problems I have seen: