Exercises
-
4.1 For each state listed in Table 4.1, list the system queues on which a process in that state might be found.
-
4.2 Why is the performance of the context-switching mechanism critical to the performance of a highly multiprogrammed system?
-
4.3 What effect would increasing the time quantum have on the system's interactive response and total throughput?
-
4.4 What effect would reducing the number of run queues from 64 to 32 have on the scheduling overhead and on system performance?
-
4.5 Give three reasons for the system to select a new process to run.
-
4.6 Describe the three types of scheduling policies provided by FreeBSD.
-
4.7 What type of jobs does the time-share scheduling policy favor? Propose an algorithm for identifying these favored jobs.
-
4.8 When and how does thread scheduling interact with memory-management facilities?
-
4.9 After a process has exited, it may enter the state of being a ZOMBIE before disappearing from the system entirely. What is the purpose of the ZOMBIE state? What event causes a process to exit from ZOMBIE?
-
4.10 Suppose that the data structures shown in Figure 4.2 do not exist. Instead, assume that each process entry has only its own PID and the PID of its parent. Compare the costs in space and time to support each of the following operations:
-
Creation of a new process
-
Lookup of the process's parent
-
Lookup of all of a process's siblings
-
Lookup of all of a process's descendants
-
Destruction of a process
-
-
4.11 What are the differences between a mutex and a lock-manager lock?
-
4.12 Give an example of where a mutex lock should be used. Give an example of where a lock-manager lock should be used.
-
4.13 A process blocked without setting the PCATCH flag may never be awakened by a signal. Describe two problems a noninterruptible sleep may cause if a disk becomes unavailable while the system is running.
-
4.14 Describe the limitations a jail puts on the nlesystem name space, network access, and processes running in the jail.
-
*4.15 In FreeBSD, the signal SIGTSTP is delivered to a process when a user types a "suspend character." Why would a process want to catch this signal before it is stopped?
-
*4.16 Before the FreeBSD signal mechanism was added, signal handlers to catch the SIGTSTP signal were written as
catchstop() { prepare to stop; signal (SIGTSTP, SIG_DFL); kill (getpid(), SIGTSTP); signal (SIGTSTP, catchstop) ; }
This code causes an infinite loop in FreeBSD. Why does it do so? How should the code be rewritten?
-
*4.17 The process-priority calculations and accounting statistics are all based on sampled data. Describe hardware support that would permit more accurate statistics and priority calculations.
-
*4.18 Why are signals a poor interprocess-communication facility?
-
**4.19 A kernel-stack-invalid trap occurs when an invalid value for the kernel-mode stack pointer is detected by the hardware. How might the system gracefully terminate a process that receives such a trap while executing on its kernel-run-time stack?
-
**4.20 Describe alternatives to the test-and-set instruction that would allow you to build a synchronization mechanism for a multiprocessor FreeBSD system.
-
**4.21 A lightweight process is a thread of execution that operates within the context of a normal FreeBSD process. Multiple lightweight processes may exist in a single FreeBSD process and share memory, but each is able to do blocking operations, such as system calls. Describe how lightweight processes might be implemented entirely in user mode.