Asynchronous Notification and ATC in Ada

These are lecture notes from my Computer Science course. For learning about real-time systems, I recommend Real-Time Systems and Programming Languages.

What’s an Asynchronous Notification technique? It’s a way of getting the attention of something (a task/process/thread/gerbil) without the task/process/thread/gerbil waiting. Basically an interrupt.

Who needs it?

  • To enable a task to respond quickly to a condition detected by another task.
  • Error recovery e.g. to detect a deadline miss.
  • Mode changes; example given of an aircraft abandoning take-off mode and entering an emergency mode.
  • Useful for partial computation; you can interrupt the computing task to stop further refinement.

Alternative: Polling

Guess what? Polling is slow and bad.


ATC is implemented by using the select statement. Here’s an example:

	X.entry_call; -- This can have some delay too if you want.
	-- sequence of statements
then abort
	-- while we're waiting for this to occur, execute this:
	-- sequence of statements
end select;

If the entry call can occur immediately it does, and you never do the stuff after abort. If it can’t, then you execute the other stuff. However if the entry call then can be executed, execution is aborted. If you get all of the abort done, you stop ‘listening’ out for an entry call.

You an’t have an accept statement in the then abort bit.

The slides give some examples as to what will happen in different circumstances, but it’s fairly intuitive.

Generally you’d use this technique for something like receiving an error. e.g. you wouldn’t use it for ordinary operation; probably due to the fact that it causes this ‘aborting’ which sounds nasty to me.

This entry was posted in lecture, rts. Bookmark the permalink.