CS452 - Real-Time Programming - Spring 2011

Lecture 16 - Anthropomorphic Programming

Pubilic Service Announcement

  1. Possible bottlenecks in Terminal/ARM/Train system

Serial I/O

Interrupts

Implementation


Task Structure

We are supposed to support

int Get( int port )

and

int Put( int port, char c )

These are wrappers for sends to one or more serial servers.

How many servers and notifiers?

one server two servers four servers
one

notifier

likely queue

congestion in

server

likely queue

congestion

in notifer

two

notifiers

one per channel?

one per direction?

how should they

be paired?

four

notifiers

certain queue

congestion

in server

likely queue

congestion in

server

best performance,

most tasks

How should we handle a terminal?

Issues

  1. Line editing
  2. Echo

    Either

    Or


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/Notifier Code for a UART

Notes

  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

Transmit Courier Code

Transmit Proprietor Code

Notes

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.


Debugging Real-time Programs

RedBoot

The memory contents are not wiped by reset. Some of the most difficult errors can be detected only by using the contents of memory after a reset. Produce useful results by inserting

    str   pc, <magic location>

into your code, and with the assistance of a load map, finding out where you were in whose code when the problem occurred.

Stack Trace

In single-threaded programs this is often the most useful tool.

What is the equivalent of a stack trace in a real-time multi-tasking environment?

Breakpoint

What does it do?

How do you get it started?

Breakpoint is a special case of a particular sort of tool that is very common.

Getting information closer to real-time.


Return to: