STREAMS/UX for the HP 9000 Reference Manual
71
STREAMS/UX Multiprocessor Support
Running Modules and Drivers in Uniprocessor Emulation Mode
Running Modules and Drivers in Uniprocessor
Emulation Mode
STREAMS/UX supports uniprocessor emulation for modules and drivers.
Modules and drivers which run on uniprocessor systems can run on
multiprocessor systems under UP emulation without code changes. This
section presents an overview of UP emulation, describes how to configure
modules and drivers for UP emulation, describes what happens when a
stream contains both UP emulation and MP scalable modules, and describes
how UP emulation affects performance. Lastly, this section contains some
UP emulation programming guidelines.
How STREAMS/UX Executes UP Emulation Modules and Drivers
This section describes how STREAMS/UX supports UP emulation. HP-UX
provides UP emulation for non-STREAMS device drivers which were
developed for uniprocessor systems.
HP-UX uses a semaphore called the I/O semaphore and a spinlock known as
the spl lock to implement UP emulation. HP-UX uses the I/O semaphore to
serialize driver system calls. HP-UX acquires the I/O semaphore before
calling the driver to process a system call. HP-UX uses the spl lock to
prevent a driver interrupt on one processor from running in parallel with a
driver system call on another processor. When a driver calls spln to raise the
spl level, HP-UX acquires the spl lock. When an interrupt occurs for a UP
emulation driver, HP-UX acquires the spl lock before calling the driver's
interrupt handler.
STREAMS/UX extends UP emulation for STREAMS/UX modules and
drivers. A stream can be entered in two ways. One way is through a system
call. Either the I/O system or STREAMS/UX acquires the I/O semaphore
before executing a system call for a UP emulation stream. Also, a stream
can be entered from non-STREAMS software in the kernel. For example, an
interrupt handler can call putq, putnext,put, or streams_put to enter a stream.
If code on the interrupt control stack (ICS) calls putq for a UP emulation
stream, the STREAMS/UX UP emulation scheduler runs the service routine.
This scheduler acquires the I/O semaphore. If an interrupt occurs for a UP