Event Queue

A queue that contain events inside. Events occur in an asynchronous manner at the OperatingSystem level. The OperatingSystem may respond to events immediately or put them in an EventQueue for later processing.

EventQueues are an easy way to achieve AsynchronousProgramming. Compare with AsynchronousSystemTrap.

The advantages of EventQueues are that they perform well and do not require LockBasedSynchronization. If you think LockFreeSynchronization is a GoodThing, EventQueues are a good match.


A way to achieve AsynchronousProgramming using EventQueues:

Ask the operating system for something. Instead of using the result immediately afterwards, you do other operations and when finished, read an EventQueue. (E.g. via select in Unix systems.)

All petitions made to the operating system are responded to through the event queue. Each event has all the necessary information (context) to know what to do with the result.

The most obvious advantage of programming this way is that the consumer's responsiveness can be several times faster than when using synchronous programming for the same task. Multiple I/O requests can progress simultaneously, and computation can overlap with them. This is a GoodThing.


Smalltalk/V and SmalltalkExpress are systems that use EventQueues and that are well integrated with Windows in that respect. You should take a look: SmalltalkExpress was free for download and most code is there to look at.


Related: MessageQueue, GuiThread.


CategoryConcurrency CategoryEvents


EditText of this page (last edited February 26, 2007) or FindPage with title or text search