Additional exercises on Chapter 4

4-23 Discuss the relevance of the discussion of Section 4.6 on unary, binary and general scheduling to shared-memory multiprocessor systems.

Binary scheduling should be reconsidered in the context of multiprocessor scheduling. Suppose a process is running on each of the processors of a multiprocessor and an event occurs which frees some process. If the freed process has higher priority than the lowest priority running process it should pre-empt that process. (Assuming that we have pre-emptive scheduling and any process can run on any processor). If a running process makes another process runnable, the priority of that process should be compared with that of the lowest priority running process. If it is higher it should pre-empt that process.

4-24 Design the data structures that a kernel might maintain in order to manage threads.

Separate out the information that is specific to a single thread and that which is shared by the threads which belong to a given address space. The process descriptor shown in Figure 4.4 can be taken as a starting point. The exception address might be shared by all the threads of a process. otherwise a thread would need all the items mentioned. In addition, the process or address space identifier with which the thread is associated is needed. This would allow memory management information, open file information and so on to be shared by the threads of a process.

Design an OS system call interface for thread operations.

Note that threads will make use of the system calls for I/O etc that we have seen already. The additional system calls would allow a management thread of a process to control other threads. For example, a thread might wait on a user level semaphore and find it busy. The management thread should tell the OS that this thread can no longer run. We therefore need block (thread-id) and unblock (thread-id) calls. We also need a create call which returns a thread-id and a kill (thread-id) call. We may also need schedule and unscheduled in addition to create and kill or these may be combined with create and kill.

The system calls of Mach Chorus etc. may be consulted for a complete example specification.