Real Time Operating System (RTOs)
What is Real-Time?
A system is called a real-time system, when we need quantitative
expression of time (i.e. real-time) to describe the behavior of the system.
Applications of Real-Time Systems:
Industrial Applications:
Industrial applications constitute a major usage area of real-time
systems.
process control systems, industrial automation systems, SCADA
applications, test and measurement equipments, and robotic
equipments.
Chemical Plant Control
Chemical plant control systems are essentially a type of process
control application. In an automated chemical plant, a real-time
computer periodically monitors plant conditions. The plant conditions
are determined based on current readings of pressure, temperature, and
chemical concentration of the reaction chamber. These parameters are
sampled periodically. Based on the values sampled at any time, the
automation system decides on the corrective actions necessary at that
instant to maintain the chemical reaction at a certain rate.
Each time the plant conditions are sampled, the automation
system should decide on the exact instantaneous corrective actions
required such as changing the pressure, temperature, or chemical
concentration and carry out these actions within certain predefined time
bounds. Typically, the time bounds in such a chemical plant control
application range from a few micro seconds to several milliseconds.
Automated Car Assembly Plant
Supervisory Control And Data Acquisition (SCADA)
SCADA are a category of distributed control systems being used in many
industries. A SCADA system helps monitor and control a large number of distributed
events of interest. In SCADA systems, sensors are scattered at various geographic
locations to collect raw data (called events of interest). These data are then processed
and stored in a real-time database. The database models (or reflects) the current state of
the environment. The database is updated frequently to make it a realistic model of the
up-to-date state of the environment. An example of a SCADA application is an Energy
Management System (EMS).
An EMS helps to carry out load balancing in an electrical energy distribution
network. The EMS senses the energy consumption at the distribution points and
computes the load across different phases of power supply. It also helps dynamically
balance the load. Another example of a SCADA system is a system that monitors and
controls traffic in a computer network. Depending on the sensed load in different
segments of the network, the SCADA system makes the router change its traffic
routing policy dynamically. The time constraint in such a SCADA application is that
the sensors must sense the system state at regular intervals (say every few milliseconds)
and the same must be processed before the next state is sensed.
Medical Applications:
Robot Used in Recovery of Displaced Radioactive Material:
Radioactive materials such as Cobalt and Radium are used for
treatment of cancer. At times during treatment, the radioactive Cobalt (or
Radium) gets dislocated and falls down. Since human beings can not
come near a radioactive material, a robot is used to restore the
radioactive material to its proper position. The robot walks into the room
containing the radioactive material, picks it up, and restores it to its
proper position. The robot has to sense its environment frequently and
based on this information, plan its path. The real-time constraint on the
path planning task of the robot is that unless it plans the path fast enough
after an obstacle is detected, it may collide with it. The time constraints
involved here are of the order of a few milliseconds.
Peripheral equipments:
Laser Printer,digital copiers, fax machines, digital cameras, and scanners.
Automotive and Transportation:
Automotive engine control systems, road traffic signal control, air-traffic
control, high-speed train control, car navigation systems, Multi-Point Fuel Injection
(MPFI) System
Telecommunication Applications :
A Cellular System, video conferencing, and cable modems.
Aerospace:
Avionics, flight simulation, airline cabin management systems, satellite
tracking systems, and computer on-board an aircraft.
Internet and Multimedia Applications:
Video conferencing and multimedia multicast, Internet routers and switches.
Consumer Electronics :
Set-top boxes, audio equipment, Internet telephony, microwave ovens,
intelligent washing machines, home security systems, air conditioning and
refrigeration, toys, and cell phones.
Defense Applications :
Missile guidance systems, anti- missile systems, satellite-based surveillance
systems.
Miscellaneous Applications :
Railway Reservation System
Model of a Real-Time System:
Kernel Architecture
Application
System Calls
File Systems / Device
Drivers
Processor,
Peripherals, Memory.
Process Control
- Scheduler, Memory
Management, Inter
Communication
Task Scheduling
A Task can be one of three states:
Running
Ready
Waiting
Ready
Running Waiting
Running State:
When the task is being executed by the processor, it is said to be
in the running state.
Ready state:
If it is waiting in a queue for the processor to execute it.
Waiting State:
If the task is waiting for an external event to occur, it is said to be
in waiting state.
Task scheduler:
The task scheduler keeps track of the state of each task and
decides which task to run, based on the priority assigned to the tasks.
Depending on how the task scheduler works, operating systems
are divided into Two categories:
Preemptive operating systems – Low priority task is stopped
and a high priority task is executed.
Non- Preemptive operating systems – Low priority task
continues to run even if a high – priority task is ready.
Each task is assigned a task ID, a context, a task state and a priority.
The task scheduler decides which task to run based on this information .
The four algorithms available to schedule the task are:
First In First Out (FIFO) -
Shortest Job first
Round – robin
Priority – based scheduling
The process of changing from one state to another is carried out
by the
Context Switch, which is implemented in the assembly language.
Task Synchronization
Various tasks in an embedded system need to communicate
with one another and share data, a process known as Task
Synchronization.
Mutex – Mutual exclusion – ensuring that
different task do not execute the same portion of the code at
the same time.
Semaphore -- When a task is executing in the
Kernel, it sets a flag and until this flag is cleared , other task
have to wait, and this task can not be interrupted. This flag is
called a semaphore.
Timers
To provide the real time capability to the operating system, the developer
should include various timing functions, such as
Locking the task in the memory for a specific duration
Swapping out a task to enable another task to execute.
To control the timing the clock interrupt handler is provided, whose
functions includes the following,
• Keeping track of the system time
• Controlling the task scheduling
• Restarting the various clocks
• Sending signals to the task based on the timing considerations
• Providing statistical information , such as time taken for different
tasks
• Providing execution profiles, which indicate the amount of time taken
by the task and the individual function calls within a program.
In embedded operating systems, clocks keep track of various times, such as,
When to poll a device to obtain the data
When to interrupt a task
Depending on the functionalities embedded operating systems divided
into
1. Soft real time operating system – if you use simple round robin algo,
can not implement soft real time functionality.
2. Hard real time operating system – if you implement priority with
semaphores, you can implement hard real time systems.
Types of Embedded Operating Systems
Non real time embedded operating systems: These operating systems do
not provide hard real time functionality. In other words, if strict deadlines are to be met,
these operating systems are not suitable.
Systems calls are provided for process management, memory management, and I/O
management for tasks that do not require real time response.
Real time operating system: These operating systems provide the necessary
system calls to achieve real time deadlines.
Mobile /handheld operating systems: Operating systems that are fine- tuned
to work mobile environments are known as Mobile /handheld operating systems. Many
real time operating systems can be used as Mobile /handheld operating systems.
Definitions for CAN Bus
Nominal Bit Rate: It is the number of bits per second transmitted in the absence of
resynchronization by an ideal transmitter.
Nominal Bit time = 1/ Nominal Bit rate
This divided into separate non- overlapping time segments, these segments are
1.Synchronization Segment – used to synchronize the various nodes on the bus. An edge is
expected to lie with in this segment.
2.Propagation Segment – used to compensate for the physical delay timers with in the delay
network.
Phase segment 1 and Phase segment 2: used to compensate for edge phase errors.
Sample point: Point of time at which the bus level is read and interpreted as the value of
that respective bit. (location is at the end of phase segment 1).
Information processing time: Time segment starting with the sample point reserved for
calculating the subsequent bit level.
Time12/07/21
Quantum: Fixed unit of time derived from the oscillator period.
Problem:
Bit Rate = 1 Mbps, CAN Clock = 10 Mhz , Delay in Driver = 30 nsec
Delay in Receiver = 50 nsec , Delay in Bus line = 220 nsec
Calculate :
1.Total propagation Delay 2. Time Quantum
3.Bit time 4. Oscillator tolerance
Sol: 1. Total propagation Delay = Delay in driver + delay in Receiver + bus delay
= 30 + 50 + 220 = 300 nsec
2. Time Quantum = 1/ clock = 1/10X 106 = 100 nsec
3. Total bit time = 1/ Bit rate = 1/ 1 Mbps = 1000 nsec
Total bit time in sec = 1000 nsec
Total bit time in time quantum = x
1 tq = 100 nsec
X tq = 1000 nsec
X = 1000/100 = 10 tq
12/07/21
Let us Assume,
Sync – seg = 1 tq
Propagation segment = y
Phase segment 1 = 1 tq
Phase Segment 2 = 2 tq ( should be > phase seg 1).
Total bit time = 1 tq + y tq + 1 tq + 2 tq = 10 tq
4 tq + y tq = 10 tq
y =6
Sample Point = Sync seg + propagation seg + phase seg 1
= 1 + 6 + 1 = 8 tq
= 8 tq /10 tq = .8 = 80%
Can Oscillator Tolerance:
Set by the requirement to remain synchronized between recessive to
dominant edges.
12/07/21
dF = F – Fn / Fn
Fn = Nominal clock frequency
F = Actual CAN clock frequency
Requirement 1 :
Sample the first bit after sending active error flag after a stuff error
dF = Min ( tp_seg1 , tp_seg2 )/ 2 X (13X T bit time – tp_seg2 )
Requirement 2:
Synchronize correctly in the stuffed part of the bit stream
dF < tsjw/ 2 X (10 X T bit time)
12/07/21