0% found this document useful (0 votes)
41 views24 pages

LQ 6-3

The document discusses Round Robin scheduling and provides an example. It asks the reader to fill in a table showing how tasks would be scheduled using Round Robin scheduling with a time quantum of 5 time units. The tasks are: Task 1 with a burst time of 10 time units Task 2 with a burst time of 1 time unit Task 3 with a burst time of 2 time units Task 4 with a burst time of 1 time unit Task 5 with a burst time of 5 time units All tasks arrive at time 0. The table is filled in showing each task being allocated the processor for 5 time units, in round robin fashion, until all tasks complete execution.

Uploaded by

abdullah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views24 pages

LQ 6-3

The document discusses Round Robin scheduling and provides an example. It asks the reader to fill in a table showing how tasks would be scheduled using Round Robin scheduling with a time quantum of 5 time units. The tasks are: Task 1 with a burst time of 10 time units Task 2 with a burst time of 1 time unit Task 3 with a burst time of 2 time units Task 4 with a burst time of 1 time unit Task 5 with a burst time of 5 time units All tasks arrive at time 0. The table is filled in showing each task being allocated the processor for 5 time units, in round robin fashion, until all tasks complete execution.

Uploaded by

abdullah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Question 1

Watch this video about Earliest Deadline First (EDF) scheduling:

Given the following tasks

Task Execution time e Period Deadline

T1 1 ms 5 ms 4 ms

T2 2 ms 10 ms 8 ms

T3 3 ms 15 ms 13 ms

Fill in the table to show how the tasks are scheduled according to the preemptive EDF.

Time Slot Task running on processor

0-1 T1 

1-2 T2 

2-3 T2 

3-4 T3 

4-5 T3 

5-6 T1 

6-7 T3 

7-8 None 

8-9 None 

9-10 None 

10-11 T1 

11-12 T2 

12-13 T2 

13-14 None 

14-15 None 

15-16 T1 
16-17 T3 

17-18 T3 

18-19 T3 

19-20 None 

20-21 T1 

21-22 T2 

22-23 T2 

23-24 None 

24-25 None 

25-26 T1 

26-27 None 

27-28 None 

28-29 None 

29-30 None 

Watch this video about Earliest Deadline First (EDF) scheduling:

Given the following tasks

Task Execution time e Period Deadline

T1 1 ms 5 ms 4 ms

T2 2 ms 10 ms 8 ms

T3 3 ms 15 ms 13 ms

Fill in the table to show how the tasks are scheduled according to the preemptive EDF.

Time Slot Task running on processor


0-1 [T1]
1-2 [T2]
2-3 [T2]
3-4 [T3]
4-5 [T3]
5-6 [T1]
6-7 [T3]
7-8 [None]
8-9 [None]
9-10 [None]
10-11 [T1]
11-12 [T2]
12-13 [T2]
13-14 [None]
14-15 [None]
15-16 [T1]
16-17 [T3]
17-18 [T3]
18-19 [T3]
19-20 [None]
20-21 [T1]
21-22 [T2]
22-23 [T2]
23-24 [None]
24-25 [None]
25-26 [T1]
26-27 [None]
27-28 [None]
28-29 [None]
29-30 [None]
Question 2

Given the following precedence graph:

Here:
–Task 1 must execute before 2 and 3
–Task 2 must execute before 4 and 5
–Task 3 must execute before 6

Assume that the execution time for each task is one time unit. The deadlines are given in the graph. For example the
deadline for executing Task 2 is 5.

Is there a feasible EDF schedule?

Select one:
True

False 

No.

According to EDF, we would start with task 1 followed by task 4.


But task 4 cannot be executed before task 2.
Question 3

Latest Deadline First (LDF) is optimal with precedence in the sense that it minimizes the maximum lateness.

LDF does not support arrival of tasks.

LDF constructs the schedule backwards, choosing first the last task to execute.

The last task to execute is the one on which no other task depends that has the latest deadline.

The algorithm proceeds to construct the schedule backwards, each time choosing from among the tasks whose
dependents have already been scheduled the one with the latest deadline.

Given the precedence graph:

From right to left we first schedule T6  then T5  then T3  then T4  then

T2  then T1  .

The correct schedule is:

Latest Deadline First (LDF) is optimal with precedence in the sense that it minimizes the maximum lateness.

LDF does not support arrival of tasks.


LDF constructs the schedule backwards, choosing first the last task to execute.

The last task to execute is the one on which no other task depends that has the latest deadline.

The algorithm proceeds to construct the schedule backwards, each time choosing from among the tasks whose
dependents have already been scheduled the one with the latest deadline.

Given the precedence graph:

From right to left we first schedule [T6] then [T5] then [T3] then [T4] then [T2] then [T1].
Question 4

EDF* is a Earliest-Deadline-First algorithm that works on dependent tasks and supports arrival of new tasks.

LDF* first adjusts the deadlines of all tasks according to the following formula:

di: original deadline of Task i


di': new deadline of Task i
ei: execution time of Task i

D(i) refers to the set of all tasks that immediately depend on Task i in the precedence graph.

For example: D(1)= {2, 3}, D(4)=ø

Given the precedence graph (execution time of each task is 1):

The new deadlines of all task are:


d1'= 1 

d2'= 2 

d3'= 4 

d4'= 3 

d5'= 5 
d6'= 6 

Now we can apply the EDF by scheduling the tasks according to their earliest deadlines.

The schedule will be from left to right T1  then T2  then T4  then T3  then

T5  then T6  .

Calculating the adjusted deadlines:

The correct schedule is:

The correct answer is:


EDF* is a Earliest-Deadline-First algorithm that works on dependent tasks and supports arrival of new tasks.

LDF* first adjusts the deadlines of all tasks according to the following formula:

di: original deadline of Task i


di': new deadline of Task i
ei: execution time of Task i

D(i) refers to the set of all tasks that immediately depend on Task i in the precedence graph.

For example: D(1)= {2, 3}, D(4)=ø

Given the precedence graph (execution time of each task is 1):

The new deadlines of all task are:


d1'=[1]
d2'=[2]
d3'=[4]
d4'=[3]
d5'=[5]
d6'=[6]
Now we can apply the EDF by scheduling the tasks according to their earliest deadlines.
The schedule will be from left to right [T1] then [T2] then [T4] then [T3] then [T5] then [T6].
Question 5

Priority Scheduling

A priority is associated with each process, and the CPU is allocated to the process with the highest priority.
Equal-priority processes are scheduled in a FCFS manner
Priorities are generally indicated by some fixed range of numbers, such as 0 to 7 or 0 to 4096.
However there is no general agreement on whether 0 is the highest or the lowest priority.
Here we assume that low numbers represent high priority.

Given the table and assuming that all the processes arrived at time point 0. Fill in the table to show how the tasks are
scheduled according to Priority Scheduling.

Task Priority Execution time e

T1 3 10 ms

T2 1 1 ms

T3 4 2 ms

T4 5 1 ms

T5 2 5 ms

Time Slot Task running on processor

0-1 T2 

1-2 T5 

2-3 T5 

3-4 T5 

4-5 T5 

5-6 T5 

6-7 T1 

7-8 T1 

8-9 T1 

9-10 T1 

10-11 T1 

11-12 T1 

12-13 T1 

13-14 T1 

14-15 T1 
15-16 T1 

16-17 T3 

17-18 T3 

18-19 T4 

The correct schedule is:

Priority Scheduling
A priority is associated with each process, and the CPU is allocated to the process with the highest priority.
Equal-priority processes are scheduled in a FCFS manner
Priorities are generally indicated by some fixed range of numbers, such as 0 to 7 or 0 to 4096.
However there is no general agreement on whether 0 is the highest or the lowest priority.
Here we assume that low numbers represent high priority.

Given the table and assuming that all the processes arrived at time point 0. Fill in the table to show how the tasks are
scheduled according to Priority Scheduling.

Task Priority Execution time e

T1 3 10 ms

T2 1 1 ms

T3 4 2 ms

T4 5 1 ms

T5 2 5 ms

Time Slot Task running on processor


0-1 [T2]
1-2 [T5]
2-3 [T5]
3-4 [T5]
4-5 [T5]
5-6 [T5]
6-7 [T1]
7-8 [T1]
8-9 [T1]
9-10 [T1]
10-11 [T1]
11-12 [T1]
12-13 [T1]
13-14 [T1]
14-15 [T1]
15-16 [T1]
16-17 [T3]
17-18 [T3]
18-19 [T4]
Question 6

Watch these two videos about Round Robin Scheduling:

Given the following tasks

Task Arrival Time Execution time e

T1 0 ms 3 ms

T2 2 ms 2 ms

T3 4 ms 6 ms

T4 5 ms 4 ms

T5 6 ms 5 ms

Fill in the table to show how the tasks are scheduled according to RR with a time quantum of 2 ms.

Time Slot Task running on processor

0-1 T1 

1-2 T1 

2-3 T2 

3-4 T2 

4-5 T1 

5-6 T3 

6-7 T3 

7-8 T4 
8-9 T4 

9-10 T5 

10-11 T5 

11-12 T3 

12-13 T3 

13-14 T4 

14-15 T4 

15-16 T5 

16-17 T5 

17-18 T3 

18-19 T3 

19-20 T5 

Check the feedback it has a link to a file with detailed solution.

The correct schedule is:

Watch these two videos about Round Robin Scheduling:

Given the following tasks


4/4/2021 LQ 6-3: Attempt review

Task Arrival Time Execution time e

T1 0 ms 3 ms

T2 2 ms 2 ms

T3 4 ms 6 ms

T4 5 ms 4 ms

T5 6 ms 5 ms

Fill in the table to show how the tasks are scheduled according to RR with a time quantum of 2 ms.

Time Slot Task running on processor


0-1 [T1]
1-2 [T1]
2-3 [T2]
3-4 [T2]
4-5 [T1]
5-6 [T3]
6-7 [T3]
7-8 [T4]
8-9 [T4]
9-10 [T5]
10-11 [T5]
11-12 [T3]
12-13 [T3]
13-14 [T4]
14-15 [T4]
15-16 [T5]
16-17 [T5]
17-18 [T3]
18-19 [T3]
19-20 [T5]
Check the feedback it has a link to a file with detailed solution.
Question 7

What is Multilevel Queue Scheduling (MLQ)?

It partitions the ready queue into several separate queues.

A process is assigned permanently to one queue based on some properties of the process such as memory size, process
priority, or process type

Each queue has its scheduling algorithm.


Foreground queue (interactive processes) might be scheduled by RR
Background queue (batch processes) might be scheduled by FCFS

There must be scheduling between queues:

Commonly, fixed-priority preemptive scheduling


Time-based (foreground queue gets 80% of CPU time, background queue gets 20%)

What is Multilevel Feedback Queue Scheduling (MLFQ)?


Similar to MLQ but it allows processes to move between queues, which is useful in some cases:
A process that uses too much CPU time, will be moved to a lower-priority queue.
A process waiting too long may be moved to a higher-priority queue.

MLFQ leaves I/O-bound and interactive processes in the higher-priority queues.


Example: three queues 0, 1, and 2:
The scheduler first executes all the processes in queue 0
Only when queue 0 is empty it executes processes in queue 1
Similarly, queue 2 processes are only executed when queue 1 and queue 0 are empty
A process that arrives for queue 1 will preempt a process in queue 2.
A process in queue 1 will in turn be preempted by processes arriving for queue 0.
A process in queue 0 is given a time quantum of 8 ms. If it doesn't finish within this time it is moved to the tail of queue
1.
If queue 0 is empty, the process at the head of queue 1 is given a quantum of 16 ms. If it doesn't complete it is
preempted and put into queue 2.
Processes in queue 2 are run on an FCFS basis but are run only when queues 0 and 1 are empty
The scheduling algorithm gives the highest priority to any process with a CPU burst of 8 ms or less. Such a process will
quickly get the CPU, finish its CPU burst and go off to its next I/O burst.
Processes that need more than 8 ms but less than 24 ms are also served quickly but with lower priority
Long processes are served in FCFS manner with any CPU cycles leftover from queues 0 and 1
But very complex: No. of queues, scheduling for each queue, process movement between queues.

Given three queues:


1. First queue: quantum = 10

2. Second queue: quantum = 20

3. Third queue: FCFS

And four processes

Task Arrival Time Execution time e

P1 0 ms 12 ms

P2 8 ms 25 ms
P3 21 ms 33 ms

P4 30 ms 2 ms

Fill in the table to show how the tasks are scheduled according to MFQS.

Read the feedback: it has an embedded file with the solution.

Time Slot Task running on processor

0-1 P1 

1-2 P1 

2-3 P1 

3-4 P1 

4-5 P1 

5-6 P1 

6-7 P1 

7-8 P1 

8-9 P1 

9-10 P1 

10-11 P2 

11-12 P2 

12-13 P2 

13-14 P2 

14-15 P2 

15-16 P2 

16-17 P2 

17-18 P2 

18-19 P2 

19-20 P2 

20-21 P1 

21-22 P3 

22-23 P3 

23-24 P3 

24-25 P3 

25-26 P3 

26-27 P3 

27-28 P3 
28-29 P3 

29-30 P3 

30-31 P3 

31-32 P4 

32-33 P4 

33-34 P1 

34-35 P2 

35-36 P2 

36-37 P2 

37-38 P2 

38-39 P2 

39-40 P2 

40-41 P2 

41-42 P2 

42-43 P2 

43-44 P2 

44-45 P2 

45-46 P2 

46-47 P2 

47-48 P2 

48-49 P2 

49-50 P3 

50-51 P3 

51-52 P3 

52-53 P3 

53-54 P3 

54-55 P3 

55-56 P3 

56-57 P3 

57-58 P3 

58-59 P3 

59-60 P3 

60-61 P3 
61-62 P3 

62-63 P3 

63-64 P3 

64-65 P3 

65-66 P3 

66-67 P3 

67-68 P3 

68-69 P3 

69-70 P3 

70-71 P3 

71-72 P3 

The correct schedule is:

What is Multilevel Queue Scheduling (MLQ)?


It partitions the ready queue into several separate queues.
A process is assigned permanently to one queue based on some properties of the process such as memory size, process
priority, or process type
Each queue has its scheduling algorithm.
Foreground queue (interactive processes) might be scheduled by RR
Background queue (batch processes) might be scheduled by FCFS

There must be scheduling between queues:


Commonly, fixed-priority preemptive scheduling
Time-based (foreground queue gets 80% of CPU time, background queue gets 20%)

What is Multilevel Feedback Queue Scheduling (MLFQ)?


Similar to MLQ but it allows processes to move between queues, which is useful in some cases:
A process that uses too much CPU time, will be moved to a lower-priority queue.
A process waiting too long may be moved to a higher-priority queue.

MLFQ leaves I/O-bound and interactive processes in the higher-priority queues.


Example: three queues 0, 1, and 2:
The scheduler first executes all the processes in queue 0
Only when queue 0 is empty it executes processes in queue 1
Similarly, queue 2 processes are only executed when queue 1 and queue 0 are empty
A process that arrives for queue 1 will preempt a process in queue 2.
A process in queue 1 will in turn be preempted by processes arriving for queue 0.
A process in queue 0 is given a time quantum of 8 ms. If it doesn't finish within this time it is moved to the tail of queue
1.
If queue 0 is empty, the process at the head of queue 1 is given a quantum of 16 ms. If it doesn't complete it is
preempted and put into queue 2.
Processes in queue 2 are run on an FCFS basis but are run only when queues 0 and 1 are empty
The scheduling algorithm gives the highest priority to any process with a CPU burst of 8 ms or less. Such a process will
quickly get the CPU, finish its CPU burst and go off to its next I/O burst.
Processes that need more than 8 ms but less than 24 ms are also served quickly but with lower priority
Long processes are served in FCFS manner with any CPU cycles leftover from queues 0 and 1
But very complex: No. of queues, scheduling for each queue, process movement between queues.

Given three queues:


1. First queue: quantum = 10
2. Second queue: quantum = 20
3. Third queue: FCFS

And four processes

Task Arrival Time Execution time e

P1 0 ms 12 ms

P2 8 ms 25 ms

P3 21 ms 33 ms

P4 30 ms 2 ms

Fill in the table to show how the tasks are scheduled according to MFQS.
Read the feedback: it has an embedded file with the solution.
Time Slot Task running on processor
0-1 [P1]
1-2 [P1]
2-3 [P1]
3-4 [P1]
4-5 [P1]
5-6 [P1]
6-7 [P1]
7-8 [P1]
8-9 [P1]
9-10 [P1]
10-11 [P2]
11-12 [P2]
12-13 [P2]
13-14 [P2]
14-15 [P2]
15-16 [P2]
16-17 [P2]
17-18 [P2]
18-19 [P2]
19-20 [P2]
20-21 [P1]
21-22 [P3]
22-23 [P3]
23-24 [P3]
24-25 [P3]
25-26 [P3]
26-27 [P3]
27-28 [P3]
28-29 [P3]
29-30 [P3]
30-31 [P3]
31-32 [P4]
32-33 [P4]
33-34 [P1]
34-35 [P2]
35-36 [P2]
36-37 [P2]
37-38 [P2]
38-39 [P2]
39-40 [P2]
40-41 [P2]
41-42 [P2]
42-43 [P2]
43-44 [P2]
44-45 [P2]
45-46 [P2]
46-47 [P2]
47-48 [P2]
48-49 [P2]
49-50 [P3]
50-51 [P3]
51-52 [P3]
52-53 [P3]
53-54 [P3]
54-55 [P3]
55-56 [P3]
56-57 [P3]
57-58 [P3]
58-59 [P3]
59-60 [P3]
60-61 [P3]
61-62 [P3]
62-63 [P3]
63-64 [P3]
64-65 [P3]
65-66 [P3]
66-67 [P3]
67-68 [P3]
68-69 [P3]
69-70 [P3]
70-71 [P3]
71-72 [P3]

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy