Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

Instructor Luong Duy Hieu – Contact: hieuld2@fpt.edu.

vn

REVIEW No1
Part 1: INTRODUCTION
PROBLEMS
1. What are the two main functions of an operating system?
-Manages the input devices, output devices, and storage devices.
-Manages the files stored on the computer.

2. What is multiprogramming?
Multiprogramming is a rudimentary form of parallel processing in which several
programs are run at the same time on a uniprocessor. Since there is only one
processor, there can be no true simultaneous execution of different programs. Instead,
the operating system executes part of one program, then part of another, and so on. To
the user it appears that all programs are executing at the same time.

3. Why was timesharing not widespread on second-generation computers?


Because second generation computers lacked the hardware necessary to protect
operating systems from malicious user programs. On early computers, every byte of
data read or written was handled by the CPU (i.e., there was no DMA).

Part 2: PROCESSES AND THREADS


PROBLEMS
Q1.1 Which of the following scheduling algorithms could result in starvation? For those
algorithms that could result in starvation, describe a situation in which starvation is likely
to occur ?

1. First-Come First-Served (FCFS)


2. Shortest Job First (SJF) (Non-preemptive)
3. Shortest Remaining Time First (SRTF) (Preemptive)
4. Round Robin (RR)
5. Priority

a ) First come first serve does not cause starvation . Every process submitted will
execute eventually .
b ) Shortest job first could cause starvation . Priority is always given to the shortest job
meaning that a job in queue which is long could constantly be starved by arrival of
jobs which are shorter than that job.
c ) Round robin could not cause starvation . This is because each process gets equal
time slices equally often .
d ) Priority could cause starvation . The job with the lowest priority could be starved
indefinitely by arrival of jobs which have higher priorities .

04.02e-BM/DH/HDCV/FU 1/2 1/2


Q1.2 Consider the set of process (smaller priority number implies higher priority; i.e. 1 –
highest priority):

Process ID Arrival Time Burst Time Priority

Draw the P1 0 70 3 GANTT chart for


the following P2 10 50 2 scheduling
algorithms. P3 30 20 1
 First- P4 50 20 4 Come First-
Served (FCFS)
 Shortest Job First (SJF) (Non-preemptive)
 Shortest Remaining Time First (SRTF) (Preemptive)
 Round Robin (RR) (Time Quantum = 10, Round from P1 to PN if PN arrives)
 Priority (Non-preemptive)

Q1.3 For the processes listed above, complete the following table:

Scheduling Algorithm Average waiting time Average turnaround time


First Come First Served (FCFS) 28 ms
Shortest Job First (SJF) (Non-
preemptive)
Shortest Job First (SJF) (preemptive) 13 ms
Round Robin (RR) (Time Quantum = 23ms
10)
Priority (Non-preemptive)

04.02e-BM/DH/HDCV/FU 1/2 2/2

You might also like