Professional Documents
Culture Documents
UNIT -2
K.B.Sathya
Asst Professor
Sathyabama University
RTOS
• RTOS-Real Time Operating System
• Two features of RTOS
predictability and determinism.
• Real Time Applications
• Airline traffic control systems, Command Control Systems, Airlines
reservation system, Heart Pacemaker, Network Multimedia Systems,
Robot etc
• Task and task states
Task
• A task is also called a thread
• Task is the executing unit of computation, which is controlled by OS
Task States
Depending upon the execution, task has three types namely
Advantages:
Semaphores allow only one process into the critical section.
They follow the mutual exclusion principle strictly
much more efficient than some other methods of synchronization
Machine independent
Disadvantages:
Semaphores are complicated so the wait and signal operations must be implemented in the correct order to
prevent deadlocks.
Semaphores are impractical due to loss of modularity.
Semaphores may lead to a priority inversion where low priority processes may access the critical section first
and high priority processes later.
Three major categories
• Binary
• Counting
• Mutual exclusion
Binary
• A binary semaphore can have a value of either 0 or 1.
• When a binary semaphore’s value is 0, the semaphore is considered
unavailable (or
• empty);when the value is 1, the binary semaphore is considered
available (or full).
• Note that when a binary semaphore is first created, it can be
initialized to either available
• orunavailable (1 or 0, respectively).
Count
• A counting semaphore uses a count to allow it to be acquired or released
multiple times.
• When creating a counting semaphore, assign the semaphore a count that
denotes the
• numberof semaphore tokens it has initially.
• If the initial count is 0, the counting semaphore is created in the
unavailable state.
• If the count is greater than 0, the semaphore is created in the available
state, and the number
• oftokens it has equals its count
Mutual exclusion
• A mutual exclusion (mutex) semaphore is a special binary semaphore
thatsupports
• ownership, recursive access, task deletion safety, and one or more
protocols for avoiding
• problems inherent to mutual exclusion
Interrupt routines in RTOS environment
• Interrupt Service Routine (ISR) –block of code- determining which hardware device
requires servicing,
Two rules
• An interrupt routine must not call any RTOS functions that might block. could block
the highest priority task. ...
• An interrupt routine must not call any RTOS function that might cause the RTOS to
switch tasks.
Two case:
Low level
High level
Basic Design Using RTOS
RTOS stands for Real-Time Operating System.
As the name suggests, it is an operating system (OS) that is designed to process or respond to incoming data
in real time – but what does “real time” mean?
Real time systems are time-bound systems that have strict timing constraints and requirements.
That means that the processor must complete each task within their given time constraints so that the following
task can be executed on time, otherwise the system is considered to have failed.
The true value of RTOS, however, lies in its ability to maintain timing requirements while enabling
multitasking.
One key problem lies in the fact that sequential code runs line by line to completion and
cannot truly be interrupted.
Continuing with our previous example: Once we call the function to maintain the server
connection, the code must run to completion before any further action can be taken. On a large
scale, this may introduce significant delays and make timing requirements difficult to meet
without an RTOS.
Types of RTOS
•Hard Real Time – Task timings and deadlines are handled very strictly. (eg. critical
healthcare, aircraft systems)
•Firm Real Time – Deadlines need to be followed, but not as strictly. (eg. video conferencing,
GPS tracking)
•Soft Real Time – Timing constraints are not expressed as absolute values. (eg. online
transactions, web browsing)
RTOS Characteristics
•Performance –High performance
•Features – eg. dynamic memory allocation
•Cost –High
•Ecosystem – The RTOS run on a variety of microprocessor architectures
Regular OS Real-Time OS (RTOS)
Complex Simple