Chapter 13 IPC and System Structure
Exercises
13-1 To what extent can processes which run in separate address spaces make use of kernel-provided semaphores to support their co-operation? To what extent can processes which share an address space or part of an address space make use of this facility?
Processes in separate address spaces may use the WAIT and SIGNAL semaphore operations to co-operate provided they are able to share a naming scheme for the semaphores. The kernel must assist in extending each process’s name space by these shared semaphore names. An example is that the names of semaphores associated with processes are well known. They may then synchronise by means of WAIT and SIGNAL. The kernel assists by blocking and unblocking the processes in the implementation of the operations.
We assume that the processes which share an address space are known to the kernel. Synchronisation may be achieved as described above. If the kernel-provided semaphores may be created by processes, a semaphore may be created to guard a shared data object. The co-operating processes synchronise their accesses to it via WAIT and SIGNAL. Arbitrary data sharing may be achieved by this means.
13-2 How would you expect a user level process to request a service from an operating system in a procedural system and in a non-procedural system? How might the hardware constrain or support the choice of system structure? When do context switches take place in both cases?
In a procedural system a process enters the operating system to carry out the service for itself. There is a protection domain change (effected by a TRAP or similar software interrupt instruction) but not a process switch.
In a non-procedural system a process sends a message to an operating system process to request service. There is a context switch to an OS process.
Hardware points: context switching overhead, software interrupt provision, at least two privileged states, memory protection support, see for example the assumption in the MIPS R2/3000 architecture that the OS occupies half of a 4Gbyte address space (Figure 8.3).
13-3 What is meant by the assertion that procedural and non-procedural systems may be viewed as duals of each other?
Give the duality mapping of: monitor, monitor procedure, condition synchronisation on a condition variable in a monitor, process, monitor procedure call, dynamic process creation.
Outline how the monitors given as examples in Chapter 11, including the exercises, may be rewritten as processes. (Details of how to do this are given in the next chapter.)
Lauer and Needham (1978) "On the Duality of System Structures" answers this question in detail.
A server, invoked by message passing, is considered as the dual of a monitor. Chapter 13 shows that a server may have a number of ports, each associated with an operation that it will carry out on request from a client. At this stage a request message could be assumed to contain the name of the operation the client requires as well as the arguments of the operation.
The most difficult aspect is to mirror condition synchronisation within a monitor procedure. Lauer and Needham assume that the server may define a "port set" dynamically. It will accept a message on any port in the set. If a resource becomes exhausted the port at which it is requested is removed from the set. If a resource becomes available again its port is added to the set. This achieves synchronisation at the level of operations.
The monitor examples can be reworked on this basis or may be done after Chapter 13.