HPlogo Interprocess Communication: Programmer's Guide: HP 3000 MPE/iX Computer Systems > Chapter 6 Software Interrupts

Example—Use of Software Interrupts

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

Software interrupts are most often used to handle high-priority requests while the process is doing low-priority time-consuming tasks.

For example, suppose an application is copying a large file across a network. The copy may take a long time (up to several hours). During this time, the application wants to see and respond to high-priority commands written to its command message file (for example, requests for the number of records copied so far, or that the copy stop immediately).

To accomplish this, the application posts a "software interrupt" FREAD against its command message file. The FREAD just signals to MPE/iX that this application wants to know about any new commands written to this message file. No data is transferred at the time the FREAD is called. Software interrupt FREADs never wait; they return to the application immediately.

The application then starts to perform the copy. Unlike NOWAIT I/O, the application does not have to poll the command message file repeatedly to see if data has been written there. MPE/iX signals the application (with a software interrupt) that data has been written to the command message file and that the application should complete the I/O.

In our example, if a high-priority command is written to the message file, MPE/iX immediately causes a software interrupt. The part of the application performing the copy is stopped, and MPE/iX forces the execution of the application's interrupt handling procedure. There the application completes the read by calling IOWAIT or IODONTWAIT, and processes the command. When the interrupt handling procedure completes, the part of the application performing the copy resumes automatically at the statement where it left off.

Feedback to webmaster