Information Technology Reference
In-Depth Information
If we want to allow applications to be able to implement operating system-
like functionality, we need something more. For many of the reasons that oper-
ating system kernels need interrupt-based event delivery, applications can also
benefit from being told when some event that deserves its immediate attention
has occurred. Throughout this topic, we will see this pattern repeatedly: the
need to virtualize some part of the operating system kernel, so that applications
can behave more like operating systems. We call virtualized interrupts and ex-
ceptions upcalls.
In UNIX, they are called signals, and in Windows they are
Definition: upcalls
called asynchronous events.
Here are some cases where immediate event delivery with upcalls are useful:
Preemptive user-level thread package. Just as the operating system
kernel multiplexes processes onto a processor, an application may want to
multiplex its tasks, or threads, onto a process. A user-level thread package
can assume all of its tasks run to completion or at least cooperatively
yield the processor from time to time, but another approach is to to use a
periodic timer upcall as a trigger to switch tasks. This is helpful to share
the processor more evenly among user-level tasks. It is also helpful for
stopping a runaway task, e.g., if the application needs to run third party
code, such as when a web browser executes an embedded web page script.
Asynchronous I/O notification. A system call is designed to wait
until the requested operation is complete and then return. What if the
process has other work it could have done in the meantime? One approach
is asynchronous I/O : a system call starts the request and returns immedi-
Definition: asynchronous
I/O
ately; later on, the application can poll the kernel for I/O completion, or
a separate notification can be sent via an upcall to the application when
the I/O completes.
Interprocess communication. Most interprocess communication can
be handled with system calls | one process writes data, while the other
reads it sometime later. A kernel upcall is needed if a process generates an
event that needs the instant attention of another process. As an example,
UNIX will send an upcall to notify a process when the debugger wants
to suspend or resume the process. Another use is for logout | to notify
applications that they should save file data and cleanly terminate.
User-level exception handling. Earlier, we described a mechanism
where hardware exceptions, such as divide by zero errors, are handled by
the operating system kernel. However, many applications have their own
exception handling routines, e.g., to ensure that files are saved before the
application shuts down, or in some cases, to terminate an offending script,
while the rest of the application continues to work. For this, the operating
system needs to inform the application when it receives an exception, so
the application runtime, rather than the kernel, handles the event.
Search WWH ::




Custom Search