You are on page 1of 4

ID: 2016HT12059

Name: Gaurang Prajapati

Real Time Operating Systems (CS ZG524)


Assignment – 1
List the pros and cons of the various Real Time scheduling algorithms you have learned. (Material covered in
Contact Session 1 - 9)
Then for the taskset
T1(15,1)
T2(20,2)
T3(22,3)

choose one of the scheduling algorithms, explaining why you have chosen it.
Also state, with reason, one algorithm you would not choose for the given taskset.
Using your algorithm of choice, work out the expected schedule.

Solution:
Real time scheduling algorithms can be divided in to two categories: Static and dynamic.
Static algorithms assign priorities at design time. All assigned priorities remain constant for
the lifetime of a task.
Dynamic algorithm assign priorities at runtime, based on execution parameters of tasks.
Dynamic scheduling can be either with dynamic priority of static priority.

• Dynamic priority
o Earliest Deadline First
o Least Slack Time First
• Static priority
o Rate Monotonic
o Deadline Monotonic
Pros & Cons of Various Algorithms

Static Algorithms.
Pros
• Within the cycle, it is possible to construct a static schedule i.e. a time table
• Deterministic: predictable
• Simple to implement
• Work well with fixed periodic tasks

Cons
• low processor utilization and poor handling of aperiodic and soft-deadline tasks
• Inflexible. i.e. difficult to add another task and difficult to handle external events.
• It uses huge memory and difficult to construct time table.
• Do not handle aperiodic tasks well
ID: 2016HT12059
Name: Gaurang Prajapati

EDF-Earliest Deadline First.


Pros
• EDF is an optimal uniprocessor scheduling algorithm. That is, if EDF cannot feasibly
schedule a task set on a uniprocessor, there is no other scheduling algorithm that can.
• Any valid schedule for any task set can be transformed into a valid EDF schedule.
• Optimal when used to schedule jobs on processor as long as preemption is allowed and
jobs do not contend for resources.

Cons
• Not optimal when jobs have arbitrary release time, execution times, and deadlines.
• Not optimal for scheduling preemptable jobs on more than one processor

LST- Least Slack Time First


(MLF-Minimum Laxity First/LLF-Least Laxity First)
Pros
• This algorithm assigns priorities to jobs based on their slacks, the smaller the slack, the
higher the priority.
• The algorithm gives the highest priority to the active job with the smallest laxity. Then
the job with the highest priority is executed.
• The least laxity first algorithm is an optimal scheduling algorithm for systems with
periodic real-time tasks
• Optimal for scheduling preemptive jobs on one processor

Cons
• A problem arises with this scheme when two processes have similar laxities. One
process will run for a short while and then get preempted by the other and vice versa.
• Not optimal when jobs have arbitrary release time, execution times, and deadlines.
• Not optimal for scheduling preemptable jobs on more than one processor

RM-Rate Monotonic
Pros
• It is a uniprocessor static-priority preemptive scheme
• Simple to understand.
• Easy to implement
• Stable: though some of the lower priority tasks fail to meet deadlines, others may meet
deadlines.
Cons
• Task priorities are defined by their periods. Sometimes, we must change the task
priorities to ensure that all critical tasks get completed.
• We must have some minimum arrival time between the release times of successive
iterations of sporadic tasks. Otherwise, sporadic tasks can add unlimited amount of
workload to the system and it will be impossible to guarantee that deadlines are met.
• When relative deadline of a task is not equal to its period, RM algorithm is no longer an
optimum static-priority scheduling algorithm.
ID: 2016HT12059
Name: Gaurang Prajapati

DM-Deadline Monotonic
Pros
• For the periodic real-time tasks, Deadline Monotonic Algorithm is more proficient than RM
• DM is more proficient than RMA in the sense that it can sometimes produce a feasible
schedule when RM fails.
Cons
• extra periodic server process is required for each sporadic process
• Lack of adequate schedulability tests

Algorithm selected for scheduling given task are Rate Monotonic

Given Tasks are

T1(15,1)
T2(20,2)
T3(22,3)
For Task T1: P1=15, e1=1

For Task T2: P2=20, e2=2

For Task T3: P3=22, e3=3

Sum of the utilization due to task are


𝑒𝑖 1 2 3
∑3𝑖=1 = + +
𝑃𝑖 15 20 22

=0.066 + 0.1 + 0.136

=0.302

Here, ∑ 𝑢𝑖 ≤ 1 as

0.302 < 1

Check Liu and Layland band


1
∑ 𝑢𝑖 ≤ 𝑛(2𝑛 − 1) where n is the number of tasks
1
Here 3 (23 − 1) = 3(1.259 − 1) = 0.778

So, ∑ 𝑢𝑖 ≤ 0.778

• Therefore, the task set is schedulable. The upper bound on utilization converges 69% for infinite
task as number of task approaches infinity. If a set of task passes liu and layland test, then it is
RMA schedulable. But if task set fails liu and layland test still it may be RMA schedulable.

✓ This algorithm was chosen because the priority of all the task are known priory. RM approaches
by choosing the shortest period process to mark as the highest priority. Priority is inversely
proportional to period. So here priority is fixed by the task set given by using the period and
ID: 2016HT12059
Name: Gaurang Prajapati

scheduled RM algorithm to run it. Here EDF did not selected to avoid overhead of scheduling of
EDF which is does during dynamic priority assignment. Here we could have priority according to
algorithm but when scheduling is done at lower cost in terms of processing why to choose
expensive algorithm. And in case of EDF it can fail some time but RM will work. Problem with EDF
algorithm is overrun or un predictability during overload, like high priority jobs can miss deadline
while low priority executes.

Scheduling Diagrams.

At 45, T1 is released and is higher priority. So T3 will be preempted. Total 5 preemption occurred in the
hyper period of 660.

You might also like