13.07.2015 Views

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

298 Co-operating Processes Chapter 9Interrupts may be sent only to children or other descendants.Interrupts may be sent only to processes owned by the same user.Processes create an ‘‘interrupt identifier,’’ which is inherited by children. TheInterrupt service call specifies the interrupt identifier instead of a process number,and all processes that have that identifier receive the interrupt.When a process is the target of a virtual interrupt, it is usually forced into its interrupthandler. We might provide the following service call, which allows processes tochoose alternative reactions to virtual interrupts: Handle(interrupt number, method). The most straightforward method is‘‘ignore.’’ The process is then immune to any virtual interrupts of this type.<strong>An</strong>other method is ‘‘quit,’’ which indicates that the process considers this class ofinterrupt so severe that it prefers to terminate if the interrupt occurs. A relatedmethod is ‘‘abort,’’ which terminates the process and generates a dump of its virtualspace. Yet another method is ‘‘wait,’’ which tells the operating system thatthe process would like to be blocked until such an interrupt occurs. Finally, theprocess might provide an interrupt handler that is to be invoked upon receiving theinterrupt.Some virtual interrupt numbers might be reserved by the operating system for predefinedsorts of information, such as the following:The user typed the ‘‘attention’’ key.A child has terminated. If this event can cause a virtual interrupt, the Join servicecall is not needed.The process has performed an invalid arithmetic operation, such as dividing byzero.The process must terminate. We might disallow associating a handler with this virtualinterrupt.A timer set by the process has expired.Some limit, such as file size or virtual time, has been exceeded.The process must stop, but it may be started later by its parent.The process has been restarted after a stop.A child has stopped or otherwise changed status.Data are available for input from a device.The display window to which this process is connected has changed shape.All these interrupts have one aspect in common: They tell the process that its environmenthas changed in a way that it may need to know about.2.3 PipesAs mentioned earlier, Unix provides an inter-process communication mechanism thatallows the output of one process to become the input of another. The heart of themechanism is the concept of a pipe, which is very much like a file opened for reading or

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!