You are on page 1of 26

Embedded Real Time

Operating Systems
(ECE 367)
Dr. Rajiv Ranjan Singh
Professor
Department of Electronics and Communication
(ECE) Engineering
Lecture – 07

Timing Constraints

2
Outline (Lecture-07)

 Timing Constraints

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh 3
Timing Constraints
 Correctness of real-time tasks depend both on:
 Logical correctness of the result
 Satisfaction of the corresponding timing constraints
 Timing constraints => apply to certain events in a system

 Events in a Real-Time System: Events may be generated by the tasks


themselves or the environment of the system.

 Stimulus Events: generated by the environment and act on the system.


 When generated asynchronously => button press on a telephone
 When generated periodically => periodic sensing of temperature in a reactor
of nuclear power plant.

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh 4
Timing Constraints
 Response Events: generated by the system in response to some stimulus
events.
 Response event act on environment
 Example: In a chemical plant when temperature exceeds 100ºC => system
responds by switching off the heater
 Event of temp. exceeding 100ºC = stimulus
 Switching off the heater = response
 Response events can either be periodic or aperiodic
Event

Instantaneous Durational
 Start event (start button press)
 End event (end button press)

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh 5
Timing Constraints: Classification
 Performance Constraints: constraints that are imposed on the response
of the system.
 Ensures that the computer system performs satisfactorily.

 Behavioral Constraints: constraints that are imposed on the stimuli


generated by the environment.
 Ensures that the environment of a system is well behaved.

Performance and Behavioral Constraints

Delay Deadline Duration


Constraint Constraint Constraint

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh 6
Delay Constraints
 Delay Constraints: captures the minimum time (delay) that must elapse
between the occurrences of two arbitrary events e1 and e2.
 After e1 occurs, if e2 occurs earlier than the minimum delay, then a
delay violation is said to occur.
 A delay constraint on the event e2 can be expressed as
𝑡(𝑒2 ) and 𝑡(𝑒1 ) ≥ 𝑑
Where ‘d’ is the minimum delay specified from e2.
𝑡(𝑒2 ) and 𝑡(𝑒1 ) are the time stamps of e2 and e1 respectively

In the figure below ‘∆’ denotes the actual separation in time between the
occurrence of the two events e1 and e2 and ‘d’ is the required minimum
separation between the two events (delay).
Its obvious that delay violation
happens if e2 occurs before ‘d’
times since e1 has occurred.

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh 7
Deadline Constraints
 Deadline Constraints: captures the permissible maximum separation
between any two arbitrary events e1 and e2.
 Event e2 must follow event e1 within the maximum permissible time
‘d’.
 In the figure shown below, 𝑡(𝑒2 ) and 𝑡(𝑒1 ) are the time stamps of e2
and e1 respectively and ‘d’ is the deadline. ‘∆’ denotes the actual
separation between the time of occurrence of the two events e1 and
e2 .
 Hence we can say that
𝑡(𝑒2 ) - 𝑡(𝑒1 ) ≤ 𝑑

Its obvious that e2 must occur


within ‘d’ time units of e1’s
occurrence.

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh 8
Duration Constraints
 Duration Constraints: specifies the time period over which the event
acts.
 Minimum type duration constraint: once the event starts, it must not end
before a certain minimum duration.
 Maximum type duration constraint: once the event starts, it must end
before a certain maximum duration elapses.

Note: The deadline and delay constraints can be further classified based on whether
the constraint is imposed on the stimulus or on the response event

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh 9
Timing Constraints: Classification
Timing Constraints

Performance Constraints Behavioral Constraints

Delay Deadline Duration Delay Deadline Duration


Constraint Constraint Constraint Constraint Constraint Constraint

RR SR SR RR RS SS SS RS

RR = Response – Response RS = Response – Stimulus


SR = Stimulus – Response SS = Stimulus – Stimulus

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh 10
Timing Constraints: Example

Schematic Representation of a Telephone System

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh 11
Timing Constraints: Example
Stimulus-Stimulus (SS): deadline defined between two stimuli.
 Behavioral constraint: since constraint imposed on second event (stimulus).
 Stimulus 1 => user completes dialing a digit
 Stimulus 2 => user must dial next digit within 5 seconds (otherwise an idle
tone will be produced)
 Dialing two consecutive digits => two stimuli to the telephone system

Stimulus-Response (SR): deadline defined on the response event,


measured from the corresponding stimulus event.
 Performance constraint: since constraint imposed on response event
 Stimulus => lifting of the receiver handset (dial tone must be produced
within 2 sec, otherwise generate beep sound until handset is placed back) .
 Response => production of dial tone

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh 12
Timing Constraints: Example
Response-Stimulus (RS): deadline defined on production of response
counted from the corresponding stimulus.
 Behavioral constraint: since constraint imposed on stimulus event.
 Response => dial tone appears
 Stimulus => user must dial first digit within 30 seconds (otherwise system
enters an idle state and an idle tone will be produced)

Response-Response (RR): deadline defined on two response event,


measured from the corresponding stimulus event. Once first response event
occurs, second response even must occur before a certain deadline.
 Performance constraint: since constraint imposed on response event
 Response 1 => ring tone given to the callee.
 Response 2 => corresponding ring back tone given to the caller within 2
sec, (otherwise terminate the call)

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh 13
Timing Constraints: Example
Delay Constraint: will be of type SS
 Behavioral constraint: since constraint imposed on stimulus event.
 Stimulus 1=> dial the first digit
 Stimulus 2 => user must dial next digit after at least 1 second (otherwise
beeping sound will be produced until the handset is placed back)

Duration Constraint: specifies the time interval over which the event acts.
 Press a button less than 15 seconds => connects local operator
 Press a button between 15 to 30 seconds => connects an international
operator
 Press a button for more than 30 seconds => on release of button, it will
produce a dial tone

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh 14
Modeling Timing Constraints
A Time Constraint Model =>
 can serve as formal specification of the system
 Can be used to generate codes automatically, if constraints modelled
accurately
 Can help to verify and understand a real-time system

 Finite State Machines (FSMs) are used to model timing constraints


 Circle => a state
 Directed arc (from source to destination) => state transition
 Annotations on arc => event (stimuli / input) which caused a state
change / action (response / output)

 Extended Finite State Machines (EFSMs) => additionally incorporates the


action of setting a timer and the expiry event of timer

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh 15
Modeling Timing Constraints
An EFSM Example =>

e1 / set timer (20 milli seconds)

s1
s2

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh 16
Timing Constraints: Example
Stimulus-Stimulus (SS): deadline defined between two stimuli.
 Behavioral constraint: since constraint imposed on second event (stimulus).
 Stimulus 1 => user completes dialing the first digit (sets timer for 5 sec)
 Stimulus 2 => user must dial second digit within 20 sec (otherwise an alarm
will be produced)
 If second digit occurs before 20 sec => “Await Next State”
If second digit doesn’t occur before 20 Await
Next
sec => timer alarm expires and system Second digit / Digit
enters “Await Caller On-hook” State set timer (20 sec)

Timer alarm /
Beeping
First digit /
set timer (5 sec)
Await
Second Await
Digit Caller
On-hook

Model of an SS Type of Deadline Constraint

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh 17
Timing Constraints: Example
Response-Stimulus (RS): deadline defined on production of response
counted from the corresponding stimulus.
 Behavioral constraint: since constraint imposed on stimulus event.
 Response => dial tone appears
 Stimulus => user must dial first digit within 30 seconds (otherwise system
enters an idle state and an idle tone will be produced)

If 30 sec timer expires before first digit Await


Second
appears => system enters “Idle” state, Digit
otherwise if the first digit appears => First digit

system enters “Await Second Digit”


state. Timer alarm /
Idle Tone
Dial Tone /
set timer (30 sec)
Await
First
Digit Idle

Model of an RS Type of Deadline Constraint

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh 18
Timing Constraints: Example
Stimulus-Response (SR): deadline defined on the response event,
measured from the corresponding stimulus event.
 Performance constraint: since constraint imposed on response event
 Stimulus => lifting of the receiver handset (dial tone must be produced
within 2 sec (set timer), otherwise generate beep sound until handset is
placed back) .
 Response => production of dial tone => enter Await First Digit
Await
First
If dial tone doesn’t appear => system Dial tone Digit
enters “Await Receiver On-hook” State
Timer alarm /
Beeping
Handset lift /
set timer (2 sec)
Await
Dial Await
Tone Receiver
On-hook

Model of an SR Type of Deadline Constraint

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh 19
Timing Constraints: Example
Response-Response (RR): deadline defined on two response event,
measured from the corresponding stimulus event. Once first response event
occurs, second response even must occur before a certain deadline.
 Performance constraint: since constraint imposed on response event
 Response 1 => ring tone given to the callee.
 Response 2 => corresponding ring back tone given to the caller within 2
sec, (otherwise terminate the call)
Await
First
If the ring-back tone appears first => Ring-back Tone Digit
system enters “Await First Digit”
otherwise it enters “Await Receiver
On-hook” State and the call is Timer alarm /
terminated. Terminate Call
Ring Tone /
set timer (2 sec)
Await
Await
Ring-back
Receiver
Tone
On-hook

Model of an RR Type of Deadline Constraint

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh 20
Timing Constraints: Example
Delay Constraint: will be of type SS
 Behavioral constraint: since constraint imposed on stimulus event.
 Stimulus 1 => dial First digit
 Stimulus 2 => user must dial next digit after at least 1 second (otherwise
beeping sound will be produced until the handset is placed back)

If next digit appear before alarm => Await


Next
beep sound produced and system Timer Alarm Digit
enters “Await Caller On-hook” State

Next Digit /
Beeping
First digit /
set timer (1 sec)
Await
Next Await
Event Caller
On-hook

Model of an SS Type of Delay Constraint

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh 21
Timing Constraints: Example
Duration Constraint: specifies the time interval over which the event acts.
 Press a button less than 15 seconds => connects local operator
 Press a button between 15 to 30 seconds => connects an international
operator
 Press a button for more than 30 seconds => on release of button, it will
produce a dial tone

EFSM on next page

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh 22
Timing Constraints: Example
Duration Constraint: specifies the time interval over which the event acts.

Local
Operator
Button
Release
International
Button Operator
Press Button /
Set Alarm (15 sec) Release

Await Button
Event 1 Release / Dial
Dial Tone Tone

Timer Alarm / Await


Set Alarm (15 sec) Event 2
Await
Button
A Model of a Durational Constraint Release

Timer Alarm

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh 23
Next Lecture
 Timing Constraints Thought Provoking Example

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh 24
Bibliography
 K.C. Wang, “Embedded and Real-Time Operating Systems,” Springer
International Publishing, 2017.
 Rajib Mall, “Real Times Systems: Theory and Practice,” Pearson Education.
 Jonathan W. Valvano, “Embedded Systems: Real-Time Operating Systems for
Arm® Cortex™-M Microcontrollers,” CreateSpace Independent Publishing
Platform.
 Wolf, Wayne, Computers as Components – Principles of Embedded Computing
System Design, Second Edition, Morgan-Kaufmann, 2008.

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh 25
.

Thank You!
©These lecture slides have been prepared for the benefits of the registered students of the course
Embedded Real Time Operating Systems (ECE 367) of Presidency University, Bengaluru. Anybody
who may wish to use these slides for educational purpose could use it without any explicit permission. Any
kind of redistribution, alteration, and commercial use of this material is strictly prohibited.

06 May 2021 Embedded Real Time Operating Systems (ECE 367) @Dr. Rajiv Ranjan Singh

You might also like