Q2
Q2
Q2
Quiz 2
Submission Date : 25/11/2022
Due Date : 02/12/2022 23:59
TA : Necva BÖLÜCÜ
Click here to accept your Quiz 2
1. Explain the difference between a preemptive scheduler and a non-preemptive scheduler,
and and give an example of a system in which both could be used.
2. Describe the differences between long-term and short-term scheduling of processes.
3. Draw Gantt charts for scheduling algorithms for the processes specified in Table 1 and
calculate the average turnaround and job waiting time.
(a) How many resources are there in the type of R1, R2, R3 and R4?
Quiz 2 1
Fall 2022
CEN 301: Operating Systems
(b) Calculate the need matrix for the given max and allocation matrices in Table 2.
(c) Find out if the system is in the safe state? If so, find the safe sequence.
5. A system consists of 5 processes {P 1, P 2, P 3, P 4, P 5} and 6 types of resources {R1, R2, R3, R4, R5, R6}.
The number of units of resources is 2 for each resource. There are some resource in-
stances that are already allocated to processes, as follows:
• 1 instance of R1 held by P 1, another held by P 2
• 1 instance of R2 held by P 3
• 1 instance of R3 held by P 3, another held by P 4
• 1 instance of R4 held by P 3
• 1 instance of R5 held by P 3, another held by P 4
• 2 instances of R6 held by P 5
Some processes have requested additional resources, as follows:
• P 1 wants 1 instance of R4
• P 2 wants 1 instance of R1 and 1 instance of R2
• P 3 wants 1 instance of R1
• P 4 wants 1 instance of R6
• P 5 wants 1 instance of R3
(a) Draw the resource allocation graph for this system.
(b) What is the state (runnable, waiting) of each process?
(c) Is this system deadlocked? If not, explain in which order the processes are running.
Important Notes
• Do not miss the submission deadline.
• Save all your work until the quiz is graded.
• All work on quizzes must be done individually unless stated otherwise. You are en-
couraged to discuss with your classmates about the given quizzes, but these discussions
should be carried out in an abstract way. That is, discussions related to a particular
solution to a specific problem (either in actual code or in the pseudocode) will not be
tolerated. In short, turning in someone else’s work, in whole or in part, as your own will
be considered as a violation of academic integrity. Please note that the former condition
also holds for the material found on the web as everything on the web has been written
by someone else.
• You may assume that the input files will be given as:
– quiz2.pdf
Quiz 2 2