Sample midterm exam
In a multi-process system, at any moment every process is in
one of three states: running, ready, or blocked. What are the transitions
between these states, and when do they occur?
Suppose that process P is ready, and the scheduler decides to resume
running it. How does it determine the address of the next instruction
to run in P?
Explain briefly (1 or 2 sentences) the major difference
between a thread and a process. Name one type of state that is recorded
in a thread table. Name one type of information that is saved in
a process table but not in a thread table.
Problem 4 (Multiple choice: Give all correct answers)
Suppose there are two processes, A and B, which share semaphors
R and S. At the starting time, R = 0, S = 1. A and B are entering the
sections of code shown below:
Process A: Process B:
DOWN(R); Operation B.1;
Operation A.1; Operation B.2;
Operation A.2; Operation B.3;
Which of the following statements are true (more than one may be true:)
- A. Operation A.1 cannot start until operation B.1 is complete.
- B. Operations A.1 and B.2 cannot execute simultaneously.
- C. Operations A.1 and B.3 cannot execute simultaneously
- D. Operations A.2 and B.3 cannot execute simultaneously
- E. The system may deadlock.
Problem 5 What is spooling, and why is it used?
Suppose that jobs arrive according to the following schedule.
Process Starting Time Run Time
A 0 12
B 3 7
C 6 2
D 8 5
E 9 2
F 12 12
Trace the progress of the system if the scheduler used is
- First come first served.
- Shortest job next
- Shortest remaining time next
What is starvation? Give an example of a scheduling algorithm that
is susceptible to starvation. How can this algorithm be modified
to avoid the problem?
A particular system uses a page size of 1K bytes. A page table for a particular
process begins as follows: [ 3, 4, *, 1, *, 8 ...]
(Note: everything uses 0-based indexing.)
- A. What physical address corresponds to the virtual address of 50?
- B. Name a virtual address that will generate a page fault.
- C. Suppose that the machine has 256M of RAM and that processes
use a 4 GByte address space. How many entries are there in the page table?
Consider a paging system that uses the "Not Recently Used" (NRU) page
- What is the significance of the "R bit" and the "M bit"?
- When are the R bit and M bit set and reset?
- How is a page chosen for replacement?