Skip to main content
Article thumbnail
Location of Repository

R.: Goal-oriented programming, or composition using events, or threads considered harmful. EW-8

By Robbert Van Renesse


Many applications, and particularly distributed applications, are about dealing with events. The code is of the form: when this message arrives do this; when this timer expires do that; when that server fails do something else; etc. Perhaps the most natural way to program this is by using interrupt handlers. Programmers have found this hard to program, and prefer loops of the form: for ever { e = await event(); handle event(e);}. But there are several problems with this approach. The handle event routine may take a long time to execute, slowing down the handling of subsequent events. Worse, handle event may invoke await event to wait, for example, for the reply of a Remote Procedure Call. To deal with this, the thread abstraction was introduced. While threads are handling events, or awaiting specific events, unrelated events can be handled by other threads. Unfortunately, anybody who has ever used threads extensively will agree that threads are error prone, hard to debug, and often non-portable. Composing packages that use different thread abstractions is usually not possible or extremely hard. The only widely popular language that supports threads well, Java, is still rarely used for serious distributed systems applications. Even there, simple applets that use threads often have bugs in them, in that they do not stop when they are off the screen, do not start up correctly when they reappear, or have race or deadlock conditions when they access shared object instances

Year: 1998
OAI identifier: oai:CiteSeerX.psu:
Provided by: CiteSeerX
Download PDF:
Sorry, we are unable to provide the full text but you may find it at the following location(s):
  • (external link)
  • (external link)
  • Suggested articles

    To submit an update or takedown request for this paper, please submit an Update/Correction/Removal Request.