Cheap and Secure Web Hosting Provider : See Now

Relation between Signals and Events

, , No Comments
Problem Detail: 

There are POSIX signals (linux man), and various event-based operating systems (such as TinyOS, most seem to be targeted at embedded systems). But the mechanisms seem very similar.

Are the terms 'signal' and 'event' interchangeable? Or are signals a sub-set of events? Or are they two fundamentally different for some reason that I am completely missing?

Asked By : superdesk
Answered By : Gilles

As general concepts, the words signal, notification and event are mostly interchangeable, though they carry different connotations and some words wouldn't be used to denote some specific mechanisms. A particular operating system or other concurrency framework may use these terms for different mechanisms.

Some differences to watch for (with signals, events or whatever they're called) include:

  • Synchronous vs asynchronous: does the sender block until the recipient receives the signal?
  • Stacking: if multiple identical signals are generated before the recipient acknowledges any of them, will the recipient receive that many signals, or can they be merged?
  • Associated information: is the signal just "hey, wake up", or does it have an associated tag, or does it have a payload (which could be a pointer to a larger data structure)?
  • Destinations: does the signal target a specific task (unicast), or a set of recipients (multicast), or all tasks that care (broadcast)? In the multicast case, will all the specified targets receive the signal, or is the signal cleared as soon as one task acknowledges it (this may be termed unicast rather than multicast)?

For example, POSIX signals are asynchronous, unicast (multicast if sent to a process group), they stack, and have a tag which is a small integer. I'm not familiar with TinyOS; from a quick read of the tutorial I think they are asynchronous, unicast (perhaps with other possibilities), non-stacking, and have a payload (and, incidentally, sending an event is called signalling it; receiption is called triggering, because the event in TinyOS terminology is the handler instance rather than not the message).

I think the word event wouldn't be used if there is no associated information at all. The word signal wouldn't be used if there's a rich payload: with a rich payload, it's a message, possibly an event or a notification. GUI frameworks often call notifications of user input events; GUI events have a payload (e.g. to identify which key was pressed) and don't stack.

The use of the word event tends to promote event-driven architectures, where programs are structured as event callbacks rather than as a thread that checks for notifications periodically, but it isn't limited to this use.

Best Answer from StackOverflow

Question Source :

3200 people like this

 Download Related Notes/Documents


Post a Comment

Let us know your responses and feedback