College of Computing and Informatics
Operating Systems
Assignment 1
Deadline: 04/10/2019 @ 23:59
[Total Mark for this Assignment is 6]
Student Details:
Name: Taher Alnemer ID: s170057274
CRN: 11131
Instructions:
This Assignment must be submitted on Blackboard (WORD format only) via the allocated
folder.
Email submission will not be accepted.
You are advised to make your work clear and well-presented, marks may be reduced for poor
presentation. This includes filling your information on the cover page.
You MUST show all your work, and text must not be converted into an image, unless specified
otherwise by the question.
Late submission will result in ZERO marks being awarded.
The work should be your own, copying from students or other resources will result in ZERO
marks.
Use Times New Roman font for all your answers.
Pg. 1 Question FourQuestion Four
Learning
Outcome(s): Question One 1.5 Marks
Consider a system consisting of four resources of the same type that are shared by
Instructors: three processes, each of which needs at most two resources. Show that the system
Describe the OS is deadlock-free.
mechanism for
R1
process P1
management, P2
timing, memory,
R2
I/O, file and
concurrency R3
management. P3
R4
P1 acquiring R2 then move to acquire R1
P3 acquiring R3 then move to acquire R2 whence P1 finish acquiring
P2 acquiring R4 then move to acquire R3 whence P3 finish acquiring
This is showing that each processes (P1, P2, P3) acquiring one of the 4
resources (R1, R2, R3, R4) then move to other resources which are
waiting for acquiring.
Pg. 2 Question FourQuestion Four
Learning 1.5 Marks
Outcome(s): Question Two
Instructors: Sometimes, segmentation and paging are joint into one scheme. Why, explain in
your words.
Describe the OS
mechanism for Because of each one of segmentation and paging improves the other.
process Also it is helpful for a large page table. In the same time a non-used
management, section of the page table can be put into single segment table with 0
timing, memory,
value.
I/O, file and
concurrency
management.
Pg. 3 Question FourQuestion Four
Learning 1.5 Marks
Outcome(s): Question Three
Assess the
Suppose there are 4 processes P1, P2, P3 and P4 getting to ready queue in
performance of the
various arrival times and with various bursts times as detailed in the table
programs through
below. Using Shortest-remaining-time-first scheduling approach, find
well designed
waiting time for each process and the average waiting time and provide
measurements detailed steps taken to find the answer. Using time quantum of
using OS timings milliseconds.
features. (2.3)
Arrival time Burst Time
Process
(ms) (ms)
P1 0 8
P2 2 3
P3 6 2
P4 9 7
P P
P2 P3 P1 P4
1 1
0 2 5 6 8 13 20
Waiting time for each process:
P1: 0 + (5-2) + (8-6) -0 = 5ms
P2: 2 – 2 = 0ms
P3: 6 – 6 = 0ms
P4: 13 – 9 = 4ms
Pg. 4 Question FourQuestion Four
Average waiting time:
P1 + P2 + P3 + P4 / 4 =
5 + 0 + 0 + 4 / 4 = 2.25ms
Pg. 5 Question FourQuestion Four
Learning 1.5 Marks
Outcome(s): Question Four
Instructors: Explain Peterson’s solution for critical-section problem and show that mutual
Describe the OS exclusion is preserved with Peterson’s solution. (Assume there are only two
mechanism for processes P0 and P1)
process
management,
timing, memory, Peterson’s solution has 2 processes and 2 variables. The variable
I/O, file and "turn" indicates whose turn to enter the critical-section and "flag" to
indicate if process is ready to enter the critical-section.
concurrency
management
Process P0
do {
flag [0] = true;
turn = 1;
while (flag[1] == true && turn== 1)
critical section
flag[0] = false;
remainder section
} while (true);
Pg. 6 Question FourQuestion Four
Process P1
do {
flag [1] = true;
turn = 0;
while (flag[0] == true && turn== 0)
critical section
flag[0] = false;
remainder section
} while (true);
So mutual exclusion is preserved