Final LM of RTS
Final LM of RTS
(2019-2020)
Vision
To impart value based education and research among students, particularly belonging
to rural areas, for their sustained growth in technological aspects and leadership.
To collaborate with the industry for making the students adoptable to evolving
changes in Information Technology and related areas.
PEO 1:
PEO 2:
PEO 3:
To address industry and societal needs for the growth of global economy using emerging
technologies following professional ethics.
HANDOUT ON REAL-TIME SYSTEMS
=================================================================
=====
1. Brief History and Scope of the Subject
2. Pre-Requisites
Operating Systems
Networking
3. Course Objectives:
To familiarize with the concepts of Real – Time systems.
4. Course Outcomes: Students will be able to
CO1:make use of hard and soft real time systems.
CO2: evaluate Clock driven scheduling, weighted round-robin, priority
driven
approaches in real time systems.
CO3: compare rate monotonic and deadline monotonic algorithms.
CO4: analyze multi task scheduling algorithms for periodic, aperiodic
and sporadictasks.
CO5: demonstrate temporal distance and DCM.
CO6: outline real time communications architecture.
5. Program Outcomes:
Engineering Graduates will be able to:
CO4 3 3 2 3 2
CO5 2 2 1
CO6 2 2 2 3 2
7. Prescribed Text Books
Jane Liu, Real-Time Systems, Prentice Hall, 2000.
[Link], Real Time System Design and Analysis, 3rd
Edition, PHI, 2001.
8. Reference Text Books
Laplante and Ovasaka, “Real-Time Systems Design and Analysis:
Tools for the Practitioner” (4th Edition).
Cheng, A. M. K.: Real-Time Systems: Scheduling, Analysis, and
Verification.
Krishna, C. M., Shin, K. G.: Real-Time Systems. McGraw-Hill,
1997.
Levi, S. T., Agrawala, A. K.: Real-Time System Design. McGraw-
Hill, 1990.
9. URLs and Other E-Learning Resources
[Link]
[Link]
Objectives:
Syllabus:
Real time Systems, typical real-time systems, hard versus soft real-time
systems, a reference model of real-time systems.
Outcomes:
Students will be able to
explain the purpose and structure of a real time system.
illustrate differences between Digital control systems, High-level
control
system.
analyze the performance of soft and hard real time systems.
know reference model of real time system.
Learning Material
Real-Time Systems: A real-time system is any information processing system which has to
respond to externally generated input stimuli within a finite and specified period
A real-time system is one in which the correctness of the computations not only
depends on their logical correctness, but also on the time at which the result is
produced.
Failure to respond is as bad as the wrong response.
A real-time system changes its state as a function of physical time, e.g., a chemical
reaction continues to change its state even after its controlling computer system has
stopped.
Real-Time systems are becoming pervasive. Many embedded systems are referred to as
real-time systems.
Telecommunications, flight control and electronic engines, Networked Multimedia
Systems, Command Control Systems etc are some of the popular real-time system
applications where as computer simulation, user interface and Internet video are
categorized as non-real time applications.
Real-time systems often are comprised of a controlling system, controlled system and
environment.
Controlling system: acquires information about environment using sensors and controls
the environment with actuators.
Timing constraints derived from physical impact of controlling systems activities. Hard
and soft constraints.
Periodic Tasks : Time-driven recurring at regular intervals.
Digital Control: Many real-time systems are digital control, systems, they are embedded in
sensors and actuators and function as digital controllers (shown in fig ). The term plant in
the block diagram refers to a controlled system, for example, an engine, a brake, an aircraft,
a patient. The state of the plant is monitored by sensors and can be changed by actuators.
The real-time (computing) system estimates from the sensor readings the current state
of the plant and computes a control output based on the difference between the current
state and the desired state (called reference input in the figure).
We call this computation the control-law computation of the controller. The output thus
generated activates the actuators, which bring the plant closer to the desired state.
A Simple Example:
Let e(t)=r(t)−y(t) denote the difference between the desired state r(t) and the
measured state y(t) at time t . The output u(t) of the controller consists of three
terms.
During any sampling period (say the kth), the control output uk depends on the
current and past measured values yi for i≤k. The future measured values yi ’s for
i>k in turn depend on uk . Such a system is called a (feedback) control loop or
simply a loop. We can implement it as an infinite timed loop:
set timer to interrupt periodically with period T ;
end do;
Sampling Period: The length T of time between any two consecutive instants at which y(t) and
r(t) are sampled is called the sampling period. T is a key design choice. The behavior of the
resultant digital controller critically depends on this parameter.
We consider two factors. The first is the perceived responsiveness of the overall system.
The second factor is the dynamic behavior of the plant.
High-level Control: Controllers in a complex monitor and control system are typically organized
hierarchically. One or more digital controllers at the lowest level directly control the physical
plant. Each output of a higher-level controller is a reference input of one or more lower-level
controllers. With few exceptions, one or more of the higher-level controllers interfaces with the
operator.
A patient care system may consist of microprocessor-based controllers that monitor and
control the patient’s blood pressure, respiration, glucose, and so forth. There may be a
higher-level controller (e.g., an expert system) which interacts with the operator (a nurse or
doctor) and chooses the desired values of these health indicators.
The computation done by each digital controller is simple and nearly deterministic; the
computation of a high-level controller is likely to be far more complex and variable.
While the period of a low-level control-law computation ranges from milliseconds to
seconds, the periods of high-level control-law computations may be minutes, even hours.
Flight Control System:
Below figure shows hierarchy of flight control, flight management and air traffic control
systems.
The Air Traffic Control (ATC) system is at the highest level.
It regulates the flow of flights to each destination airport.
It does so by assigning to each aircraft an arrival time at each metering fix (known
geographical point, adjacent points are 40-60 miles apart) in the route to destination.
The aircraft is supposed to arrive at the metering fix at the assigned time.
At any time while in flight, the assigned arrival time to the next metering fix is a reference
input to the on-board flight management system.
The flight management system chooses a time-referenced flight path that brings the
aircraft to the next metering fix at the assigned arrival time.
The cruise speed, turn radius, descend/ascend rates and so for required to the chosen time-
referenced flight path are the reference inputs to the flight controller at the lowest level of
hierarchy.
Real-Time Command and Control
The controller at the highest level of a control hierarchy is a command and control system.
An Air Traffic Control (ATC) system is an excellent example.
The ATC system monitors the aircraft in its coverage area and the environment (e.g,
weather condition) and generates and presents the information needed by the operators.
Outputs from the ATC system include the assigned arrival times to metering fixes for
individual aircraft.
These outputs are reference inputs to on-board flight management systems. Thus, the ATC
system indirectly controls the embedded components in low levels of the control
hierarchy.
In addition, the ATC system provides voice and telemetry links to on-board avionics.
Thus it supports the communication among the operators at both levels (i.e., the pilots and
air traffic controllers).
The ATC system gathers information on the “state” of each aircraft via one or more active
radars. Such a radar interrogates each aircraft periodically. When interrogated, an aircraft
responds by sending to the ATC system its “state variables”: identifier, position, altitude,
heading, and so on.
The ATC system processes messages from aircraft and stores the state information thus
obtained in a database.
This information is picked up and processed by display processors. At the same time, a
surveillance system continuously analyzes the scenario and alerts the operators whenever
it detects any potential hazard (e.g., a possible collision).
Again, the rates at which human interfaces (e.g., keyboards and displays) operate must be
at least 10 Hz. The other response times can be considerably larger.
For example, the allowed response time from radar inputs is one to two seconds, and the
period of weather updates is in the order of ten seconds. And we can see that a command
and control system bears little resemblance to low-level controllers.
In contrast to a low-level controller whose workload is either purely or mostly periodic, a
command and control system also computes and communicates in response to sporadic
events and operators’ commands.
Furthermore, it may process image and speech, query and update databases, simulate
various scenarios, and the like. The resource and processing time demands of these tasks
can be large and varied.
A low-level control system typically runs on one computer or a few computers connected
by a small network or dedicated links, a command and control system is often a large
distributed system containing tens and hundreds of computers and many different kinds of
networks.
SIGNAL PROCESSING:
Anything that carries information is called as signals. It is a real or complex value function of
one or more variables. For example: temperature is one dimensional signal, image is 2-
[Link] means operating in some fashion on a signal to extract some useful
information. The signal is processed by system which can be electronic, mechanical or a
program.
In the simplest case, the weights, a(k,i)’s, are known and fixed. In essence, this
computation transforms the given representation of an object (e.g., a voice, an image
or a radar signal) in terms of the inputs, y(i)’s, into another representation in terms of
the outputs, x(k)’s. Different sets of weights, a(k,i)’s, give different kinds of
transforms. This expression tells us that the time required to produce an output is
O(n).
Radar System
To search for objects of interest in its coverage area, theradar scans the area
by pointing its antenna in one direction at a time.
During the time the antenna dwells in a direction, it first sends a short radio
frequency pulse. It then collects and examines the echo signal returning to the
antenna.
The echo signal consists solely of background noise if the transmitted pulse
does not hit any object.
On the other hand, if there is a reflective object (e.g., an airplane or storm
cloud) at a distance x meters from the antenna, the echo signal reflected by the
object returns to the antenna at approximately 2x/c seconds after the
transmitted pulse, where c= 3 × 108 meters per second is the speed of light.
Tracking:
Noise and man-made interferences, including electronic countermeasure (i.e.,
jamming), can lead the signal processing and detection process to wrong
conclusions about the presence of objects.
A track record on a non existing object is called a false return. An application
that examines all the track records in order to sort out false returns from real
ones and update the trajectories of detected objects is called a tracker.
Gating:
Typically, tracking is carried out in two steps: gating and data association.
Gating is the process of putting each measured value into one of two
categories depending on whether it can or cannot be tentatively assigned to
one or more established trajectories.
The gating process tentatively assigns a measured value to an established
trajectory if it is within a threshold distance G away from the predicted current
position and velocity of the object moving along the trajectory.
The threshold G is called the track gate. It is chosen so that the probability of
a valid measured value falling in the region bounded by a sphere of radius G
centered around a predicted value is a desired constant.
Process:
At the start, the tracker computes the predicted position (and velocity) of the
object on each established trajectory.
In this example, there are two established trajectories, L1 and L2. We also call
the predicted positions of the objects on these tracks L1 and L2. X1, X2, and X3
are the measured values given by three track records.
X1 is assigned to L1 because it is within distance G from L1. X3 is assigned to
both L1 and L2for the same reason.
On the other hand, X2is not assigned to any of the trajectories.
Itrepresents either a false return or a new object. Since it is not possible to
distinguish between these two cases, the tracker hypothesizes that X2 is the
position of a new object.
Subsequent radar data will allow the tracker to either validate or invalidate this
hypothesis. In the latter case, the tracker will discard this trajectory from
further consideration.
Data Association:
Hard real-time systems: A Real-Time System in which all deadlines are [Link] Real-Time
System guarantees that critical tasks complete on time. This goal requires that all delays in the
system be bounded from the retrieval of the stored data to the time that it takes the to finish any
request made of it.
The requirement that all hard timing constraints must be validated invariably places many
re-strictions on the design and implementation of hard real-time applications as well as
on the architectures of hardware and system software used to support them.
An overrun in response time leads to potential loss of life and big financial damage.
Many of these systems are considered to be safety critical. Sometimes they are “only”
mission critical, with the mission being very expensive.
In a hard real-time system, the peak-load performance must be predictable and should
not violate the predefined deadlines.
Hard real-time systems are often safety critical even load is very high.
Hard real-time systems have small data files and real-time databases.
In general there is a cost function associated with the system.
Strict about each task and its deadline.
The preemption period (the delay it can handle max ) should be very less( micro second)
For example: Rocket launching, Nuclear Power Plant control, Flight Control System.
1
Some Reasons for Requiring Timing Guarantees:
There may be no advantage in completing a job with a hard deadline early. As long as
the job completes by its deadline, its response time is not important. In fact, it is often
advantageous, sometimes even essential, to keep the response times of a stream of jobs
small. Hard and soft timing constraints allow a hard timing constraint to be specified in
any terms. Examples are
• Hard: failure to meet constraint is a fatal fault. Validation system always meets
timing constraints.
Deterministic constraints
Probabilistic constraints
Constraints in terms of some usefulness function.
• Soft: late completion is undesirable but generally not fatal. No validation or only
demonstration job meets some statistical constraint. Occasional missed deadlines or
aborted execution is usually considered tolerable. Often specified in probabilistic
terms
Soft real-time systems: A real-time system in which some deadlines are soft. A Soft Real-
Time Systems,in which jobs have soft deadlines is. The developer of a soft real-time system
is rarely required to prove rigorously that the system surely meet its real-time performance
objective. Examples of such systems include on-line transaction systems and telephone
switches, as well as electronic games.
In a soft real-time system, a degraded operation in a rarely occurring peak load can be
tolerated. A hard real-time system must remain synchronous with the state of the
environment in all cases.
Soft real-time systems will slow down their response time if the load is very high.
Deadline overruns are tolerable, but not desired.
There are no catastrophic consequences of missing one or more deadlines.
There is a cost associated to overrunning, but this cost may be abstract.
The task and its deadline is manageable but we should met the condition most of the all
the time.
The preemption period for this can be more (around milisecond ).
For example : Washing machine , Stock price quotation System Mobile phone, digital
cameras and orchestra playing robots.
Release time (ri) : is the time at which the job becomes ready for execution.
Absolute deadline( di): is the time at which the job should be completed.
Relative deadline(Di): is the time length between the arrival time and the
absolute deadline.
Start time (sj): is the time at which the job starts its execution.
Finishing time (fj): is the time at which the job finishes its execution.
Execution time (ei): May know range [e-, e+]. Most deterministic models use e+.
Periodic Task Model: In periodic task, jobs are released at regular intervals. A periodic
task is one which repeats itself after a fixed time interval. A periodic task is denoted by five
tuples: Ti = < Φi, Pi, ei, Di >
Where,
Task Ti is a serious of periodic Jobs Jij.
i - phase of Task Ti, equal to ri1.
pi - period, minimum inter-release interval between jobs in Task Ti. Must be bounded
from below.
ei - maximum execution time for jobs in task T i.
Di – is the relative deadline of the task.
rij - release time of the jth Job in Task i (Jij in Ti).
H –Hyperperiod = Least Common Multiple of pi for all i:
H = lcm(pi), for all i.
ui - utilization of Task Ti.
U - Total utilization = Sum over all ui.
1. Aperiodic Tasks: In this type of task, jobs are released at arbitrary time intervals i.e.
randomly. Aperiodic tasks have soft deadlines or no deadlines.
2. Sporadic Tasks: They are similar to aperiodic tasks i.e. they repeat at random instances. The
only difference is that sporadic tasks have hard deadlines. A sporadic task is denoted by three
tuples: Ti =(ei, gi, Di)
Where
ei – the execution time of the task.
gi – the minimum separation between the occurrence of two consecutive instances of the task.
Di – the relative deadline of the task.
Jitter: Sometimes actual release time of a job is not known. Only know that ri is in a range [ ri-,
ri+ ]. This range is known as release time jitter. Here ri– is how early a job can be released and
ri+ is how late a job can be released. Only range [ ei-, ei+ ] of the execution time of a job is
known. Here ei– is the minimum amount of time required by a job to complete its execution and
ei+ the maximum amount of time required by a job to complete its execution.
Functional Parameters:
While scheduling and resource access control decision are being made certain functional
parameters do affect the job.
o Preemptivity
Preemption: suspend job then dispatch different job to processor. Cost includes
context switch overhead.
Non-preemptable task - must be run from start to completion.
o Criticalness - positive integer indicating the relative importance of a job. Useful during
overload.
o Optional Executions - jobs or portions of jobs may be declared optional. Useful during
overload. In contrast, jobs and portions of jobs that are not optional are mandatory;
they must be executed to completion.
o Laxity - Laxity type of a job indicates whether its timing constraints are soft or hard.
Supplemented by a usefulness function. Useful during overload.
Resource Parameters: Job resource parameters indicate processor and resource requirements.
1. Preemptivity of resources
2. Resource Graph
Preemptivity of resources:
A resource in non-preemptable if each unit of resource is constrained to be used serially.
Once the unit of non-preemptable resource is allocated to a job, the other job needing the
unit must wait until the job completes its use.
If a job can use every resource in an interleaved manner, then the resource is called
preemptable.
Resource Graph:
Resource graph is used to describe the configuration of the resources.
In a resource graph, there is a vertex for every processor or resource Ri in the system.
The attributes of the vertex are the parameter of the resources.
Resource type of a resource tell if the resource is processor or passive resource and
number gives the available number of units.
There are two types of edges in resource graphs.
An edge from vertex Ri to Rk can mean Rk is component of Ri(memory is a part of
computer).
This edge is an is-a-part-of-edge.
Some edges in resource graph represent the connectivity between the components.
These edges are called accessibility edges.(Connection between two CPUs)
******************************************************************************
*****
Unit – II
Objectives:
To gain the knowledge on commonly used approaches to hard real-time scheduling, Clock driven
scheduling.
Syllabus:
Commonly used approaches to hard real-time scheduling
o Clock-driven scheduling, weighted round-robin approach, priority driven
approach.
Clock-Driven scheduling:
o Scheduling sporadic jobs: Acceptance test, EDF scheduling of accepted jobs.
o Algorithm for constructing static schedules: scheduling independent preemptable
tasks-Network flow graph
Outcomes:
Students will be able to
describe different hard real-time scheduling algorithms.
use clock driven scheduling to schedule sporadic jobs.
construct network flow graph by using static schedules.
differentiate Weighted Round Robin over Round Robin scheduling.
implement priority driven , clock driven approaches in scheduling jobs.
SCHEDULING ALGORITHMS:
Scheduling algorithms are a governing part of real-time systems and there exists many
different scheduling algorithms due to the varying needs and requirements of different
real-time systems.
The choice of algorithm is important in every real-time system and is greatly influenced
by what kind of system the algorithm will serve.
A scheduling algorithm can be seen as a rule set that tells the scheduler how to manage
the real-time system, that is, how to queue tasks and give processor-time.
Fig: shows the three elements of our model of real-time systems together. The application
system is represented by a task graph, exemplified by the graph on the top of the diagram.
This graph gives the processor time and resource requirements of jobs, the timing constraints
of each job, and the dependencies of jobs. The resource graph describes the amounts of the
resources available to execute the application system, the attributes of the resources, and the
rules governing their usage. Between them are the scheduling and resource access-control
algorithms used by the operating system.
2. Weighted round-robin
3. Priority-driven
2.1.1 Clock-driven scheduling:
As the name implies, when scheduling is clock-driven (also called time-driven), decisions on what
jobs execute at what times are made at specific time instants.
Primarily used for hard real-time systems where all properties of all jobs are known at
design time, such that offline scheduling techniques can be used.
These instants (parameters) are chosen a priori before the system begins execution.
A schedule of the jobs is computed off-line and is stored for use at runtime; as a result,
scheduling overhead at run-time can be minimized.
Decisions about what jobs execute at what times are made at specific time instants
Usually regularly spaced, implemented using a periodic timer interrupt
Scheduler awakes after each interrupt, schedules the job to execute for the next period, then
blocks itself until the next interrupt
One way to implement a scheduler that makes scheduling decisions periodically is to use a
hardware timer.
The timer is set to expire periodically without the intervention of the scheduler.
When the system is initialized, the scheduler selects and schedules the job(s) that will
execute until the next scheduling decision time and then blocks itself waiting for the
expiration of the timer. When the timer expires, the scheduler awakes and repeats these
actions.
Figure(a), shows that both sets of jobs (i.e., the second jobs J1,2 and J2,2 in the sets)
complete approximately at time 4 if the jobs are scheduled in a weighted round-robin
manner. (We get this completion time when the length of the time slice is small compared
with 1 and the jobs have the same weight.)
In contrast, the schedule in Figure(b) shows that if the jobs on each processor are
executed one after the other, one of the chains can complete at time 2, while the other can
complete at time 3.
On the other hand, suppose that the result of the first job in each set is piped to the second
job in the set. The latter can execute after each one or a few time slices of the former
complete. Then it is better to schedule the jobs on the round-robin basis because both sets
can complete a few time slices after time 2.
2.1.3 Priority-Driven approach:
The term priority-driven algorithms refer to a large class of scheduling algorithms that
never leave any resource idle intentionally. Scheduling decisions are made when events
such as releases and completions of jobs occur. Hence, priority-driven algorithms are
event-driven.
– Jobs J1, J2, …, J8, where Ji had higher priority than Jk if i < k
– Jobs are scheduled on two processors P1 and P2
– Jobs communicate via shared memory, so communication cost is negligible
– The schedulers keep one common priority queue of ready jobs
– All jobs are preemptable; scheduling decisions are made whenever some job
becomes ready for execution or a job completes
This scheduling can also be achieved by static system.
Let us assign J1,J2,J3 and J4 to P1 and remaining to P2.
Jobs on P1 are completed by time 8 and the jobs on P2 by time 11.
2.2 Clock-Driven Scheduling:
A common way to deal with this situation is to have the scheduler perform an acceptance
test when each sporadic job is released.
During an acceptance test, the scheduler checks whether the newly released sporadic job
can be feasibly scheduled with all the jobs in the system at the time.
A job in the system, we mean either a periodic job, for which time has already been
allocated in the precomputed cyclic schedule, or a sporadic job which has been
scheduled but not yet completed.
According to the existing schedule, If there is a sufficient amount of time in the frames
before its deadline to complete the newly released sporadic job without causing any job
in the system to complete too late, the scheduler accepts and schedules the job.
Otherwise, the scheduler rejects the new sporadic job.
By rejecting a sporadic job that cannot be scheduled to complete in time immediately
after the job is released, the scheduler gives the application system as much time as there
is to take any necessary recovery action.
Example: A quality control system.
o A sporadic job that activates a robotic arm is released when a defective part is
detected.
o The arm, when activated, removes the part from the conveyor belt. This job
must complete before the part moves beyond the reach of the arm.
o When the job cannot be scheduled to complete in time, it is better for the system
to have this information as soon as possible.
o System can slow down the belt, stop the belt, or alert an operator to manually
remove the part.
o Otherwise, if the sporadic job were scheduled but completed too late, its
lateness would not be detected until its deadline. By the time the system
attempts a recovery action, the defective part may already have been packed for
shipment.
We assume that the maximum execution time of each sporadic job becomes known upon
its release.
It is impossible for the scheduler to determine which sporadic jobs to admit and which to
reject unless this information is available.
Therefore, the scheduler must maintain information on the maximum execution times of
all types of sporadic jobs that the system may execute in response to the events it is
required to handle.
We also assume that all sporadic jobs are preemptable. Therefore, each sporadic job can
execute in more than one frame if no frame has a sufficient amount of time to
accommodate the entire job.
Conceptually, it is quite simple to do an acceptance test.
Let us suppose that at the beginning of frame t , an acceptance test is done on a sporadic
job S(d, e), with deadline d and (maximum) execution time e.
Suppose that the deadline d of S is in frame l+1 (i.e., frame l ends before d but frame l+1
ends after d) and l ≥ t .
Clearly, the job must be scheduled in the lth or earlier frames.
The job can complete in time only if the current (total) amount of slack time σc(t, l) in
frames t,t+1, . . . l is equal to or greater than its execution time e. Therefore, the scheduler
should reject S if e > σc(t, l).
The scheduler accepts the new job S(d, e) only if e ≤ σc(t, l) and no sporadic jobs in
system are adversely affected.
More than one sporadic job may be waiting to be tested at the same time.
A good way to order them is on the Earliest-Deadline-First (EDF) basis.
Newly released sporadic jobs are placed in a waiting queue ordered in non decreasing
order of their deadlines: the earlier the deadline, the earlier in the queue.
The scheduler always tests the job at the head of the queue and removes the job from the
waiting queue after scheduling it or rejecting it.
EDF Scheduling of the Accepted Jobs: Earliest deadline first (EDF) is dynamic priority
scheduling algorithm for real time systems. Earliest deadline first selects a task according
to its deadline such that a task with earliest deadline has higher priority than others
The EDF algorithm is a good way to schedule accepted sporadic jobs.
The scheduler maintains a queue of accepted sporadic jobs in non decreasing order of
their deadlines and inserts each newly accepted sporadic job into this queue in this order.
Whenever all the slices of periodic tasks scheduled in each frame are completed, the
cyclic executive lets the jobs in the sporadic job queue execute in the order they appear in
the queue.
An example of EDF is given below for task set of table.
Execution
Task Release time(ri) Deadline (Di) Time Period(Ti)
Time(Ci)
T1 0 1 4 4
T2 0 2 6 6
T3 0 3 8 8
At t=0 all the tasks are released, but priorities are decided according to their absolute deadlines
so T1 has higher priority as its deadline is 4 earlier than T2 whose deadline is 6 and T3 whose
deadline is 8, that’s why it executes first.
At t=1 again absolute deadlines are compared and T2 has shorter deadline so it executes and after
that T3 starts execution but at t=4 T1 comes in the system and deadlines are compared, at this
instant both T1 and T3 has same deadlines so ties are broken randomly so we continue to execute
T3.
At t=6 T2 is released, now deadline of T1 is earliest than T2 so it starts execution and after that
T2 begins to execute. At t=8 again T1 and T2 have same deadlines i.e. t=16, so ties are broken
randomly an T2 continues its execution and then T1 completes. Now at t=12 T1 and T2 come in
the system simultaneously so by comparing absolute deadlines, T1 and T2 has same deadlines
therefore ties broken randomly and we continue to execute T3.
At t=13 T1 begins it execution and ends at t=14. Now T2 is the only task in the system so it
completes it execution.
At t=16 T1 and T2 are released together, priorities are decided according to absolute deadlines so
T1 execute first as its deadline is t=20 and T3’s deadline is t=[Link] T1 completion T3 starts
and reaches at t=17 where T2 comes in the system now by deadline comparison both have same
deadline t=24 so ties broken randomly ant we T continue to execute T3.
At t=20 both T1 and T2 are in the system and both have same deadline t=24 so again ties broken
randomly and T2 executes. After that T1 completes it execution. In the same way system
continue to run without any problem by following EDF algorithm.
First consider the special case where the periodic tasks contain no non preemptable
section. After presenting a polynomial time solution for this case, we then discuss how to
take into account practical factors such as non preemptivity.
Scheduling Independent Preemptable Tasks
o A system of independent, preemptable periodic tasks whose relative deadlines are
equal to or greater than their respective periods is schedulable if and only if the
total utilization of the tasks is no greater than 1.
o Because some tasks may have relative deadlines shorter than their periods.
o The iterative algorithm described below enables us to find a feasible cyclic
schedule if one exists. The algorithm is called the iterative network-flow
algorithm, or the INF algorithm.
o Its key assumptions are that tasks can be preempted at any time and are
independent.
o Before applying the INF algorithm on the given system of periodic tasks, we find
all the possible frame sizes of the system
o The INF algorithm iteratively tries to find a feasible cyclic schedule of the system
for a possible frame size at a time, starting from the largest possible frame size in
order of decreasing frame size.
o A feasible schedule thus found tells us how to decompose some tasks into
subtasks if
their decomposition is necessary. If the algorithm fails to find a feasible schedule
after all the possible frame sizes have been tried, the given tasks do not have a
feasible cyclic schedule that satisfies the frame size constraints even when tasks
can be decomposed into subtasks.
Network-Flow Graph:
The algorithm used during each iteration is based on the well known network-flow
formulation of the preemptive scheduling problem.
In the description of this formulation, it is more convenient to ignore the tasks to
which
The jobs belong and name the jobs to be scheduled in a major cycle of F frames J1,
J2. JN
The constraints on when the jobs can be scheduled are represented by the network-
flow
graph of the system.
This graph contains the following vertices and edges; the capacity of an edge is a
Non-negative number associated with the edge.
UNIT – III
Priority-driven scheduling of periodic
tasks
Objectives:
To gain the knowledge on commonly used priority driven scheduling algoriths to periodic tasks.
Syllabus:
Priority-driven scheduling of periodic tasks: Fixed priority and Dynamic priority
algorithms- Rate monotonic and deadline monotonic algorithms.
Scheduling aperiodic and sporadic jobs in priority- driven system:
o Deferrable servers: Operations on Deferrable servers
Outcomes:
Students will be able to
describe Rate Monotonic and Deadline Monotonic fixed priority algorithms and dynamic
priority algorithms.
Scheduling deferrable server using RM algorithm
Scheduling deferrable server using EDF algorithm
PRIORITY-DRIVEN SCHEDULING OF PERIODIC TASKS :
Rate-Monotonic Algorithm:
For example, we have a task set that consists of three tasks as follows
Execution
Tasks Release time(ri) Deadline (Di) Time period(Ti)
time(Ci)
T1 0 0.5 3 3
T2 0 1 4 4
T3 0 2 6 6
Table 1. Task set
U= 0.5/3 +1/4 +2/6 = 0.167+ 0.25 + 0.333 = 0.75
As processor utilization is less than 1 or 100% so task set is schedulable and it also satisfies the
above equation of rate monotonic scheduling algorithm.
[Link] 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.
[Link] 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.
[Link] 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.
[Link] t=4 T2 releases and completes it execution as there is no task running in the system at
this time.
[Link] 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.
[Link] t=8 T2 with higher priority than T3 releases so it preempts T3 and starts its execution.
[Link] t=9 T1 is released again and it preempts T3 and executes first and at t=9.5 T3 executes
its remaining part. Similarly, the execution goes on.
Example:
Execution Relative
Tasks Release time(ri) Deadline (Di)
time(Ci) Deadline(Ti)
T1 50 25 50 100
T2 0 10 62.5 20
T3 0 25 125 50
Their utilizations are 0.5, 0.16, and 0.2, respectively. The total utilization is 0.86.
According to the DM algorithm, T2 has the highest priority because its relative
deadline 20 is the shortest among the tasks. T1, with a relative deadline of 100, has
the lowest priority. The resultant DM schedule I shown as
o
Clearly, when the relative deadline of every task is proportional to its period, the RM
and DM algorithms are identical.
When the relative deadlines are arbitrary, the DM algorithm performs better in the
sense that it can sometimes produce a feasible schedule when the RM algorithm fails.
DEFERRABLE SERVERS:
A deferrable server is the simplest of bandwidth-preserving servers.
The execution budget of a deferrable server with period ps and execution budget es is
replenished periodically with period ps .
When a deferrable server finds no aperiodic job ready for execution, it preserves its
budget.
Specifically, the consumption and replenishment rules that define a deferrable server (ps ,
es) are as follows.
Consumption Rule: The execution budget of the server is consumed at the rate of one per
unit time whenever the server executes.
Replenishment Rule: The execution budget of the server is set to es at time instants kpk,
for k = 0, 1, 2, . . We note that the server is not allowed to cumulate its budget from
period to period.
Example:
Consider a deferrable server DS has the highest priority. The periodic tasks T1 and T2 and
the server are scheduled rate-monotonically. Suppose that an aperiodic job A with
execution time 1.7 arrives at time 2.8.
At time 0, the server is given 1 unit of budget. The budget stays at 1 until time
[Link] A arrives, the deferrable server executes the job. Its budget decreases as it
executes.
Immediately before the replenishment time 3.0, its budget is equal to 0.8. This 0.8 unit
is lost at time 3.0, but the server acquires a new unit of budget. Hence, the server
continues to execute.
At time 4.0, its budget is exhausted. The server is suspended, and the aperiodic job A
waits.
At time 6.0, its budget replenished, the server resumes to execute A.
At time 6.5, job A completes. The server still has 0.5 unit of budget. Since no aperiodic
job waits in the queue, the server suspends itself holding this budget.
1. Consider another system that shows the same periodic tasks and the deferrable server
scheduled according to the EDF algorithm. At any time, the deadline of the server is equal
to the next replenishment time.
At time 2.8, the deadline of the deferrable server is 3.0. Consequently, the deferrable
server executes at the highest-priority beginning at this time.
At time 3.0, when the budget of the deferrable server is replenished, its deadline for
consuming this new unit of budget is 6. Since the deadline of J1,1 is sooner, this job has
a higher priority. The deferrable server is preempted.
At time 3.7, J1,1 completes. The deferrable server executes until time 4.7 when its
budget
is exhausted.
At time 6 when the server’s budget is replenished, its deadline is 9, which is the same
as the deadline of the job J1,2. Hence, J1,2 would have the same priority as the server.
The figure shows that the tie is broken in favor of the server.
COMPARISON OF REAL TIME TASK SCHEDULING ALGORITHMS:
Unit – IV
Objectives:
To gain the knowledge on commonly used priority driven scheduling algoriths to schedule
aperiodic and sporadic tasks.
Syllabus:
Resources and resource access control:
o Priority-Inheritance Protocol- rules, properties.
Multiprocessor scheduling and resource access control and
synchronization:
o Model of multiprocessors and distribution systems: Identical versus
Heterogeneous Processors, Inter process communication.
o Multiprocessor priority ceiling protocol-blocking time due to resource
contention, upper bounds to factors of blocking time.
Outcomes:
Students will be able to
describe Priority-Inheritance Protocol- rules, properties
use Priority-Inheritance Protocol
describe properties of multiprocessor and distributed systems
use Multiprocessor priority ceiling protocol(MPCP) in blocking time due to
resource contention and upper bounds to factors of blocking time.
3. Priority-Inheritance Rule: When the requesting job J becomes blocked, the job
Jl which blocks J inherits the current priority π(t) of J . The job Jl executes at its
inherited priority π(t) until it releases R; at that time, the priority of Jl returns to its
priority πl(t’) at the time t’ when it acquires the resource R.
Example:
There are five jobs and two resources Black and Shaded.
The parameters of the jobs and their critical sections are listed in part (a).
As usual, jobs are indexed in decreasing order of their priorities: The priority πi of
Ji is i , and the smaller the integer, the higher the priority.
In the schedule in part (b) of this figure, black boxes show the critical sections
when the jobs are holding Black. Shaded boxes show the critical sections when
the jobs are holding Shaded.
1. At time 0, job J5 becomes ready and executes at its assigned priority 5. At time 1, it is granted
the resource Black.
2. At time 2, J4 is released. It preempts J5 and starts to execute.
3. At time 3, J4 requests Shaded. Shaded, being free, is granted to the job. The job continues to
execute.
4. At time 4, J3 is released and preempts J4. At time 5, J2 is released and preempts J3.
5. At time 6, J2 executes L(Black) to request Black; L(Black) fails because Black is in use by J5.
J2 is now directly blocked by J5. According to rule 3, J5 inherits the priority 2 of J2. Because
J5’s priority is now the highest among all ready jobs, J5 starts to execute.
6. J1 is released at time 7. Having the highest priority 1, it preempts J5 and starts to execute.
7. At time 8, J1 executes L(Shaded), which fails, and becomes blocked. Since J4 has Shaded at
the time, it directly blocks J1 and, consequently, inherits J1’s priority 1. J4 now has the
highest priority among the ready jobs J3, J4, and J5. Therefore, it starts to execute.
8. At time 9, J4 requests the resource Black and becomes directly blocked by J5. At this time the
current priority of J4 is 1, the priority it has inherited from J1 since time 8. Therefore, J5
inherits priority 1 and begins to execute.
9. At time 11, J5 releases the resource Black. Its priority returns to 5, which was its priority when
it acquired Black. The job with the highest priority among all unblocked jobs is J4.
Consequently, J4 enters its inner critical section and proceeds to complete this and the outer
critical section.
10. At time 13, J4 releases Shaded. The job no longer holds any resource; its priority returns to 4,
its assigned priority. J1 becomes unblocked, acquires Shaded, and begins to execute.
11. At time 15, J1 completes. J2 is granted the resource Black and is now the job with the highest
priority. Consequently, it begins to execute.
12. At time 17, J2 completes. Afterwards, jobs J3, J4, and J5 execute in turn to completion
Multiprocessor system refers to the use of two or more central processing units (CPU) within
a single computer system. These multiple CPUs are in a close communication sharing the
computer bus, memory and other peripheral device
We can classify multiprocessor systems as follows:
Tightly coupled multiprocessing: Consists of a set of processors that share a common
main memory and are under the integrated control of an operating system.
o A multiprocessor system is tightly coupled so that global status and workload
information on all processor can be kept current at a low cost. The system may
use a centralized dispatcher/scheduler.
o When each processor has its own scheduler, the actions and the decisions of the
scheduler of all processors are coherent.
Loosely coupled or distributed multiprocessor, or cluster:
o A distributed system is loosely coupled in such a system that it is costly to keep
global status and workload information current.
o The schedulers on the different processors may make scheduling and resource
access control decisions independently. As a result, their decisions may be
incoherent as a whole.
It is assumed that each processor has its own scheduler in this chapter. Each scheduling,
resource access control or synchronization algorithm will be evaluated to see how much the
algorithm relies on the current global information, how much coordination among schedulers
is required and therefore how suitable the algorithm is for loosely coupled systems.
4.2.2 Identical versus Heterogeneous Processors : There are two types of processors
Identical Processors: The processors are of the same type or identical, if the processors can
be used interchangeably.
o For example, in a parallel machine, each of the CPUs can execute every computation
job in the system, so the CPUs are identical.
o If any message from a source to a destination can be sent on any of the data links
connecting them, then the links are identical.
Heterogeneous Processors: Different types of processors may have different functions. As
an example, CPUs, file disk, and transmission links are functionally different. So, they
cannot be used interchangeably. Processors can be of different types for many reasons.
o For example, if the designer decides to use some CPUs for only some components of
the system but not others, then the CPUs are divided into different types according to
the components that can execute them. In a static system, the application system is
partitioned into µ components and jobs in each component execute on a fixed CPU.
CPUs are viewed as µ different processors.
The model of heterogeneous processors used here is known as the unrelated processors
model in scheduling theory literature. According to this model, each job can execute on some
types of processors but, in general, not all types.
Different types of processors may have different speeds. The execution times of each job on
different types of processors are unrelated hence the name of the model.
o For example, the execution time of a computation intensive job is 1 second in CPU1 but
is 5 seconds on a less powerful CPU2. Because CPU2 has better interrupt handling and
I/O capabilities, the execution time of an I/O intensive job is 10 seconds on CPU1 but is
only 3 seconds in CPU2. Both jobs cannot execute on a transmission link and signal
processor, so their execution time on these kinds of processors is infinite. The unrelated
models allow us to characterize all system.
Other types of networks such as FDDI network may use very different scheduling
algorithms.
In all cases, we can take into account inter processor communication costs by
including work
processor and message transmission job in our model. There is no need to consider this
factor separately in some ad hoc manner.
Finally, CPUs may be connected via dedicated links. When messages transmissions
between a
pair of CPUs are under program control, each simplex link can be modeled as single-unit
resource on the sending CPU.
The scheduler of every synchronization processor knows the priorities and resource
requirements of all the tasks requiring the global resources managed by the processor.
It is also assumed that the resources used by every job during nested critical sections lies
on the same processor.
According to this protocol, the scheduler of each processor schedules all the local tasks
and global critical sections on the processor on a fixed priority basis and controls their
resource accesses according to the basic priority ceiling protocol.
According to the MPCP model, when a task uses a global resource, its global critical
section executes on the synchronization processor of the resource.
If the global section of a remote task were to have a lower priority than some local task
on the synchronization processor, these local tasks could delay the completion of the
global critical section and prolong the blocking time of the remote task.
For preventing this, the multiprocessor priority ceiling protocol schedules all the global
critical sections at higher priorities than all the local tasks on every synchronization
processor.
This can be implemented in a system where the lowest priority πlowest all the tasks is
known.
The scheduler of each synchronization processor schedules the global critical sections of
a task with priority πi at priority πi - πlowest.
As an example:
o Consider a system where tasks have priorities 1 through 5, πlowest is 5.
o A global critical section of a task with priority 5 is scheduled at priority 0, which is
higher that priority 1.
Also, the priority of a global critical section of a task with priority 1 is – 4 which is
the highest priority in the system
a. local blocking time, which is due to its contention for resources on its local processors.
b. local preemption delay, which is due to preemption of Ti by global critical sections that
belong to remote tasks but execute on its processors.
c. remote blocking time, which is due to its contention with some lower priority tasks for
remote resources on the synchronization processor(s) of the resource(s).
d. remote preemption delay, which is due to preemptions by higher priority global critical
sections of synchronization processors of the remote resources required by Ti ; and
e. deferred blocking time, which is due to the suspended execution of local higher-priority
tasks.
(Or)
Unit – V
Objectives:
To gain the knowledge on Scheduling flexible computations and tasks with temporal distance
constraints.
Syllabus:
Scheduling flexible computations and tasks with temporal distance constraints
Outcomes:
Students will be able to
characterize flexible applications.
use constrained optimization algorithm for scheduling flexible [Link] t
schedule tasks with temporal distance constraints.
use DCM algorithm with Harmonic and Arbitrary distance constraints
5.1 Flexible computations and Flexible Applications:
Some real-time applications must tolerate fluctuation in available resources or workload.
A real-time network server may receive more traffic than expected.
A failure may divert load onto a backup system.
In particular, a flexible application can reduce its time and resource demands at expense
of the quality of its result.
For as long as the user finds its result quality acceptable, a flexible application can
degrade gracefully when resources are scarce and the demands of competing workloads
are high.
In recent years, the flexible computation approach has been proposed as a means for
handling overload and increasing availability of applications in domains as diverse as
Artificial Intelligence (AI), signal processing and tracking, real-time communication, and
databases.
The timing constraints of many applications can be characterized more conveniently and
naturally by temporal distances rather than deadlines.
Real-time performance may degrade due to load from non-real-time tasks sharing the
processor A real-time system has two degrees of flexibility when it becomes impossible
to meet all deadlines :
Graceful degradation in timeliness.
Graceful degradation in quality.
Flexible computations : The ability to trade-off, at run time, quality of results for the amount of
time and resources used to produce those results .
As a system moves into overload, it gracefully degrades rather than suddenly failing.
Assumption: a timely result of poor quality is better than a high quality, but late, result .
Examples:
Multimedia: a fuzzy picture is better than no picture.
Air traffic control: prefer system to keep working, with error bars, than to fail completely
on overload.
A timely warning of collision, with estimated location better than an exact location, delivered
too late to avoid collision.
5.1.1Characterization of Flexible Applications: Jobs have an optional component and a
mandatory part.
If sufficient resources, both mandatory and optional parts complete; a precise result.
If limited resources, the optional component is discarded, giving an imprecise result.
How to implement?
Sieve method
Milestone method
Multiple version method
Workload Model
Criteria of Optimality
A monotonic job makes the scheduling decision easier, since longer execution, after the
mandatory part, always improves quality – Otherwise needs watch result quality, to know
when to stop.
The scheduler must make an a-priori decision on which version to execute, based on load
at the start of the job.
Requires more intelligence in the scheduler than sieve or milestone methods.
Little gain from having more than one alternate
4). Criteria of Optimality: Algorithms for scheduling flexible applications have two objectives.
Correctness: Finding a feasible schedule that ensures all mandatory jobs complete.
Quality of result: Try to fit in as many optional jobs as possible, to reduce the error in the result.
– Measure the error according to some domain specific metric
• Can be difficult to characterize.
– Clearly desirable if the error function is convex
• May influence choice of algorithm, for milestone based jobs.
5.1. 3 Algorithms for scheduling flexible Applications
(2) Minimizes one of the static quality metrics (i.e., average error, total error, and
maximum error) of the system.
Most on-line algorithms a static quality metric, while others are designed to prevent
dynamic failures.
When all the parameters of all jobs in the system are known, it is possible to compute an
optimal static schedule off- line at design time or configuration time.
The problem of finding such a schedule is typically formulated as a constrained
optimization problem.
Illustrative example:
Thus the problem of finding optimal static schedule of the system is reduced to the problem of
finding the set { x1 , x 2 ,… x n } of processor allocations to jobs in the optional tasks that satisfies
the following constraints :
0 xi e0 ;
n em,i xi for i=1,2,3,…n
i 1 pi
1
n
0 ai ,k t k 1 t k for k=1,2,….k (c)
i 1
k
And em ,i ai ,k e if the job ji is monotone (d)
k 1
k
Or a k 1
i ,k em ,i or e if the job ji has 0/1 constraint (f)
The constraint of Eq. b follows from the fact that a job can be schedule only in the intervals
that are within its feasible interval ( ,
Equation (c) ensures that the total amount of processor allocations of each monotone job
must satisfy eq(d),which makes sure that the total amount of processor time in all intervals
that is allocated to the job is no less than its mandatory execution time and no greater than its
execution time .
The processor allocations of each job with 0/1 constraint must satisfy eq. 10.5e.
The optimal static schedule is given by the allocation ai , k ’s that satisfy the above constrains
and minimize the objective function , which is either the total error or the maximum
error given by Eq(2) or is the average error
(g)
k
xi ai ,k em ,i (h)
k 1
Again, the complexity of this optimization problem depends on the error functions and
weights of jobs.
When jobs have identical weights and error functions are linear, an optimal static schedule
that minimizes the total (average) error of n monotone jobs can be found by a simple O(n log
n) algorithm.
When jobs have convex error functions and identical weights, the total error of all jobs can
be kept small by making the ratio xi/eo,i of the processor time allocation xi of each optional
job to its execution time equal to this ratio of every other optional job as much as possible.
An optimal schedule can be found in O(n2) time when optional jobs have identical execution
times and in O(n3) time when the jobs have arbitrary execution times.
When jobs have arbitrary weights, we have a linear program to solve in the simple case when
all the error functions are linear.
The added dimensions in the resource versus quality trade-off increase the number of
constraints the solution must meet.
The complexity of the problem can be kept tractable only by keeping the error functions
simple (e.g., linear) and the constraints linear.
Temporal Distance Model: To define the term distance constraint precisely, consider a task Ti
comprises a chain of jobs Ji,k for k = 1, 2, …n. The first job, Ji,1, is released at time φi . This
means first job Ji,1 in Ti is ready for execution at φi, and each subsequent job, Ji,k+1 where
(k≥1), becomes ready when its predecessor, Ji,k, completes .Ti is an end-to-end task, and φi is
its phase.
Let fi,k completion time/finish time of kth job Ji,k .
The temporal distance(or simply distance) between this job Ji,k and next job Ji,k+1 is fi,k+1-
fi,k is difference between their completion time.
The task Ti has a Temporal distance constraint Ci, if :
fi,1 – φi ≤ Ci (Initial job)
fi,k+1 – fi,k ≤ Ci for k = 1, 2, … (Later job)
If the completion time of all the jobs in Ti according to a schedule satisfy these
inequalities then Ti meets its distance constraint Ci (i.e Jobs must complete within time Ci of
their predecessor).
A schedule of a system T consisting of tasks T 1, T2, …….Tn with distance constraints
C1,C2,….Cn is feasible if every task in T meets the task’s distance constraint. A system is
schedulable according to an algorithm if the algorithm surely produces a feasible
schedule.
We index the tasks in order of their distanceconstraints i < j, then Ci < Cj.
We said that the distance constraints C1,C2,….Cn for n tasks are harmonic if Ci divides Cj
for every pair of i < j.
Density of a task, Ti, with execution time ei and temporal distance constraint Ci is
Just like periodic and sporadic tasks, tasks with temporal distance constraints are
preemptable. However , it is reasonable to disallow arbitrary preemption. In particular,
the scheduler is not allowed to preempt a job J i,k ,just before its completion, leaving an
infinitesimally small portion to be complete later.
if the scheduler is allowed this preemption, then the problem of scheduling T i to meet the
distance constraint Ci is trivial: The scheduler simply schedules the last infinitesimally
small portion of the job in Ti periodically Ci units apart and then schedules the reaming
portions of the jobs as if they were released periodically with period Ci.
5.2.1 Distance Constraint Monotonic(DCM) Algorithm :
Distance Constraint Monotonic (DCM) Algorithm does not preempt jobs arbitrarily.
DCM can schedule tasks to explicitly meet distance constraints if appropriate
– If you care about inter-job timing, as well as each job meeting its deadline.
– Jobs not only meet deadlines, they occur with Ci of the actual completion time of an
earlier task.
Use a fixed priority scheduling algorithm, similar to deadline monotonic: Distance
Constraint Monotonic scheduling.
The algorithm has two elements: priority assignment and job separation constraints.
i). Assign task priorities monotonically according to distance constraint
Smaller the distance constraint Ci of task Ti, higher the task’s priority. Therefore,
tasks with indices i-1 or less have higher priorities than Ti, for all i=1,2,…,n.
Jobs run with the fixed priority of the task to which they belong
ii). Provide separation between jobs to allow low priority tasks to run and meet their
constraints
The scheduler were to let each successor job on Ji,k+1 (k>=1) in a task Ti with
distance constraints be ready for execution as tasks. This is why the scheduler
imposes a separation constraint between consecutive jobs in each task Ti.
The Separation constraint between consecutive two jobs Ji,k and Ji,k+1 (k>=1) in Ti
is the minimum length of time between the completion time of fi,k of a job Ji,k and
the ready time ri,k+1 of its immediate successor Ji,k+1. i.e “When a job completes, delay
it’s successor as long as possible, to allow jobs from lower priority tasks to run”.
It improves schedulability.
According to DCM algorithm, the delay Ci – Wi is the separation constraint on job in each
task Ti , chosen to ensure that jobs complete and just meet their temporal distance constraint,
where Wi is maximum response time of job in Ti.
The scheduler computes the ready times of jobs in Ti, according to
The delay Ci–Wi is the separation constraint, chosen to ensure that jobs complete and just meet
their temporal distance constraint.
An implicit assumption here is Wi ≤ Ci., this condition must hold; otherwise it is impossible for
Ti to meet its distance constraint Ci.
Once released, job is scheduled according to task priority
–Might not execute immediately…
A system T that is schedulable according to the DCM algorithm, the maximum response Wi of
a jobs in each task Ti can be obtained as follows:
Find maximum response time W1of highest priority task T1
For each Ti for i>1, find Wi after deriving a DCM schedule for all higher priority tasks,
assuming all tasks are released at time 0(worst case response time, when all tasks start at
once).
A distance constraint task is similar to an end-to-end task in the sense that it consists chain of jobs.
The DCM scheduler gives each task a fixed prority; according to DCM algorithm , atask with a
smale distance constraint has a higher priority.
i) Scheduling Tasks with Harmonic Distance Constraints: The temporal distance between a job
Ji,k+1 and its immediate predecessor is Ci- Wi + y .,When the response time of Ji,k+1 is y. By
definition y ≤ Wi, this distance is no greater than Ci.
Again the critical assumption is that Wi ≤ Ci., this condition must hold; otherwise it is
impossible for Ti to meet its distance constraint Ci.
Distance constraints are harmonic: longer constraints are always integer multiples of
shorter–separation constraint as previously described
Theorem: The system is schedulable and meets temporal distance constraints if Δ≤1
Proof: The system devolves into a rate monotonic schedule with period Ci.
ii) Scheduling Tasks with Arbitrary Distance Constraints: If we relax the system definition to
have arbitrary temporal distance constraints, it becomes difficult to prove schedule correct. Can
transform such a system into one with harmonic temporal distance constraints through the
specialization operation.
Specialization: A way to improve the schedulability of tasks with arbitrary distance constraints is
to first transform them into tasks with harmonic distance constraints. The operation carried out for
this purpose is called specialization
Parameters of Accelerated Tasks: Given a system of tasks T1, T2, …, Tn with distance
constraints C1, C2, … Cnthe specialization operation transforms it into a set of accelerated tasks.
The accelerated tasks T1’, T2’, … Tn’ have distance constraints C1’, C2’, …, Cn’.Where:
1. The execution time of Ti’equals the execution time of Ti
2. The distance constraint Ci’≤Ci
3. The new distance constraints are harmonic
Tighten the distance constraints, reducing the schedulable utilisation of the system, but allowing
proof of schedulability.
***********************
Unit – VI
Objectives:
To gain the knowledge on model of real-time communication architecture, Medium
Access Control protocol in DQDB networks and operating system function, open system
architecture.
Syllabus:
Real-Time Communications
Model of real time communication: architecture, real-time connections and service
disciplines-packet switched networks.
Medium access-control protocols of broadcast networks: medium access control
protocol in DQDB networks: DQDB architecture
Operating Systems
Threads and tasks, Kernel- structure of microkernel, interrupts
Memory management
I/O and networking
Open system architecture: objectives, two-level scheduler.
Outcomes:
Students will be able to
describe model of real time communication.
specify service disciplines of real time communication.
design packet switched networks.
describe medium access control protocol in DQDB networks.
describe structure of microkernel and interrupts handling.
explain open source architecture.
6.1 Model of real time communication: It is a well known model of distributed system. The
hosts are connected by a communication networks or several interconnected networks. The top
layers are simplified and all the entities above all the transport layer applications are called.
1. Rate allocating
2. Rate controlled
Rate allocating discipline allows packets on each connection to be transmitted at higher
rates than the guaranteed rate provided the switch can still meet the guarantees to all other
connections.
A service discipline is rate controlled if it ensures each connection the guaranteed rate but
never allows packets on any connection to be sent above the guaranteed rate.
They make several assumptions, which are valid for most switched, multipop networks.
The diagram in figure 6-2(a) illustrates such a network. The circles in the diagram represent
switches.
Figure 6-2(b) shows a m x m switch; it has m input links and m output links, both called
links 1, 2…m. the switch routes packets on its input links to its output links.
We can represent every switching (i.e…, routing) pattern by a permutation of the m-tuple
(1, 2…m). A number I at position K means that the switch is configured to route a packet
coming on the input link I to (the queue of) the output link K at the same time when it is
routing packets on the other input links to other output links as specified by the
permutation.
As an example, for a 4 x 4 switch, the 4-tuple (2,4,1,3) means that a packet on input link 2
goes to the queue of output link 1, a packet on input link 4 goes to the queue of output link
2, and so on. This is the switching pattern depicted by figure 6-2(b). The switch is
nonblocking, meaning that every permutation represents a possible switching pattern.
Figure 6-2(a)
Figure 6-2(b)
The end-to-end delay of each packet through a switched network is equal to the sum of
the per hop delays it suffers passing through all the switches en route plus the total time it
takes to propagate along all the links between the switches.
As its name implies, a DQDB network has two unidirectional buses, called bus A and bus
B.
The slot generator at the head end of each bus generates 53 octet slots on the bus; a station
places its outgoing data for stations downstream using these slots. Together, the buses
provide the stations with full-duplex capability.
There are two types of slots on the network: preallocated (PA) slots and Queue-Arbitrated
(QA) slots. PA slots are for isochronous traffic. Allocation to bandwidth provided by PA
slots is done centrally by the bandwidth manager and virtual circuit server (BMVS).
QA slots are for asynchronous traffic. As an example, during connection establishment and
tear down, stations and the BMVS communicate via QA slots. Access to these slots is
scheduled distributed by individual stations and the BMVS.
Centralized Allocation of Isochronous Bandwidth: We now focus on how PA slots on one bus
are allocated to isochronous connections using the bus.
These slots are divide into groups; the slot generator generates a slot every 125
milliseconds periodically for each group. Each slot group is identified by its Virtual Circuit
Identifier (VCI).
The header of every PA slot contains the VCI of the group to which the slot belongs.
Connection Establishment: The basic unit of the bandwidth allocation is a 64-kbits/sec channel.
The 64-kbits/sec bandwidth of a channel is provided by one octet in every slot of a PA slot
group. Since the data field of each PA slot contains 48 octets, each PA slot group provides 48
isochronous channels. Each of these channels identified by a 2-tuple of group number and offset;
the latter specifies the octet within the slot used by the channel. As examples, channels (33,7)
and (177,42) are the seventh octet of the slots in group 33 and the forty-second octet of the slots
in group 177, respectively.
A good real-time operating system not only provides efficient mechanisms and services to
carry out good real-time scheduling and resource management policies, but also keeps its
own time and resource consumptions predictable and accountable.
More than general-purpose operating systems, a real-time operating system should be
modular and extensible.
A real-time operating system may have a microkernel that provides only essential services,
such as scheduling, synchronization, and interrupt handling.
A thread implements a computation job and is the basic unit of work handled by the
scheduler.
Admission of a job (or a task) into the system after an acceptance test; this step
encompasses the creation of a thread that implements the job.
When the kernel creates a thread, it allocates memory space to the thread and brings the
code to be executed by the thread into memory.
In addition, it instantiates a data structure called the Thread Control Block (TCB) and
uses the structure to keep all the information it will need to manage and schedule the
thread.
The information kept in the TCB of a thread includes the ID of the thread and the
starting address of thread’s code.
The context of a thread refers to the values of registers (e.g., program counter and status
register) and other volatile data that define the state and environment of the thread.
When a thread is executing, its context changes continuously.
When the thread stops executing, the kernel keeps its context at the time in the thread’s
TCB.
If the operating system inserts a thread in a queue (e.g., the ready or suspend queue), we
mean that it inserts (a pointer to) the TCB of the thread into a linked list of TCBs of
other threads in that queue. The kernel destroys a thread by deleting its TCB and
deallocating its memory space.
Periodic Threads:
Memory Management
A task is not admitted into the system if there is not enough memory to meet its peak
memory space demand.
Aspects of memory management: virtual memory mapping, paging, and memory
protection.
All general-purpose operating systems support virtual memory and memory protection,
not all real-time operating systems do, and those that do typically provide the user with
the choice of protection or no protection.
Virtual Memory Mapping:
We can divide real-time operating systems into three categories depending on whether
they support virtual memory mapping (i.e., virtual contiguity) and paging (i.e., demand
paging or swapping).
Real-time operating systems designed primarily for embedded real-time applications
such as data acquisition, signal processing, and monitoring, may not support virtual
memory mapping.
Upon request, the system creates physically contiguous blocks of memory for the
application.
The application may request variable size segments from its memory block and define a
memory partition consisting of physically contiguous, fixed-size buffers.
Memory fragmentation is a potential problem for a system that does not support virtual
mapping.
After allocating variable-size segments, large fractions of individual blocks may be
unused.
The available space may not be contiguous and contiguous areas in memory may not be
big enough to meet the application’s buffer space demand.
The solution is to provide virtual memory mapping from physical addresses, which may
not be contiguous, to a contiguous, linear virtual address space seen by the application.
The penalty of virtual address mapping is the address translation table, which must be
maintained and hence contribute to the size of the operating system.
Memory Locking:
A real-time operating system may support paging so that non real-time, memory
demanding applications (e.g., editors, debuggers and performance profilers) needed
during development can run together with target real-time applications.
Such an operating system must provide applications with some means to control
paging.
All operating systems, including general-purpose ones, offer some control, with
different granularities.
An examples, Real-Time POSIX-compliant systems allow an application to pin down
in memory all of its pages.
In some operating systems (e.g., Windows NT), the user may specify in the create
thread system call that all pages belonging to the new thread are to be pinned down in
memory.
The LynxOS operating system controls paging according to the demand-paging
priority.
Memory pages of applications whose priorities are equal to or higher than this priority
are pinned down in memory while memory pages of applications whose priorities are
lower than the demand-paging priority may be paged out.
Memory Protection:
Many real-time operating systems do not provide protected address spaces to the
operating system kernel and user processes.
Argument for having only a single address space includes simplicity and the light
weight of system calls and interrupts handling. For small embedded applications, the
overhead space of a few kilobytes per process is more serious.
Critics points out a change in any module may require retesting the entire system. This
can significantly increase the cost of developing all but the simplest embedded systems.
For this reason, many real-time operating systems support memory protection.
A good alternative is to provide the application with the choices in memory
management. such as the choices in virtual memory configuration offered by VxWorks
and QNX.
In VxWorks, we can choose to have only virtual address mapping, to have text
segments and exception vector tables write protected, and to give each task a private
virtual memory when the task requests for it.
I/O and Networking: Three modern features of file system and networking software are