View
1
Download
0
Category
Preview:
Citation preview
Kingdom of Saudi ArabiaMinistry of Higher Education
Salman Bin Abdul-Aziz UniversityCollege of Computer
Engineering and sciences
المملكة العربية السعوديةوزارة التعليم العالي
جامعة سلمان بن عبد العزيزكلية هندسة وعلوم الحاسب
Course Title: CS3700-Operating System CS3700On class Quiz
2Answer key
الطالب :اسمInstructor Name: Dr. Mohamed Osman الجامعي :الرقمDate: 26-10-2014, Time: 10 minutes :الشعبة
Using round robin RR algorithm with quantum 2 calculate:1- the turnaround time for each process2- the waiting time for each process3- the average waiting time
Process arri Burst Time Arrive time P1 5 0 P2 12 4 P3 3 8
R1
R4
R3
R5
R2
R6
P1
P2
P3
Kingdom of Saudi ArabiaMinistry of Higher Education
Salman Bin Abdul-Aziz UniversityCollege of Computer
Engineering and sciences
المملكة العربية السعوديةوزارة التعليم العالي
جامعة سلمان بن عبد العزيزكلية هندسة وعلوم الحاسب
Course Title: CS3700-Operating System CS3700On class Quiz
3
الطالب :اسمInstructor Name: Dr. Mohamed Osman الجامعي :الرقمDate: 09-11-2014, Time: 10 minutes :الشعبة
Having the following sets:
P: P1, P2, P3
R: R1, R2, R3, R4, R5, R6, E: P 1→ R1 , P 1→ R5 , P 2→ R 2 ,P 2→ R 3 , P 3→ R 4 , P3 → R 6
R 1→ P 2, R 2→ P 3 , R 4→ P 2 ,R 3 → P 1 ,R 5→ P 3 , R 6→ P 1
a) Draw the resource allocation graph of the previous system?
b) Examine if the system deadlocked or not and list all the cycles?
The system is deadlocked because:1- all the processes are holding and waiting no process can run 2- There is cycles and all resources are one instant
The cycles are:
P1,P2, P3 ----- P1, P2 --- P1, P3 ---- P2, P3 ----- P2, P1------P3,P1,P2
Kingdom of Saudi ArabiaMinistry of Higher Education
Salman Bin Abdul-Aziz UniversityCollege of Computer
Engineering and sciences
المملكة العربية السعوديةوزارة التعليم العالي
جامعة سلمان بن عبد العزيزكلية هندسة وعلوم الحاسب
Course Title: CS3700-Operating System CS3700On class Quiz
4Answer Key
الطالب :اسمInstructor Name: Dr. Mohamed Osman الجامعي :الرقمDate: 18-11-2014, Time: 10 minutes :الشعبة
(1)Having the following graph answer the below questions:
(a) What are the processes in the graph?
P0, P1, P2, P3,P4
(b) What are the resource types in the graph and how many instances of each resource type are there?
R5,R7 : 2 instants, R6: 1 instant, R8: 3 instant
(c) Which resource type is being requested by processes P0, P1,P2, P3 and P4?
P0 requested R5, P1 requested R6 , P2 requested R7, P4 requested R8
(e) Which processes are waiting? Which processes are running?
P0, P1, and P2 are waiting; P4, and P3 are running.
(f) Are there any cycles in the graph? If yes, write them down.
Yes
The cycle P0,P4,P0 ----P0,P1,P2,P4,P0
(g) Is there a deadlock? If no, give the order in which processes will run and exit.No : P3, P2, P1,P0 ------ P4, P2, P1,P0(e) Is the system in safe state? (explain)System is in safe state because there exists a sequence <P3, P2, p1, Po> and <P4, P2, p1, Po> which is mean the requested resource from each processes can be satisfied by currently available resources or can be satisfied by resources held by other process. (the requested can be applied immediately for P4 , and after waiting for P2,P1,P0)
(2)Conceder the following snapshot at time T0 Allocation Max Available NeedA B C A B C A B C
P 0 0 1 2 3 4 9 2 2 3 337 .
P 1 1 3 0 3 3 3 203 .
P 2 4 1 2 5 2 2 110 .
P 3 2 0 1 2 2 4 023 .
P4 0 0 2 4 5 6 454 .
Answer the following questions using the banker's algorithm:
a) What is the content of the matrix Need?
b) Is the system in a safe state? If yes write a sequence.
Yes P2,P1,P3,P4,P0 or P2, P3,P1,P4,P0
c) If a request from Process P0 arrives for (0, 2,3) can the request be granted immediately? Please explain your answer in detail.
Yes it can be granted immediately because the request is less than the available
But this will leads to unsafe state and deadlocked because the available after satisfied the request will became less than any needed (2, 0, 0) i.e. any additional requested cannot be satisfied.
First-fit algorithm
Memory
Best-fit algorithm
Memory
Worst-fit algorithm
Memory
Kingdom of Saudi ArabiaMinistry of Higher Education
Salman Bin Abdul-Aziz UniversityCollege of Computer
Engineering and sciences
المملكة العربية السعوديةوزارة التعليم العالي
جامعة سلمان بن عبد العزيزكلية هندسة وعلوم الحاسب
Course Title: CS3700-Operating System CS3700On class Quiz
5Answer
الطالب :اسمInstructor Name: Dr. Mohamed Osman الجامعي :الرقمDate: 25-11-2014, Time: 10 minutes :الشعبة
Fill the following memory scheme for each of the three contiguous memory allocation algorithms. Place the following processes (in order) (P1: (12 KB), P2: (24 KB), P3: (15 KB), P4: (32 KB)).
What the total size of internal and external fragmentation of each one of the above allocation algorithm after allocated the above processes? (Put your answer in the following table)
First-fitBest-fitWorst-fit
The total size of internal fragmentation341738
The total size of external fragmentation20015
Total fragmentation541753
Scheduling algorithmRound Robin(RR) & Priority
Dead lock avoidanceAvoidance algorithms
Contiguous memory allocation algorithmsTutorial1
Tutorial 2
Recommended