– 1.8: What is the purpose of interrupts? How does an interrupt differ from a trap? Can traps be generated intentionally by a user program?
If so, for what purpose?
– 2.10: What is the main advantage of the microkernel approach to system design? How do user programs and system services interact in a microkernel architecture? What are the disadvantages of using the microkernel approach?
– 3.1: Describe the differences among short-term, medium-term, and long-term scheduling.
– 3.15*: In Exercise 3.14, the child process must output the sequence of numbers generated from the algorithm specified by the Collatz conjecture because the parent and child have their own copies of the data. Another approach to designing this program is to establish a shared-memory object between the parent and child processes. This technique allows the child to write the contents of the sequence to the shared-memory object. The parent can then output the sequence when the child completes. Because the memory is shared, any changes the child makes will be reflected in the parent process as well.
(… to be continued…)
– This program will be structured using POSIX shared memory as described in Section 3.5.1. The parent process will progress through the following steps:
(a) Establish the shared-memory object (shm_open(), ftruncate(), and mmap()).
(b) Create the child process and wait for it to terminate.
(c) Output the contents of shared memory.
(d) Remove the shared-memory object.
One area of concern with cooperating processes involves synchronization issues. In this exercise, the parent and child processes must be coordinated so that the parent does not output the sequence until the child finishes execution. These two processes will be synchronized using the wait() system call: the parent process will invoke wait(), which will suspend it until the child process exits.
– 4.2: Under what circumstances does a multithreaded solution using multiple kernel threads provide better performance than a single-threaded solution on a single-processor system?
– 4.19*: Write a multithreaded program that outputs prime numbers.
This program should work as follows: The user will run the program and will enter a number on the command line. The program will then create a separate thread that outputs all the prime numbers less than or equal to the number entered by the user.
P0
– 7.12: Consider the following snapshot of a system :
Allocation
A B C D
Max
A B C D
3 0 1 4 5 1 1 7
P1
P2
2 2 1 0
3 1 2 1
3 2 1 1
3 3 2 1
P3 0 5 1 0 4 6 1 2
P4 4 2 1 2 6 3 2 5
(to be continued…)
(… continued from the previous slide)
Using the banker’s algorithm, determine whether or not each of the following states is unsafe. If the state is safe, illustrate the order in which the processes may complete.
Otherwise, illustrate why the state is unsafe.
(a) Available=(0,3,0,1)
(b) Available=(1,0,0,2)
– 8.4: Most systems allow a program to allocate more memory to its address space during execution. Allocation of data in the heap segments of programs is an example of such allocated memory. What is required to support dynamic memory allocation in the following schemes?
(a) Contiguous memory allocation
(b) Pure segmentation
(c) Pure paging
– 9.12: Discuss situations in which the most frequently used (MFU) page-replacement algorithm generates fewer page faults than the least recently used (LRU) page-replacement algorithm. Also discuss under what circumstances the opposite holds.