0% found this document useful (0 votes)
17 views21 pages

Rtos Lec4

The document provides an overview of Real-Time Operating Systems (RTOS), detailing their functions, characteristics, and differences from General-Purpose Operating Systems (GPOS). It discusses key concepts such as task scheduling, memory management, and interrupt handling, emphasizing the importance of predictability and determinism in RTOS. Additionally, it covers various RTOS architectures and the significance of priority-based scheduling in managing real-time tasks.

Uploaded by

ashrawda
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)
17 views21 pages

Rtos Lec4

The document provides an overview of Real-Time Operating Systems (RTOS), detailing their functions, characteristics, and differences from General-Purpose Operating Systems (GPOS). It discusses key concepts such as task scheduling, memory management, and interrupt handling, emphasizing the importance of predictability and determinism in RTOS. Additionally, it covers various RTOS architectures and the significance of priority-based scheduling in managing real-time tasks.

Uploaded by

ashrawda
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/ 21

07/03/2025

Mansoura University
Faculty of Computers and Information Sciences
Department of Computer Science
Second Semester- 2024-2025

REAL TIME SYSTEMS


[RTS]

DR. MOHAMMED

LECTURE 4

Fundamentals of
Realtime Operating Systems [RTOS]

BY DR. MOHAMMED ALRAHMAWY

1
07/03/2025

INTRODUCTION
 An Operating System (OS) provides interface between computer and computer user.
It manages the use and implementation of applications software.
 OS is responsible for operating CPU, controlling I/O devices, handling the working
of application programs and managing and retrieving information.
 A Real Time Operating System (RTOS) is the type of operating system that is
designed to serve real time applications or embedded applications.
 RTOS provides solution for temporal as well as logical correctness of a program.
 In addition to the basic functions provided by general purpose operating systems,
RTOS provides mechanisms to allow real time scheduling of tasks.
 The important RTOS concepts are queues, inter-process communication, interrupt
management, software timers, semaphores, mutex, etc.
 RTOS can be either:
 Hard Real Time Operating Systems necessarily perform the task within the given specified
deadline. A formal guarantee of always meeting the hard deadline is required.
 Firm Real time: These type of RTOS also need to follow the deadlines. However, missing a
deadline may not have big impact but could cause undesired affects, like a huge reduction in
quality of a product.
3
 Soft Real Time Operating Systems are the RTOS that perform task almost in the specified
deadline. They do not guarantee a hard deadline. Task can be performed even after the time
has elapsed.

GPOS VS RTOS

General-Purpose Operating System (GPOS) Real-Time Operating System (RTOS)


It used for desktop PC and laptop. It is only applied to the embedded application.

Process-based Scheduling. Time-based scheduling used like round-robin


scheduling.
Interrupt latency is not considered as important Interrupt lag is minimal, which is measured in a
as in RTOS. few microseconds.
No priority inversion mechanism is present in the The priority inversion mechanism is current. So
system. it can not modify by the system.

Kernel's operation may or may not be preempted. Kernel's operation can be preempted.

Priority inversion remain unnoticed No predictability guarantees

2
07/03/2025

CHARACTERISTICS/REQUIREMENTS OF RTOS

 Determinism: Repeating an input will result in the same output.


 High performance: To adapt with many RTS systems that are fast and responsive, often executing actions within a
small fraction of the time needed by a general OS.
 Safety and security: RTOSes are frequently used in critical systems when failures can have catastrophic
consequences, such as robotics or flight controllers. To protect those around them, they must have:
 Higher security standards
 More reliable safety
 Maintainability and fault tolerance features
 A design that has a high ability of working with peak loads.
 Priority-based scheduling: Priority scheduling means that actions assigned a high priority are executed first, and
those with lower priority come after. This means that an RTOS will always execute the most important task.
 Small footprint: Versus their hefty general OS counterparts, RTOSes weigh in at just a fraction of the size. For
example, Windows 10, with post-install updates, takes up approximately 20 GB. VxWorks®, on the other hand, is
approximately 20,000 times smaller, measured in the low single-digit megabytes.
 Predictability: This can ne achieved by:
 Proper scheduling algorithms forandling tasks with explicit time constraints
 Guarantee in advance the deadline satisfaction and notify when deadline cannot be guaranteed 5

 Interrupt management that keeps the system reactivity but without causing unbounded delays on process execution due to unimportant interrupts.
 Memory management. That avoids the unpredictable memory access operations.

RTOS ARCHITECTURES

1. Monolithic RTOS e.g. RTLinux


 A monolithic kernel runs all operating system components in the
kernel space.
 For instance, a monolithic RTOS includes device drivers, file
management, networking, and graphics stack as part of the kernel
space.
 Applications however run in the user space.
 Although running user applications as memory-protected
processes protects a monolithic kernel from errant user code, a
single programming error in a file system, protocol stack or
driver can crash the system.
 In addition, any change to a driver or system file requires OS
modification and recompiling.

3
07/03/2025

RTOS ARCHITECTURES

2. Microkernel RTOS e.g. QNX® Neutrino®


 It is structured with a tiny kernel that provides minimal services.
 The microkernel works with a team of optional cooperating
processes that run outside kernel space (in the user space), which
provides higher-level OS functionality.
 The microkernel itself lacks file systems and many other services
normally expected of an OS.
 A microkernel RTOS embodies a fundamental innovation in the
approach to delivering OS functionality: modularity is the key,
and the small size is a side effect.
 only the core RTOS kernel is granted access to the entire system,
which improves reliability and security.
 The microkernel protects and allocates memory for other
processes and provides task switching.
 All other components, including drivers and system-level
components, are each contained within their own isolated process
space. 7

 Isolation prevents errors in a component from affecting other


parts of the system

RTOS COMPONENTS

 The Scheduler: This component of RTOS tells that in


which order, the tasks can be executed which is generally
based on the priority.
 Symmetric Multiprocessing (SMP): It is a number of
multiple different tasks that can be handled by the RTOS so
that parallel processing can be done.
 Function Library: It is an important element of RTOS that
acts as an interface that helps you to connect kernel and
application code. This application allows you to send the
requests to the Kernel using a function library so that the
application can give the desired results.
 Memory Management: this element is needed in the
system to allocate memory to every program, which is the
most important element of the RTOS.
 Fast dispatch latency: It is an interval between the
termination of the task that can be identified by the OS and
the actual time taken by the thread, which is in the ready
queue, that has started processing.
 User-defined data objects and classes: RTOS system
makes use of programming languages like C or C++, which 8

should be organized according to their operation.

4
07/03/2025

PRIORITY AND PREEMPTION IN REAL TIME OPERATING SYSTEMS

 A RTS usually is usually responsible for performing many real-time tasks of varied
importance concurrently,
 It is important to define the deadlines for these realtime tasks and define their relative
importance in the system.
 This leads us to the concept of priority, where priority determines the importance of a
task in a system.
 In a real-time system, every real task has an assigned priority. The higher the priority, the
better is the chance of the task executing and meeting its deadline.
 Using priorities of each task in a system, a scheme that allows coherent operation of a
system can be advised .
 By preventing the low priority task from doing their work when higher priority task wants
to do its work, we can maintain coherency of operations.
 A real-time task with higher priority can preempt low priority task(s).
9

 This privilege given to a higher priority task to perform its job even when other low
priority tasks are performing their jobs is known as preemption.

MEMORY MANAGEMENT FOR PREDICTABLE ACCESS


 Avoid non-deterministic delays in memory access is important for predictability.
RTOS should :
 Not support conventional demand paging (page fault handling!)
 Page fault & page replacement may cause unpredictable delays
 Support:
 Memory segmentation
 Static partitioning
 if applications require similar amounts of memory
 Applications and RTOS should:
 Do not use dynamic data structures
 prevent the possibility of correctly predict time needed to create and destroy dynamic structures
 Do not use recursion
 Impossible/difficult estimation of execution time for recursive programs
 only Use time-bound loops
 To estimate the duration of cycles
 Problems
10
 The above restrictions reduces the flexibility especially in dynamic environment
 careful balancing required between predictabiliy and flexibility

10

5
07/03/2025

MEMORY MANAGEMENT FOR PREDICTABLE ACCESS [CONT.]


1. Direct Memory Access
 It is used to transfer data between a device and the main memory
 Problem: I/O device and CPU share the same bus, so transferring data on the bus could delay the
task running on the CPU.
Solutions:
1. Cycle stealing
 The DMA steals a CPU memory cycle to execute a data transfer
 The CPU waits until the transfer is completed
 Source of non-determinism!
2. Time-slice method
 Each memory cycle is split in two adjacent time slots
 One for the CPU and One for the DMA => More costly, but more predictable!
2. Cache
 To obtain a high predictability it is better to have processors without cache
 Source of non-determinism
11

 cache miss vs. cache hit


 writing vs. reading

11

RELATION OF INTERRUPT MANAGEMENT WITH PREDICTABILITY?

Interrupts represent one of the biggest problem for predictability


 Typical device driver works simply as follows
<enable device interrupt>
<wait for interrupt>
<transfer data>
 In most OS
 interrupts served with respect to fixed priority scheme
 interrupts have higher priorities than processes
 The delay introduced by interrupts depends on how many interrupts occurred during the task.
 problem in real-time systems
 processes may be of higher importance than I/0 operation. So, interrupt handling can cause a
delay in their execution, and they may miss deadlines.

12

12

6
07/03/2025

SOLUTIONS FOR PREDICTABLE INTERRUPT MANAGEMENT


SOLUTION 1:

Solution : Disable all interrupts, except timer interrupts


 Advantages
 All peripheral devices are to be handled by tasks
 Data transfer by polling
 Great flexibility, time for data transfers can be estimated precisely
 No change of kernel needed when adding devices
 Disadvantages
 A degradation of processor performance (busy wait)
 Task must know low level details of the drive

13

13

SOLUTIONS FOR PREDICTABLE INTERRUPT MANAGEMENT


SOLUTION 1:

Solution : Disable all interrupts but timer interrupts, and handle devices by special,
timer-activated kernel routines
 Advantages
 unbounded delays due to interrupt driver eliminated
 periodic device routines can be estimated in advance
 hardware details encapsulated in dedicated routines
 Disadvantages
 degradation of processor performance (still busy waiting within I/0 routines)
 more inter-process communication than first solution
 kernel has to be modified when adding devices

14

14

7
07/03/2025

SOLUTIONS FOR PREDICTABLE INTERRUPT MANAGEMENT


SOLUTION 3:

Solution : Enable external interrupts and reduce the drivers to the least possible size
 Driver only activates proper task to take care of device
 The task executes under direct control of OS, just like any other task
 User tasks may have higher priority than device tasks

 Advantages
 busy wait eliminated
 unbounded delays due to unexpected device handling dramatically reduced ( not eliminated!)
 remaining unbounded overhead may be estimated relatively precisely
 State of the art!

15

15

IMPORTANT DEFINITIONS

 Interrupt latency (TIL). The time from the


start of the physical interrupt to the execution
of the first instruction of the interrupt service
routine.
 Scheduling latency (interrupt dispatch
latency)( TSL).The time from the execution
of the last instruction of the interrupt handler
to the first instruction of the task made ready
by that interrupt
 Context-switch time ( TCS). The time from
the execution of the last instruction of one
user-level process to the first instruction of
the next user-level process
 Maximum system call time. should be
predictable & independent of the number of
objects in the system 16

16

8
07/03/2025

EXAMPLE

17

17

SYSTEM CALLS PREDICTABILITY

 Non-preemtable calls could delay the execution of critical activities → system may
miss hard deadline
 All system calls have to be characterized by bounded execution time
 Solution: each kernel primitive should be preemptable!

18

18

9
07/03/2025

END

Thanks 19

19

Mansoura University
Faculty of Computers and Information Sciences
Department of Computer Science
Second Semester- 2024-2025

REAL TIME SYSTEMS


[RTS]

DR. MOHAMMED

20

20

10
07/03/2025

LECTURE 5

Scheduling in Realtime Operating Systems

BY DR. MOHAMMED ALRAHMAWY

21

21

SCHEDULAR IN RTOS

 The main job of the operating system scheduler is to decide what tasks should run and at what
time each task should run.
 Scheduling algorithms of general-purpose operating systems are nondeterministic because the
correctness of the system does not depend on the order in which every task is executed.
 In these general operating systems, the scheduler is intended to provide optimal
performance, optimal usage of resources, and fairness in resource assignment.
 In contrast, in real-time operating systems, the scheduler must restrict the nondeterminism
associated with the concurrent system, and must provide the means to predict the worst-case
temporal behavior of the task set.
 A real-time system is composed of several concurrent activities that are normally implemented
as tasks.
 To schedule these tasks, real-time operating systems use scheduling algorithms to decide
the order of execution of the tasks and the amount of time assigned to each task.
 The scheduler in RTOS maintains a priority queue (ranked list according to the priorities) of all
the tasks in system.
 By the means of preemption, the RTOS’ scheduler enforces the ranked list by allowing or
disallowing any particular task to perform its job at any given time. 22

 Hence the typical scheme employed for scheduler in real time system is called Priority based
Preemptive Scheduling Scheme.

22

11
07/03/2025

SCHEDULAR IN RTOS

 A given real-time scheduling algorithm may produce feasible or infeasible


schedules
 In a feasible schedule, every job for a given task set always completes by its
deadline.
 In contrast, in an infeasible schedule, some jobs may miss a few of their
deadlines.
 A set of jobs is schedulable according to a given scheduling algorithm if,
when using the algorithm, the scheduler always produces a feasible schedule.
 The criterion used to measure the performance of the scheduling algorithms
for real-time applications is their ability to find feasible schedules of the
given application whenever such schedules exist.
 A hard real-time scheduling algorithm is optimal if, for any feasible task 23

set, it always produces feasible schedules

23

SCHEDULING ALGORITHMS FOR RTOS

 In real time operating systems(RTOS) most of the tasks are periodic in nature.
 Periodic data mostly comes from sensors, servo control, and real-time monitoring
systems.
 In real time operating systems, these periodic tasks utilize most of the processor
computation power.
 A real-time control system consists of many concurrent periodic tasks having
individual timing constraints.
 The scheduling algorithms are used to determine which task is going to execute when
more than one task is available in the ready queue.
 The operating system must guarantee that each task is activated at its proper rate and
meets its deadline.

24

24

12
07/03/2025

IMPORTANT DEFINITIONS RELATED TO SCHEDULING


 Scheduling
define a policy for ordering the use of system resources by the tasks such that a metric is
maximized/minimized
 Real-time: ensures the predictability either by guaranteeing hard deadlines, minimize the number of
missed deadlines and/or minimize lateness
 Non- real-time: usually to minimize response time and maximize throughput in order to maximize
performance and ensure fairness, e.g. FCFS, RR, SJR, etc.
 Dispatching
carry out the execution according to the schedule
 Preemption, context switching, monitoring, etc.
 Admission Control
Filter tasks coming into the systems and thereby make sure the admitted workload is manageable
 Allocation
designate tasks to CPUs and (possibly) nodes. Precedes scheduling
 Feasibility. The ability of tall tasks to be scheduled to meet their deadlines.

25

TYPES OF SCHEDULING ALGORITHMS IN <HARD> RTOS

26

26

13
07/03/2025

TYPES OF SCHEDULING ALGORITHMS IN RTOS

 Offline (Static) Scheduling Algorithm


 Offline scheduling algorithm selects a task to execute with reference to a predetermined
schedule, which repeats itself after specific interval of time.
 For example, if we have three tasks Ta, Tb and Tc then Ta will always execute first, then Tb
and after that Tc respectively.
 This approach is highly predictable, but when the parameters of the tasks change, the
schedule must be recomputed and the system restarted.

 Online (Dynamic) Scheduling Algorithm


 In Online/dynamic decisions are taken at run-time based on the priorities of the tasks, i.e.,
scheduling a task executes with respect to its priority, which is determined in real time
according to specific rule and priorities of tasks may change during execution.
 Priority values can be assigned statically or dynamically, depending on the dynamic
scheduling algorithm. If static priorities are used, the priority of each task remains fixed
during the complete execution of the system, whereas if dynamic priorities are used, the27
priority of a task is allowed to change at any moment.

27

TYPES OF SCHEDULING ALGORITHMS IN RTOS

 Fixed priority algorithms


 In fixed priority, if the kth job of a task T1 has higher priority than the kth job of task T2
according to some specified scheduling event, then every job of T1 will always execute first
then the job of T2 i.e., on next occurrence priority does not change.
 One of best example of fixed priority algorithm is rate monotonic scheduling algorithm
(RM).

 Dynamic priority algorithms


 In dynamic priority algorithm, different jobs of a task may have different priority on next
occurrence, it may be higher or it may be lower than the other tasks.
 One example of a dynamic priority algorithm is the earliest deadline first algorithm (EDF).

28

28

14
07/03/2025

SCHEDULABILITY TEST/CONDITION

 A schedulability test defines a mathematical condition that is used to verify whether the
task set meets its temporal restrictions for a given scheduling algorithm, i.e. a feasible
schedule exists. The inputs of the test are the temporal parameters of the task set..
 A test is said to be sufficient in the sense that a task set is schedulable if it satisfies the test.
However, if the task set does not satisfy the sufficient test, it is not known whether the task
set can be schedulable using that scheduling algorithm. In other words:
 If test is passed, then tasks are definitely schedulable
 If test is not passed, tasks may be schedulable, but not necessarily
 A test is said to be necessary if all schedulable task sets satisfy the test. Otherwise, if a
given task set satisfies the test, we cannot say that it is schedulable. In other word:
 If test is passed, tasks may be schedulable, but not necessarily
 If test is not passed, tasks are definitely not schedulable
 Exact tests provide a necessary and sufficient condition. The inexact schedulability
tests provide only a sufficient (but not necessary) schedulability condition. In other words:
 The task set is schedulable if and only if it passes the test. 29

29

STATIC (OFF-LINE) SCHEDULING


ROUND ROBIN OR CYCLIC EXECUTION SCHEDULAR
Process Period Comp. Time

A 25 10
 A static/Off-line algorithm
B 25 8
 A clock-driven (time-driven) scheduling algorithm
C 50 5
 Construction of a cyclic executive is equivalent to bin
packing D 50 4

 In the given example, two cycles/periods can be defined E 100 2


for the algorithm:
 Minor Cycle (e.g. 25ms) - gcd of all periods
 Major Cycle (e.g. 100ms) - lcm of all periods

30

30

15
07/03/2025

STATIC SCHEDULING
ROUND ROBIN OR CYCLIC EXECUTION SCHEDULAR
OBSERVATIONS

 No actual processes exist at run-time


 Each minor cycle is just a sequence of procedure calls

 The procedures share a common address space and can thus pass data between
themselves.
 This data does not need to be protected (via semaphores, mutexes, for example) because
concurrent access is not possible
 All ‘task’ periods must be a multiple of the minor cycle time

31

31

STATIC SCHEDULING
ROUND ROBIN OR CYCLIC EXECUTION SCHEDULAR
DISADVANTAGES

With the approach it is difficult to:


 incorporate sporadic processes;
 incorporate processes with long periods;
 Major cycle time is the maximum period that can be accommodated without secondary
schedules (=procedure in major cycle that will call a secondary procedure every N major
cycles)
 construct the cyclic executive, and handle processes with sizeable computation
times.
 Any ‘task’ with a sizeable computation time will need to be split into a fixed number of fixed
sized procedures.

32

32

16
07/03/2025

DYNAMIC (ON-LINE) SCHEDULING


PRIORITY DRIVEN-STATIC PRIORITY
RATE MONOTONIC SCHEDULING ALGORITHM

 Assumptions
 Tasks are periodic
 No aperiodic or sporadic tasks
 Job (instance) deadline = end of period
 No resource constraints
 Tasks are preemptable

 Priority Assignment Rule


 The Rate Monotonic scheduling algorithm uses a simple rule that assigns priorities to different
tasks according to their time period.
 The rule is that the task with smallest time period will have highest priority and a task with longest
time period will have lowest priority for execution, i.e., Priority of a task is assigned inversely
proportional to its timer period.
 As the time period of a task does not change so not its priority changes over time, therefore Rate
monotonic is fixed priority algorithm.
 The priorities are decided before the start of execution and they does not change overtime.
 Rate monotonic algorithm is a preemptive algorithm which means if a task with shorter period
comes during execution it will gain a higher priority and can block or preempt currently running
tasks.
33
 RMS is an optimal preemptive scheduling algorithm with fixed priorities.
 Static/fixed priority algorithm assigns the same priority to all the jobs (instances) in each task.

33

RATE MONOTONIC SCHEDULING ALGORITHM

 Schedulability Condition
 A given task set of n tasks is scheduled under rate monotonic scheduling
Algorithm, if it satisfies the following equation:

Where Ck is the execution time and Tk is the period of task k and n is the number of tasks.
 The term n(21/n -1) approaches ln 2, (0.69 as n  ).
 This condition is sufficient, but not necessary.

34

34

17
07/03/2025

EXAMPLE -1

Release Execution Deadline Time


Tasks
time(ri) time(Ci) (Di) period(Ti)
T1 0 0.5 3 3
T2 0 1 4 4
T3 0 2 6 6

U= 0.5/3 +1/4 +2/6 = 0.167+ 0.25 + 0.333 = 0.75


• Processor utilization is less than 1 or 100% so task set is schedulable.
URM=n(21/n-1)=4(21/4-1)=0.757
• It satisfies the condition(U≤URM ) so it is schedulable using the rate
monotonic scheduling algorithm.

35

35

EXAMPLE 1 [CONT.]
1. According to RM scheduling algorithm task with shorter period has higher priority so T1 has
high priority, T2 has intermediate priority and T3 has lowest priority. At t=0 all the tasks are
released. Now T1 has highest priority so it executes first till t=0.5.
2. At t=0.5 task T2 has higher priority than T3 so it executes first for one-time units till t=1.5.
After its completion only one task is remained in the system that is T3, so it starts its execution
and executes till t=3.
3. At t=3 T1 releases, as it has higher priority than T3 so it preempts or blocks T3 and starts it
execution till t=3.5. After that the remaining part of T3 executes.
4. At t=4 T2 releases and completes it execution as there is no task running in the system at this
time.
5. At t=6 both T1 and T3 are released at the same time but T1 has higher priority due to shorter
period so it preempts T3 and executes till t=6.5, after that T3 starts running and executes till
t=8.
6. At t=8 T2 with higher priority than T3 releases so it preempts T3 and starts its execution.
7. At t=9 T1 is released again and it preempts T3 and executes first and at t=9.5 T3 executes its36
remaining part. Similarly, the execution goes on.

36

18
07/03/2025

EXAMPLE -2

For the Task set: Ti = (ci, pi), where T1 = (2,4) and T2 = (4,8)
Schedulability check:
U=2/4 + 4/8 = 0.5 + 0.5 = 1.0
URM =2(√2 -1) = 0. 82
U>URM ====>> CONDITION FAILED
However,
Active Tasks : Active Tasks :
Active Tasks : Active Tasks :
{T2} {T2, T1}
{T1, T2} {T2}

T11 T21 T12 T21


0 2 3 4 6 8
IMPORTANT: Some task sets that FAIL the utilization-based schedulability test are also 37

schedulable under RMS  We need exact analysis (necessary & sufficient)

37

DEADLINE MONOTONIC SCHEDULING ALGORITHM (DM)

 This is a dynamic preemptive algorithm with fixed priority


in which priorities are assigned to each task based on their
relative deadline.
 Task with shortest relative deadline is assigned highest
priority.
 It is a Preemptive Scheduling Algorithm that means if any
task of higher priority comes then, running task is
preempted and higher priority task is assigned to CPU.
 Priority of task is inversely proportional to deadline i.e.,
task with shortest deadline is assigned highest priority.
Deadline is time limit in which task has to be completed. ri: release time
 Unlike RM algorithm, the tasks scheduled with DM Ti: Period
algorithm can have a relative deadline rather than absolute Ci: Execution Time
deadline; relative deadline could be less than or equal to its Di: Deadline
period.
 The task is modeled by a tuple of (ri, Ti, Ci, Di)
38

 RM and DM are identical if the deadlines of the scheduled


tasks are proportional to their periods.

38

19
07/03/2025

EXAMPLE 3

 Suppose there are two tasks that need to be executed.


 Task1 has release time 0, period 7 units, execution time 2 units, and deadline of 6 units ( T1 ( 0, 7,
2, 6 ) ).
 Task2 has release time 0, period 5 units, execution time 2 units, and deadline of 4 units ( T2 ( 0, 5,
2, 4 ) ).

39

39

EXAMPLE 3 [CONT.]

• At T=0 both T1 and T2 are available, but deadline (T2) < deadline (T1). So T2 gets CPU and
gets executed till T=2. Now T2 will be available at T=5.
• At T=2 only T1 is available so T1 gets executed till T=4. Now T1 will be available at T=7.
• At T=4 to T=5 CPU remains idle as not task is available for execution.
• At T=5 only T2 is available so T2 gets executed till T=7. Now T2 will be available at T=7.
• At T=7 only T1 is available so T1 gets executed till T=9. Now T1 will be available at T=14.
• At T=9 to T=10 CPU remains idle as not task is available for execution.
• At T=10 only T2 is available so T2 gets executed till T=12. Now T2 will be available at T=15.
• At T=12 to T=14 CPU remains idle as not task is available for execution.
• At T=14 only T1 is available so T1 gets executed till T=15. Still 1 unit of work for T1 is
remaining.
• At T=15 both T1 and T2 are available, but deadline (T2) < deadline (T1). So T2 gets CPU and
gets executed till T=17. Now T2 will be available at T=20. 40

40

20
07/03/2025

ADVANTAGES AND DISADVANTAGES OF DM SCHEDULING ALGORITHM

 Advantages :
• Optimal for Static Priority Scheduling.
• Performs well in case of availability of tasks having longer period but shorter deadline.
• Good performance in case of overload.

 Disadvantages :
• Implementation is complex.
• It is a time taking process.

41

41

END

Thanks 42

42

21

You might also like