UNIT 2
Timing Constraint
· Constraint imposed on the timing behavior of a job
· Each unit of work that is scheduled and executed by system is Job
· Set of Related jobs which jointly provided some system function is a TASK
Types of Timing Constraint
Hard real-time
· Has strict deadlines that must be met
· Tasks are governed by rigid time constraints
· If a deadline is not met, the system fails
· For example, if an output is expected within 10 seconds, the system must process the input and
provide the output within 10 seconds
Soft real-time
· Has relaxed deadlines, and not every task needs to meet its deadline
· Tasks do not have rigid time constraints
Tardiness in a real-time operating system (RTOS) is the delay in completing a task by its deadline. RTOS
are designed to handle multiple processes at once, and ensure that they respond to events within a
predictable time limit.
Timing Behavior (Temporal Parameters)
1. Release Time: Time in which Job available for execution.
2. Deadline: Time duration for Job. Job must be executed within that time.
3. Completion Time: Time taken to complete Job.
4. Response Time: It’s a length of a time from Release Time till the Completion time
5. Relative Deadline: Maximum allowable response time.
6. Absolute Deadline: It a Deadline only. Its Release Time + Relative Deadline
In Detailed(Temporal Parameters)…..
In real-time systems, understanding the timing behavior of tasks is crucial for ensuring timely execution
and meeting deadlines. Here's a breakdown of key temporal parameters, focusing on periodic, aperiodic,
and sporadic job models:
1. Periodic Jobs
● Period (T): The fixed time interval between the releases (or activations) of consecutive instances
of the same task.
● Release Time (r): The time at which a job instance becomes available for execution. For periodic
tasks, release times are typically predictable and occur at regular intervals.
● Deadline (D): The time by which a job instance must complete execution. Often, deadlines
coincide with the period (D = T) for simplicity.
● Execution Time (C): The time required to execute a job instance on the processor.
2. Aperiodic Jobs
● Release Time (r): The time at which an aperiodic job arrives. This is typically unpredictable and
can occur at any time.
● Deadline (D):
○ Soft Deadline: Missing the deadline may degrade performance but does not cause
catastrophic failure.
○ Firm Deadline: Missing the deadline has significant consequences, but the system can
still function.
○ Hard Deadline: Missing the deadline is considered a system failure.
● Execution Time (C): The time required to execute the job instance.
3. Sporadic Jobs
● Minimum Inter-arrival Time (g): The minimum time interval between the arrivals of two
consecutive sporadic job instances. This parameter provides some predictability to the arrival
pattern.
● Release Time (r): The time at which a sporadic job arrives. While not strictly periodic, there's a
minimum separation between arrivals.
● Deadline (D): Typically hard deadlines, as sporadic jobs often represent critical events.
● Execution Time (C): The time required to execute the job instance.
Key Considerations:
● Jitter: Variations in the actual release times of jobs, even for periodic tasks. Jitter can be caused
by factors like network delays or external events.
● Synchronization: In some cases, tasks may have dependencies, requiring synchronization
mechanisms that can impact timing behavior.
● Resource Contention: If multiple tasks compete for shared resources (e.g., memory, I/O devices),
contention can introduce delays and impact meeting deadlines.
Example
● Periodic Task: A temperature sensor reading task might be triggered every 100 milliseconds (T =
100ms).
● Aperiodic Task: An emergency stop signal in a manufacturing process would be an aperiodic
event with a hard deadline.
● Sporadic Task: A network packet arrival might be sporadic, with a minimum inter-arrival time
between packets.
Reference Models
Reference models for real time system are important to provide a framework for designing, analyzing,
and implementing real-time system.
Processor Model
· A processor model is a design element in computer architecture that describes how a processor
schedules instructions.
· Specifies the characteristic of processor
· Ex. Clock speed, memory size and instruction set
Resource Model
· It specifies the resources available to an application.
· Ex. I/O device, network interface, memory
Task Model
· It’s a task model is a set of independent tasks that are assigned priorities and executed in a specific
order.
· Ex. Data acquisition, processing and communication.
Communication Model
· It uses communication mechanisms like message queues, semaphores, and event flags to exchange
information between tasks.
· Ex. Message passing, shared memory sockets
Deterministic and Probabilistic Models in RTOS
In the context of Real-Time Operating Systems (RTOS), both deterministic and probabilistic models play
crucial roles in understanding and predicting system behavior.
1. Deterministic Models
● Focus: Predictable and consistent behavior.
● Assumptions:
○ Precise knowledge of task execution times.
○ No variations in hardware or software performance.
○ Predictable external events.
● Techniques:
○ Rate Monotonic Analysis (RMA): Prioritizes tasks with shorter periods.
○ Earliest Deadline First (EDF): Prioritizes tasks with earlier deadlines.
● Applications:
○ Critical systems where missing deadlines has severe consequences (e.g., flight control,
medical devices).
2. Probabilistic Models
● Focus: Handling uncertainty and variations.
● Assumptions:
○ Task execution times can vary.
○ External events may have probabilistic occurrences.
○ Hardware/software performance may fluctuate.
● Techniques:
○ Stochastic analysis: Uses statistical methods to model and analyze system behavior.
○ Markov chains: Model the probabilistic transitions between different system states.
○ Simulation: Simulates system behavior under various conditions to evaluate
performance.
● Applications:
○ Systems with less stringent timing requirements (e.g., multimedia streaming, industrial
control).
Key Differences
Feature Deterministic Models Probabilistic Models
Focus Predictability Uncertainty
Assumptions Precise, deterministic Probabilistic, variable
Techniques RMA, EDF Stochastic analysis, simulation
Applications Critical systems Less critical systems
Combining Approaches
In many real-world scenarios, a combination of deterministic and probabilistic models is often used.
● Hybrid Approaches:
○ Use deterministic analysis for core, time-critical tasks.
○ Employ probabilistic methods to analyze less critical parts of the system.
Example
● Automotive Engine Control:
○ Deterministic: Core engine functions like fuel injection timing must have precise,
predictable responses.
○ Probabilistic: Modeling variations in environmental factors (temperature, humidity) and
driver behavior.
By understanding the strengths and limitations of both deterministic and probabilistic models, engineers
can design and analyze real-time systems that effectively meet their performance and reliability
requirements.
Real-Time Operating Systems (RTOS), a "deterministic model" refers to a system where the execution
time of tasks is predictable and fixed, meaning the outcome of an operation is always the same given
the same input, while a "probabilistic model" incorporates uncertainty and randomness, where the
execution time of tasks can vary depending on factors like system load, leading to potentially different
outcomes for the same input.
Key Differences:
● Predictability: Deterministic models are highly predictable as they always produce the same
result for the same input, while probabilistic models can produce different results due to
inherent randomness.
● Uncertainty: Deterministic models assume no uncertainty in system behavior, whereas
probabilistic models explicitly account for potential variations and uncertainties.
When to Use Each Model:
● Deterministic Models:
○ Time-critical applications where precise timing is crucial, like industrial control systems,
medical devices, and real-time communication protocols.
○ Scenarios with well-defined system parameters where variations are minimal.
● Probabilistic Models:
○ Systems with varying workloads or unpredictable external factors, like network traffic
management or sensor data processing.
○ Situations where analyzing the range of possible outcomes is important, such as
performance analysis under varying conditions.
Examples in RTOS:
● Deterministic Scheduling: A typical RTOS scheduling algorithm like "Priority-based Preemptive"
where tasks are assigned priorities and executed based on their priority, ensuring predictable
execution times.
● Probabilistic Scheduling: Algorithms that consider factors like task arrival times and execution
time variations with statistical distributions to optimize overall system performance under
uncertainty.
Important Considerations:
● Complexity: Implementing a deterministic model is often simpler than a probabilistic one, as it
requires less complex calculations and analysis.
● Accuracy: While deterministic models can be efficient for well-defined scenarios, they may not
accurately reflect real-world situations with inherent variability.