CSC 718 -- Operating System Design
Exam 1
Answer all the questions. The maximum credit for each question is as shown.
1. (15) For each of the following statements indicate whether it is true or false, and
give a one-sentence justification.
a. A process is a program.
Ans: False
A process is a program in execution.
b. Suspending a process involves suspending all threads of the process since
all threads share the same address space.
Ans: True
Suspending a process is to swap this process to disk to free up more
memory. Since resources belong to the process, so if the process is
suspended, all threads of the process will be suspended.
c. In a multithreaded environment, the unit of resource ownership and
scheduling/execution is thread.
Ans: False
In a multithreaded environment, the unit of resource ownership is
process, the unit of scheduling/execution is thread.
d. If one thread in a process is blocked, this prevents other threads in the
process even if that other thread is in a ready state.
Ans: False
Depends on whether OS is involved when the thread is blocked. If
OS is involved, then answer is “yes”.
e. Round-robin scheduling never results in more context switches than FCFS.
Ans: False
It depends on the quantum. If every job has an execution time less
than the quantum, then it has the same number as FCFS.
2. (15) What are the 4 hardware components of a computer system? Explain briefly
each of these components.
Ans:
Processor (CPU):
Control the operation of the computer and its data processing functions.
Main Memory
Stores data and programs
RAM - random access memory
I/O Modules
Auxiliary storage like disk drives, tape drives
Printers, terminals, monitors
System Bus
Provides for transfer of data among processors, main memory, and I/O
modules
3. (10) What are the difference between interrupts and exceptions? Give two examples of
each.
Ans:
Interrupts are asynchronous events external the CPU (e.g., timer interrupt, device
interrupt).
Exceptions are synchronous events that occur as the result of executing
instructions (e.g., divide by zero, system call).
4. (15) Explain what will be output for the following program?
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
int value = 5;
int main()
{
pid_t pid;
pid=fork();
if(pid==0){
printf("I am the child process. \n");
value+=15;
}
else if (pid > 0) {
wait (NULL);
printf("I am the parent process, value=%d ", value);
exit(0);
}
}
Ans:
I am the child process.
I am the parent process, value=5
5. (30) Consider the following set of processes, with the length of the CPU burst
given in milliseconds:
Process
Burst Times Priority
P1
10
3
P2
1
1
P3
2
3
P4
1
4
P5
5
2
The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at
time 0.
a. (10) Draw four Gantt charts that illustrate the execution of these processes
using the following scheduling algorithms: FCFS, SJF, nonpreemptive
priority (a small priority number implies a higher priority), and
RR(quantum=1).
b. (8) What is the turnaround time of each process for each of the scheduling
algorithms in part a?
c. (8) What is the waiting time of each process for each of the scheduling
algorithms in part a?
d. (4) Which of the algorithms in part a results in the minimum average
waiting time (over all processes)?
Ans:
a. The four Gantt charts are
FCFS:
0
1
2
3
4
5
6
7
8
9
10
P1
11
12
P2
13
P3
14
15
16
P4
17
18
19
17
18
19
17
18
P5
SJF:
0
1
P2
2
P4
3
4
5
6
P3
7
8
9
10
11
12
13
P5
14
15
16
15
16
P1
Priority:
0
1
2
3
P2
4
5
6
7
8
9
10
11
P5
12
13
14
P1
P3
19
P4
RR:
0
1
P1
2
P2
3
P3
4
P4
5
P5
6
P1
7
P3
8
P5
9
P1
10
P5
11
P1
12
P5
13
P1
14
P5
15
P1
16
P1
17
P1
18
P1
19
P1
b. Turnaround time:
FCFS
10
11
13
14
19
P1
P2
P3
P4
P5
RR
19
2
7
4
14
SJF
19
1
4
2
9
Priority
16
1
18
19
6
SJF
9
0
2
1
4
Priority
6
0
16
18
1
c. Waiting time (turnaround time minus burst time):
FCFS
0
10
11
13
14
P1
P2
P3
P4
P5
RR
9
1
5
3
9
d. Shortest Job First
6.
(15) Construct the schedule for the following set of jobs if multi-level feedback
queue is used. Assume we use 3 levels in the multi-level feedback queue and that
the time quantum is 1.5 time units.
Jobs
A
B
C
D
E
F
Ans:
Arrival Time
0
1
2
4
5
6
Service Time
4
2
5
3
4
5
0
1.5
A
Q0:
A: 4
Q1:
Q2:
12.5
D
B
3.0
C
Q0:
B: 2
Q1:
A: 2.5
Q2:
Q0:
C: 5
Q1:
A: 2.5
B: 0.5
Q2:
14.0
15.5
E
F
4.5
6.0
D
E
Q0:
D: 3
Q1:
A: 2.5
B: 0.5
C: 3.5
Q2:
Q0:
E: 4
F: 5
Q1:
A: 2.5
B: 0.5
C: 3.5
D: 1.5
Q2:
17.0
A
18.0
C
7.5
F
Q0:
F: 5
Q1:
A: 2.5
B: 0.5
C: 3.5
D: 1.5
E: 2.5
Q2:
20.0
E
9.0
10.5
A
B
11.0
12.5
C
Q0:
Q0:
Q0:
Q0:
Q1:
A: 2.5
B: 0.5
C: 3.5
D: 1.5
E: 2.5
F: 3.5
Q2:
Q1:
B: 0.5
C: 3.5
D: 1.5
E: 2.5
F: 3.5
Q2:
A: 1.0
Q1:
C: 3.5
D: 1.5
E: 2.5
F: 3.5
Q2:
A: 1.0
Q1:
D: 1.5
E: 2.5
F: 3.5
Q2:
A: 1.0
C: 2.0
21.0
23.0
F
Q0:
Q0:
Q0:
Q0:
Q0:
Q0:
Q0:
Q0:
Q1:
D: 1.5
E: 2.5
F: 3.5
Q2:
A: 1.0
C: 2.0
Q1:
E: 2.5
F: 3.5
Q2:
A: 1.0
C: 2.0
Q1:
F: 3.5
Q2:
A: 1.0
C: 2.0
E: 1.0
Q1:
Q1:
Q1:
Q1:
Q1:
Q2:
A: 1.0
C: 2.0
E: 1.0
F: 2.0
Q2:
C: 2.0
E: 1.0
F: 2.0
Q2:
E: 1.0
F: 2.0
Q2:
F: 2.0
Q2:
© Copyright 2026 Paperzz