Upload
venkat7186
View
217
Download
0
Embed Size (px)
Citation preview
7/28/2019 EMBEDDED SYSTEMS.pptx
1/27
EMBEDDED SYSTEMS
UNIT IV
by
Venkatesan NLect. | CSE | KITE
7/28/2019 EMBEDDED SYSTEMS.pptx
2/27
Introduction
What is RTOS?
A Real-Time Operating System (RTOS) is a
computing environment that reacts to input
within a specific time period
Purpose?
To handle the Deadline Time Constraints
7/28/2019 EMBEDDED SYSTEMS.pptx
3/27
Process, Tasks, Thread
A process is an instance of a computer
program that is being executed
Ex:
-This can be anything from a small background
task, such as a spell-checker or system events
handler to a full-blown application like
Internet Explorer or Microsoft Word.
7/28/2019 EMBEDDED SYSTEMS.pptx
4/27
TASK
a task is a basic unit of programming that an
operating system control
Depending on how the operating system defines a
task in its design, this unit of programming may be
an entire program or each successive invocation of
a program
THREADS
A thread is a single sequence stream within in a
process
they are sometimes called lightweight processes
7/28/2019 EMBEDDED SYSTEMS.pptx
5/27
Processes Vs Threads Similarities
Like processes threads share CPU and only one thread
active (running) at a time. Like processes, threads within a processes, threads within
a processes execute sequentially.
Like processes, thread can create children.
And like process, if one thread is blocked, another thread
can run Differences
Unlike processes, threads are not independent of oneanother.
Unlike processes, all threads can access every address in
the task . Unlike processes, thread are design to assist one other.
Note that processes might or might not assist one anotherbecause processes may originate from different users.
7/28/2019 EMBEDDED SYSTEMS.pptx
6/27
Process
Thread
Threads and Processes
Process
Code
DataChild Processes
Resource List
Critical
region
int main(){
int input;
cout input;
cout
7/28/2019 EMBEDDED SYSTEMS.pptx
7/27
ISRs in RTOS ISRs have the higher priorities over the RTOS
functions and the tasks.
An ISR should not wait for a semaphore,
mailbox, message or queue message
An ISR should not also wait for mutex else ithas to wait for other critical section code to
finish before the critical codes in the ISR can
run.
7/28/2019 EMBEDDED SYSTEMS.pptx
8/27
Three alternative ways systems to respond
to hardware source calls from the interrupts
- Direct Call to an ISR by interrupting
- Event Message (IPC) from the ISEvent ISR
Direct Call to an ISR and ISR Enter Direct Enter
message
7/28/2019 EMBEDDED SYSTEMS.pptx
9/27
Operating System Services Goals
Facilitating easy sharing of resources as perschedule and allocations
Facilitating easy implementation
Optimally scheduling the process Maximizing the system performance to let
difference processes
Providing management functions
Management and organization functions for files
and files like devices
7/28/2019 EMBEDDED SYSTEMS.pptx
10/27
Providing easy interfacing and management
functions for the network protocols
Providing portability for hardwareconfigurations
Providing interoperability of applications on
different networks Providing a common set of interfaces that
integrates various applications and open
systems
7/28/2019 EMBEDDED SYSTEMS.pptx
11/27
Structure of RTOS
Top-down Layers Application software
Application Program Interface
System software other than the one providedat the OS
Hardware-OS Interface Hardware
7/28/2019 EMBEDDED SYSTEMS.pptx
12/27
Generally OS runs in two modes
USER Mode(The user process is permitted to run
and use only a subset of functions)
Supervisory Mode(The OS runs the privileged
functions and instructions in a protected mode)
7/28/2019 EMBEDDED SYSTEMS.pptx
13/27
Kernel
The OS includes certain structural units.
Kernel is also one of the structural unit
It is the secured unit of an OS
It operates under the supervisory mode
But the application software operates in the user
mode
7/28/2019 EMBEDDED SYSTEMS.pptx
14/27
Kernel Services in OS
Process Management Process Creation
Management of the created process(creation,activation, running, blocking, resumption,
deactivation, deletion) Memory Management
Memory Allocation
Memory Management after initial allocation
Managing Strategy(Fixed blocks, Dynamic Blocks,Dynamic page, Data Memory Allocation, Addressrelocation, Multiprocessor Memory Allocation)
7/28/2019 EMBEDDED SYSTEMS.pptx
15/27
Device Management
It manages physical as well as virtual devices likepipes and sockets
Device mgmt. has three approaches to 3 types ofdrivers Programmed I/Os by polling
Interrupts from the device drivers ISR
DMA operation
It has certain functions like Device detection,addtion, deletion, allocation, registration,detaching, deregistration, queue,etc
7/28/2019 EMBEDDED SYSTEMS.pptx
16/27
OS command functions for a device
Create and open
Write Read
Ioctl(Configuring the device to operate at
particular baud rate) Close and delete
7/28/2019 EMBEDDED SYSTEMS.pptx
17/27
File System organisation and
implementation
A file is a named entity on a magnetic disc, opticaldisk or system memory
It may be a named entity or a structured recordor an unstructured record of bits
It uses set of command functions in POSIX filesystem Open
Write
Read
Lseek
close
7/28/2019 EMBEDDED SYSTEMS.pptx
18/27
I/O Subsystems
They are the subsystems of OS device
management systems
It is used for the drivers to communicate with
many devices which is present in the system
7/28/2019 EMBEDDED SYSTEMS.pptx
19/27
Interrupt Routines Handling in RTOS
There are three ways to call the services on
interrupting
Direct call to ISR By an Interrupting Source
Direct call to RTOS by an Interrupting Source and
Temporary Suspension of a Scheduled Task
Direct call to RTOS by an Interrupting Source and
Scheduling of Tasks as well as ISRs by the RTOS
7/28/2019 EMBEDDED SYSTEMS.pptx
20/27
RTOS Task Scheduling Models
Control Flow Strategy
Data Flow Strategy
Control -Data Flow Strategy
7/28/2019 EMBEDDED SYSTEMS.pptx
21/27
Scheduling Models used by RTOS
Schedulers
Cyclic cooperative scheduling of ready tasks in acircular queue.
Cooperative scheduling with precedence constraints
Cyclic cooperative scheduling with time slicing
Preemptive scheduling Fixed times scheduling
Scheduling of Periodic, Sporadic and aperiodic tasks
Dynamic Real Time Scheduling using Earliest Deadline
First(EDF) precedence Advanced scheduling algorithms using the probabilistic
timed petri nets or multi thread graphs.
Th C ti R d R bi
7/28/2019 EMBEDDED SYSTEMS.pptx
22/27
The Cooperative Round Robin
Scheduling Using a circular queue of
Ready Tasks RTOS inserts a list of ready tasks for sequentialexecution
Program counter changes whenever the CPU
starts executing another process
Worst case latency is same for each task
It is calculated by summing up detection time,switching time, execution time
Cooperative scheduling with
7/28/2019 EMBEDDED SYSTEMS.pptx
23/27
Cooperative scheduling with
precedence constraints
In the first layer ISR has set of short codes thathave to be executed immediately
Its sends a flag or token and its priority
parameter for the task to be initiated
7/28/2019 EMBEDDED SYSTEMS.pptx
24/27
Cyclic cooperative scheduling with time slicing(Rate
Monotonic Cooperative Scheduling)
The RTOS defines a time slice for each task to
finish
If the process is not executed within the time
then it is executed in the next cycle
7/28/2019 EMBEDDED SYSTEMS.pptx
25/27
Preemptive scheduling
In the cooperative scheduling the low priority
job is executed for long time and thus making
a high priority job to wait for execution
Preemptive scheduling lets a pending high-
priority job take resources away from a
running job of lower priority.
7/28/2019 EMBEDDED SYSTEMS.pptx
26/27
Critical section service by a preemptive
scheduler
The blocking of a lower priority process for
executing high priority process should not be
done in critical situations
It creates tasks and
7/28/2019 EMBEDDED SYSTEMS.pptx
27/27