next up previous
Next: Message Passing Up: Architecture Previous: Starting Processes

   
Monitors

Shared memory is managed by p4_shmalloc and p4_shfree, which have different implementations on different shared-memory machines. On those with very primitive memory management systems for shared memory (for example, no ``free'' operation), we have implemented a simple and portable memory management subsystem inside of p4. We are thus able to present the same interface to the programmer no matter what the underlying system is.

The most fundamental operation for shared-memory programming is the lock. We use spin locks on most systems, although a few machines have more sophisticated locking functions that we use when possible. It is then possible to layer the basic monitor-building primitives (p4_enter, etc.) on top of the locks, and then the library of monitors (p4_barrier, p4_askfor, etc.) on top of these. Thus almost all of the code in the implementation is completely portable; to implement monitors on a new shared-memory machine, one needs only a new set of definitions for locks. For example, the current implementation of p4 does not take advantage of special vendor-specific barrier code, although it would be relatively easy to extend the system to do so.



Karen D. Toonen
1998-11-19