Title: Real Time Operating System
1Real Time Operating System
- Tasks
- Widely independent operations, which should be
executed as simultaneously as possible - Operating System
- takes over the management and the coordination
of the tasks.
Task 1
Task 2
Task 3
- Real Time
- - reaction in time of incoming events as
fast as possible, - in best compliance with time
requirements
2Real Time Operating System
- Task Management
- Creation of task
- Terminatiation of tasks
- Scheduler examines, wheter waiting conditions
are fulfilled - Dispatcher decides which one of the waiting
tasks will be executed - Resource Management
- Memory -management
- I/O-management
- File management
- Protocole-Stacks, etc.
- Reliability
- Error-detection, -handling
- Security
- Access controle
- Object Protection
3Task Concept
- Task
- - Functional and structural unit of the operating
system - - Program with appropriate closed environment
- Task Control Block
- Information about state and priority of the task
- CPU and System Context
- Task States
- ready, running (busy), waiting, suspended
4Task states
ready
suspended
suspended the task doesnt take part on what is
goining on
running
readythe task is ready and waiting for the
assignment of the processor
running (busy)the code of the task is executed
waiting
waitingthe task is waiting for the occurrence
of an event
5Task Management
tasks are created
processor is available
Dispatcher
running(busy)
RTX166tinyat the beginning task 0 is excecuted,
it activates all needed further tasks
Waiting condition is fulffilled
Scheduler
6Task Management
- Scheduler provides the availability of the
tasks (regarding to the priority of the task) - Time slicing Maximum time, which is available
for the taskRound-Robin-Scheduling - preemptive
scheduling - Cooperative Scheduling Task is waiting for the
occurrance of an event - non preemptive Scheduling
- Dispatcherperforms the correct switching to the
provided task - SynchronisationInterprocess communication via
- Signals
- Semaphore
- Mailboxes
- Messages
7Task Interaction - Synchronisation
Asynchronous via Mailbox
Synchronous via Message Passing
8Real Time Operating System RTX166
RTX166 Full
- Task Switching
- Round Robin
- Cooperative
- 256 Tasks max.
- ? 128 task priorities
- signal passing
- message passing with mailbox system
- semaphores
"os_wait" function ? interrupt timeout
signal from task or interrupt message
from task or interrupt semaphore
9Real Time Operating System RTX166
RTX166 Tiny
- Task Switching
- Round Robin
- Cooperative
- 32 tasks max.
"os_wait" function ? interval timeout
signal from task or interrupt
10Real Time Operating System RTX166
Single Task Program
int counter void main (void) counter
0 while (1) / repeat forever /
counter / increment counter /
11Real Time Operating System RTX166
Round-Robin Task Switching
include ltrtx166t.hgt int counter0, counter1
/ global variables / os_create_task (1) /
Mark task 1 as "ready" / os_create_task (2) /
Mark task 2 as "ready" / void job0 (void)
_task_ 0 while (1) / Endless loop
/ counter0 / Increment counter 0
/ void job1 (void) _task_ 1 while (1)
/ Endless loop / counter1 /
Increment counter 1 /
Rtx_1
12Real Time Operating System RTX166
Cooperative Task Switching Wait for Timeout
include ltrtx166t.hgt int counter0,
counter1 void job0 (void) _task_ 0
os_create_task (1) while (1) counter0
/ Increment counter 0 / os_wait
(K_TMO, 3, 0) / Wait 3 timer ticks / void
job1 (void) _task_ 1 while (1) counter1
/ Increment counter 1 / os_wait
(K_TMO, 5, 0) / Wait 5 timer ticks /
Rtx_1
13Real Time Operating System RTX166
Cooperative Task Switching Wait for Signal
include ltrtx166t.hgt int counter0,
counter1 os_create_task (1) os_create_task
(2) void job0 (void) _task_ 0 while (1)
os_wait (K_TMO, 1000, 0)/ Wait 1000 timer
ticks (1s)/ if (counter0 0) / On
counter 0 overflow/ os_send_signal(1) /
Send signal to task 1/ void job1 (void)
_task_ 1 while (1) os_wait (K_SIG, 0,
0)/ Wait for signal no timeout /
counter1 / Increment counter 1
/
Rtx_1