Professional Documents
Culture Documents
2019HT01605 - ES ZG553 - EC2MAssignment
2019HT01605 - ES ZG553 - EC2MAssignment
Mid-Semester Test
(EC-2 Make-up)
Real time systems are those which must satisfy bounded response time conditions. These are
systems which respond input stimuli with a specified and finite time.
Every real time task is associated with some time constraints Eg: Deadline (deadline of the job is the
instance by which its execution is expected to be completed). Real-time system is responsible for the
completion of all tasks within their time intervals.
Correctness:
Correctness of the system not only depends on logical correctness of the system but also on time by
which results are produced. If the result is not obtained within the given time interval then also
result is not considered correct.
Task Criticality:
Hard real time systems – failure to meet deadline can be fatal, and these tasks are critical.
Soft real time systems – Failure to meet deadline can only lead to performance degradation.
Firm real time systems - Missing more than a few deadline can lead to complete catastrophic
system failure.
Safety and reliability:
Page 1 of 7
2019HT01605 | VITHYA M | ES ZG553 | REAL TIME SYSTEMS
Real-time systems provide critical safety so such real time systems should be able to operate for long
times, also even during failure it should be able to correct. Safety can be ensured through increased
reliability.
Highly reliable systems can be designed with at least one of the three methods:
Error avoidance
Error detection and correction
Fault tolerance ( provide redundancy )
Concurrency:
Real-time systems are concurrent that means it can respond to a several number of processes at a
time. There are several different tasks going on within the system and it responds accordingly to
every task in short intervals.
Stability:
Even when the load is very heavy, real-time systems should respond in the time constraint i.e. real-
time systems does not delay the result of tasks even when there are several task going on a same
time. This brings the stability in real-time systems
Reactive:
Real-time systems are often reactive. A reactive system is one in which the output generated is used
for further processing. (Kind of feedback system)
Real-time systems do not produce any output data but enter into an on-going interaction with their
environment. In each interaction step, the results computed are used to carry out some actions on
the environment. The reaction of the environment is sampled and is fed back to the system.
Exception Handling:
Real time systems are mostly used in safety critical system. So it should be able to detect failure and
the system should continue to operate in a gracefully degraded mode rather than shutting off
abruptly.
Q.2. What do you mean by hyper period and Make span? Explain. Calculate the hyper period
and make span for the given tasks T(e,p) : T1(2,4), T2(3,8) and T3 (4,16).
Hyper Period (H): Hyper period H of periodic task is the least common multiple of periods of all the
tasks in the set.
H = LCM (p1, p2, p3 ….pk )
The hyper period is the time after which pattern of job release times starts to repeat.
LCM ( 4,8,16) = 16
Hyper period for the set of given tasks is 16
Make span (M): Make span is the time required to complete a group of jobs (All n jobs in a group ).
Page 2 of 7
2019HT01605 | VITHYA M | ES ZG553 | REAL TIME SYSTEMS
Make span is used to compare scheduling algorithm performance. The algorithm which produces a
schedule with shorter make span is better.
M = C-S
M: Make span time of a group of jobs
C: completion time of last job in the Group
S: start time of first job in the group
Total utilisation (U) for the tasks is Sum ( 2/4+ 3/8 + 4/16 ) > 1 = 1.125>1
So these tasks are not schedulable. At least one of the tasks misses deadline.
Q.3. Draw the task precedence graph for a chocolate vending machine in a pantry. Identify the
tasks associated in such a scenario?
Page 3 of 7
2019HT01605 | VITHYA M | ES ZG553 | REAL TIME SYSTEMS
Function: Vending machine is an automatic machine which sells different types of product once the
coin is inserted. Let us consider a simple vending machine whose function is to dispense chocolate
on inserting 5 rupees coin.
Assumption:
Specification:
Tasks:
J4: If the coin is of 5Rs denomination, dispense chocolate equal to number of 5Rs coins inserted
using a mechanical motor.
Q.4. For the task set given, schedule the task according to the deadline monotonic algorithm.
Page 4 of 7
2019HT01605 | VITHYA M | ES ZG553 | REAL TIME SYSTEMS
T1 = (50, 50, 25, 100), T2 = (0, 60, 10, 20), T3 = (0, 125, 25, 50)
With deadline-monotonic priority assignment, tasks are assigned priorities according to their
deadlines. The task with the shortest deadline is assigned the highest priority.
1 50 50 25 100
2 0 60 10 20
3 0 125 25 50
(As T2 has least relative deadline and T1 has highest relative deadline)
Page 5 of 7
2019HT01605 | VITHYA M | ES ZG553 | REAL TIME SYSTEMS
Q.5. A system uses the cyclic EDF algorithm to schedule sporadic jobs. The cyclic schedule of
periodic tasks in the system uses a frame size of 5, and a major cycle contains 6 frames.
Suppose that the initial amounts of slack time in the frames are 1, 0.5, 0.5, 0.5, 1, and 1.
(a) Suppose that a sporadic job S (23, 1) arrives in frame 1, sporadic jobs S2(16, 0.8)
and S3(20, 0.5) arrive in frame 2. In which frame are the accepted sporadic jobs scheduled?
Acceptance test of sporadic Job: let us suppose at the beginning of frame ‘t’, an acceptance test is
done on sporadic job ‘S’ with deadline ‘d’ and execution time ‘e’
Suppose that the deadline of ‘d’ of S is in the frame l+1 and l>t
Hence the job can complete on time only if the current (total) amount of slack time in frames t,t+1,
…..l is greater than execution time ‘e’. The scheduler accepts the job only if the above condition is
satisfied.
S1(23,1) :
Frame-2 and frame 3 has a slack of 0.5 each. And frame 3 ends at t=15, before the deadline of S1. So
sum of slack times in frame 2, 3 is greater than the execution time of sporadic job.
The scheduler accepts S1, at start of frame 2. If no other job arrives it would finish by end of frame
3.
S2( 16,0.8):
The scheduler examines S2 at the start of frame-3 (t=10). The deadline is 16 , which is in frame 4, but
there is only 0.5 slack in frame- 3. As S2 cannot be completed before the deadline, scheduler does
not accept S2
Page 6 of 7
2019HT01605 | VITHYA M | ES ZG553 | REAL TIME SYSTEMS
S3(20,0.5)
The scheduler examines S2 at the start of frame-3 (t=10). Deadline is 20m which is in beginning of
frame 5. There is 1 unit of slack time between frame 3 and frame 5. However the scheduler need to
see if the job can be executed without affecting the already accepted job. Earliest deadline first
algorithm is used, so if S3 is accepted, S3 will have higher priority that S1, so S3 will complete its
execution and then s1 will complete the remaining 0.5 execution and will complete by frame-4.
(b) Suppose that an aperiodic job with execution time 3 arrives at time 1. When will it be
completed, if the systems does not do slack stealing?
Assumption: sub-division a) should also be considered. i.e sporadic jobs S1,S2,S3 are also released
Let us consider an aperiodic job, K with execution time of 3 and release time 1. Scheduler runs K in
slack of first frame. As the slack time from frames 2,3,4 is consumed by the sporadic job S1,S3,
aperiodic job continues in frame 5,6 and completes execution by end of frame 6 which is time t= 30
Let us consider an aperiodic job, K with execution time of 3 and release time 1.
Scheduler runs K in slack of all frames from (1-5). Aperiodic job completes is execution by frame - 5
(time t = 24.5)
THE END
********
Page 7 of 7