Rts 3
Rts 3
1: The feasible interval of each job in the precedence graph in figure 4P-1 is given
next to its name. The execution time of all jobs are equal to 1.
a) Find the effective release times and deadlines of the jobs in the precendence graph in
Figure 4P-1.
Sol:
Sol:
1|Page
c) A job is said to be at level i if the length of the longest path from the job to jobs that have
no successors is i. So, jobs J3, J6 and J9 are at level 0, jobs J2, J5 and J8 are at level 1, and
so on. Suppose that the priorities of the jobs are assigned based on their levels, the heigher
the level, the higher the priority. Find a priority-drive schedule of the jobs in Figure 4P-1
according to this priority assignment.
Sol:
Explanation:
J1 is the only job released at t=0, so it goes first.
At t=1, J2, J4, and J7 have been released. J4 has a level of 3, so it goes first.
At t=2, J4is done. J7 has the next highest level (2), so it goes next.
At t=3, J7 is done. J3, J5, J8, and J9 are released. J5 has the next highest level (2),
so it runs.
At t=4, J5 is done. Either J2 or J8 could run because both have a level of 1 and both
have had their precedence contraints met. At this point J2 has already missed its
deadline...
At t=5, either J2 or J8, whichever was run at t=4, is done. The one that was not
previously run gets to run. There are no more level 1 jobs.
At t=6, J3, J6, and J9 are all eligible to run and are all at level 0. They can run in
any order occording to this scheduling algorithm.
J2 and J3 miss their deadlines. This is not an optimal scheduling algorithm.
4.2) ans
2|Page
Q.4.4: Consider a system that has five periodic tasks, A, B, C, D, and E, and three
processors P1, P2, P3. The periods of A, B, and C are 2 and their execution times are
equal to 1. The periods of D and E are 8 and their execution times are 6. The phase of
every task is 0, that is, the first job of the task is released at time 0. The relative
deadline of every task is equal to its period.
a) Show that if the tasks are scheduled dynamically on three processors according to
the LST algorithm, some jobs in the system cannot meet their deadlines.
Sol:
At t=0, A, B, and C have 1 time unit of slack. D and E each have a slack of 2, so A,
B, and C run first.
At t=1, A, B, and C are done running and the slack of D and E is 1, so D and E both
get to run.
At t=2, A, B, and C are released again. Their slack is 1, as are the slacks of D and
E. Assuming that once a job starts running on a processor, it cannot change
processors, D and E will run round-robin on two processors with two of A, B, and C
with the third running alone.
By time t=4, A, B, and C will have completed, and D and E will have completed one
time unit of work.
At t=4, new jobs in A, B, and C are released with a slack of 1, but D and E have 0
slack. D and E run on two processors and A, B, and C run round-robin on the
third.
At t=5.5 the A, B, and C's slack has fallen to 0. At that point all 5 tasks have a
slack of 0 (i.e., they require the processor time from now until their deadline),
but there are five jobs and only three processors. At least one job will finish past
its deadline.
If jobs are allowed to change processors once they start, things are a bit more
complicated. The five jobs run round-robin on three processors.
At t=1.6667, A, B, and C finish. D and E continue to run until t=2. Every 2 time
units D and E only execute for 1.3333 time units, so at t=6 they have not
completed.
Sol:
3|Page
Q.4.5: A system contains nine non-preemptable jobs named Ji, for i = 1, 2, ..., 9. Their
execution times are 3, 2, 2, 2, 2, 4, 4, 4, 4, and 9, respectively, their release times are equal
to 0, and their deadlines are 12. J1 is the immediate predecessor of J9, and J4 is the
immediate predecessor of J5, J6, J7, and J8. There are no other precedence constraints. For all
the jobs, Ji has a higher priority than Jk if i < k.
Sol:
b) Can the jobs meet their deadlines if they are scheduled on three processors? Explain your
answer.
c) Can the jobs meet their deadlines if we make them preemptable and schedule them
preemptively? Explain your answer.
4|Page
d) Can the jobs meet their deadlines if they are scheduled nonpreemptively on four
processors? Explain your answer.
e) Suppose that due to an improvement of the three processors, the execution time of every
job is reduced by 1. Can the jobs meet their deadlines? Explain your answer.
Q.4.7:
Sol: Jobs with their effective release time and deadline are:
J1 (2,8) J2 (0,7) J3 (2,8) J4 (4,9) J5 (2,8) J6 (4,20) J7 (6,21)
5|Page