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.
Guess what? Polling is slow and bad.
ATC is implemented by using the
select statement. Here’s an example:
select 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.