Micromeritics - Fundamental and Derived Properties of Powders
REAL TIME OPERATING SYSTEM
1. RTOS
Real Time Operating System
By:
VIVEK. P.PATKAR.
PRAKRUTI. JOSHI.
An example of RTOS implementation on Renesas
automotive dashboard platform.
2. What is RTOS?
An RTOS is multitasking operating system for
the applications needing meeting of :
a) time deadlines and
b)functioning in real time constraints
5. Architecture of RTOS
An RTOS usually comprises only a kernel. For
more complex embedded systems, an RTOS
can be a combination of various modules,
including the kernel, networking protocol
stacks, and other components as illustrated
previously.
An operating system generally consists of two
parts: kernel space (kernel mode) and user
space (user mode).
6. Kernel
The kernel of an RTOS
provides an abstraction
layer between the
application software
and hardware.
This abstraction layer
comprises of six main
types of common
services provided by the
kernel to the
application software.
7. KERNEL
There are three broad categories of kernel models available
Monolithic Kernel
E.g.. Examples are Linux
and Windows
Microkernel
E.g. Examples are
AmigaOS and QNX
Exokernel
E.g.. library operating
systems (libOSes)
8. Classification Of RTOS
RTOS
Hard real time
Firm real time
Zero degree of
tolerance
Unacceptable
quality
reduction
E.g. Automobile engine
control system and anti
lock brake, video
transmission, each picture
frame and
audio must be transferred
at fixed rate.
Soft real time
Reduction in
quality
reduction is
acceptable.
E.g. a food processing
plant control system.
E.g. Mobile phone, digital
cameras and orchestra
playing robots.
9. Features Of RTOS
Task and
Multitask
Running
Scheduler
Timer
Function
Memory
Management
Dormant
Blocked
Ready
Pre emptive
Non Pre emptive
Inter Task
Communication
10. Task and Multitask
Context
Switch
E.g.20 MHz 68000 process
or task switch times are
roughly 20 microseconds.
In contrast, a
100 MHz ARM CPU
switches in less than 3
microseconds.
Advantages:
a)Can concentrate all the
talent at a particular task.
b)Debugging is simple.
c)Easy to understand.
11. Scheduler
Pre emptive Scheduler
It allows high priority task to
run first and move low
priority task which is in
running into ready state.
E.g. Solaris 2.0/SunOS
5.0, Windows NT, the Linux
kernel 2.6 and 3.x, AIX and
some BSD systems (NetBSD,
since version 5), Anroid.
Advantages:
High priority task executed
immediately.
Disadvantages:
Starvation.
12. Scheduler
Non Pre emptive
Scheduler
High priority task co
operate with low priority
task.
E.g. Windows3.1x, Mac
OS pre-9.
Advantages:
No starvation.
Easy to implement.
Disadvantages:
High priority task has to
wait for low priority task
to complete, thus, not
suitable for RTOS.
13. Timer Function
Task delay.
E.g. In μC/OS-II, for a task to delay itself:
OSTimeDly(ticks), where ticks is the number of
clock ticks from the timer;
OSTimeDlyHMSM(H,M,S,M), with Hours, Minutes,
Seconds, Microseconds.
Task alert.
E.g. µC/OS-II use system clock, Vx Works use
watchdog timers
14. Memory Management
Memory allocated for
each task.
Memory allocated for
each task control
block(TCB).
Size of queue.
Size of mailbox
Size of pipe
TCB
15. Inter task Communication
Event
Queue Mailbox
Pipe
Shared Data Protected
Disabling
Task Switch
Semaphore
Disabling
Interrupts
Mutex
Counting
Semaphore Semaphore
Priority Inversion
Spinlock
Semaphore
Dead Lock
16. Event
Event objects are used when task synchronization is required without resource
sharing. They allow one or more tasks to
keep waiting for a specified event to occur.
17. Queue
Queue :
E.g. AVR microcontroller, Linux 2.4; Windows
NT/XP/Vista, Mac OS X uses a multilevel feedback
queue, uses a Multilevel feedback queue.
mailbox:
E.g. TI SYS/BIOS v6.33 RTOS, Keil RTX.
Pipe:
E.g. QNX RTOS, SMX RTOS.
19. Binary Semaphore
Whenever it is set, shared data is free.
whenever it is reset shared data is busy.
Whenever a task access shared data it takes
semaphore and the semaphore flag is reset.
Whenever a task exit from shared data it releases
semaphore and the flag is reset.
In this way shared data is protected.
21. Counting Semaphore
It is semaphore in which value can be
incremented or decremented. it is unsigned
integer.
This semaphore can be taken multiple times.
Taking semaphore means decrementing the
integer.
Releasing the semaphore means incrementing
the integer.
23. Spin lock Semaphore
This semaphore will not make running task to
blocked immediately.
Spin lock is useful in following situation:
Suppose low priority task is running and only some
time is left for its completion.
Now high priority task wants to run
Now RTOS provides spin lock semaphore to the high
priority task and so it can spin for some time. During
that time low priority task is executed and by itself it
is moved into blocked state.
Now high priority task begins to run.
24. RTOS Design
Size of ISR:
If ISR is long, then there are two drawbacks:
Highest priority task is blocked for more time.
ISR is sensitive to error and so it is difficult to debug long
ISR.
Conclusion:
Size of ISR should be small.
25. RTOS Design
Number
of Task:
Advantages:
Can concentrate all talent at a particular task.
Debugging is simple.
Very easy to understand.
Disadvantages:
More memory needed because each task needs memory.
Speed is less because task switching needs more time.
Conclusion:
Number of tasks should be moderate.
26. RTOS Design
Avoid
creating and destroying task:
It is time consuming and thus speed becomes less.
Conclusion:
Must avoid this.
Task
structure:
Task designing should be such that task is blocked at the most
only one place.
27. RTOS Design
Keep time slicing off:
Task should not have equal priority.
Techniques
to save memory:
For each task provide stack memory, TCB etc. only as much
needed.
Limit RTOS services.
Do not use same function that does nearly same action.
28. RTOS Design
Techniques to save power:
Idle mode.
Power down mode.
Sleep mode.
Low power mode.
Standby mode.
29. RTOS Design
Encapsulate
hardware with task:
This type of task is known as sever task.
If hardware is having many tasks, then we must have
separate task to encapsulate the hardware.
This separate task is known as server task.
Whenever task has to access hardware, they give
message in the queue to the server task.
Then server task makes accessing the hardware in
proper manner.
30. Advantages
Run time facilities i.e. provision of kernel services.
Provision for interrupts.
Task can have priority.
This architecture can suspend low priority task
and make high priority task run immediately
when need arises.
Scalable.
Portable.
33. Applications
Web
server
Microwave oven
MRI(Magnetic Resonance Machine)
Aircraft control
Automotive applications:
a) automatic breaking systems.
b) fuel injection.
c) path tracking.