Documente Academic
Documente Profesional
Documente Cultură
for
Embedded DSP Applications
By
P.S.Dey
Lecturer
Computer Science & Engg. Dept.
I.I.T. Kharagpur
2.
3.
4.
5.
zHard Deadline :
Embedded System
Key Features
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
These are special purpose computer systems built into a larger device .
Most of these are usually Non User Programmable.
These systems are produced in Bulk.
It is less costly because of Bulk Production.
The devices like M obile Phones usually work under severe power budget
constraints to enhance their Battery life.
All such systems are usually application specific hence g e ne ral p urp ose
p e rip he ral inte rface s are absent.
Any Embedded System should have less M emory Requirement.
Relocation facility of faulty Electronic Memory to some unused good
Memory block should exist.
Usually Hard Timing Constraints are associated for most of its
functions necessitating usage of Real Time System features.
In general, each & every Embedded System happens to be application
specific Uni-Processor system, which is built on a simple hardware
architecture platform.
2.
3.
4.
A.
B.
C.
D.
Overall Architecture - 1
1.
Monolithic
a) Uni _Prcessor and Single layered.
b) Operating System mostly runs in previliged mode.
c) All type of Service Requests are made by the User Processes through
dedicated System Calls.
d) Interrups are handled directly by the Kernel and Interrupt Handlers are not full
fledged processes.
e) Interrupt handlers cannot invoke / use most of the system services.
f) O.S. Schedulers are disabled during Handling of the Interrupt since it operates
at the Highest priority.
g) Useful for very small application specific systems, because of its simplicity
and very low processor and memory overhaead.
h) Applications , as a whole can also be run in the Supervisor mode by bnding it
with the O.S. code during Link Time. However this can make debugging very
very difficult.
i) Upgradation of individual software components is NOT POSSIBLE, without
replacing the old Operating System as a whole followed by reboting.
2. Layered :
a) Modular design where any O.S. Module is
dependent on the Modules lying in the layer
below it as well as it provides service to its
upper layer (s).
b) O.S. Interface as well as Interrupt Handling
are like Monolithic Systems.
c) Easier maintainability as well as
Upgradeability because of Layered
Organization.
Multi Programming
(State Diagram)
Ready Queue
of User Programs | |||
Dispatch / Schedule
(Predefined Policy)
Running
Finished
Peripheral
Operation
[ Interrupt #n]
Request for
Peripheral
Operation
(SVC)
M u l t ipr o g r a mmin g
Timin g D ia g r a m ( 3 Us er Pr o g r a ms )
P1
Running
P2
Ready
P3
Ready
T1
Peripheral Operation
Runnin
g
Ready
T2
Peripheral Operation
Running
T3
Time
M u l t i Pr o c es s in g I ( St a t e
D ia g r a m)
z Several User pr oc esses
z Several CPU / CPU Cores with Identical Func tionality.
ed
d/
e
l
u
d
Sche
Scheduled / Dispatched
Global
Ready Queue
Sch edu
led / Dis
pa
CPU / Core #1
CPU/ Core # J
tched
CPU/ Core #N
Peripheral Over
(H/W Interrupt) Peripheral
WAIT Queue
Peripheral Over
(H/W Interrupt)
Peripheral request
(SVC)
Multiprocessing - II
( Timing Diagram for 2 CPUs / 2 Cores )
P1
Running on CPU1
P2
Running on CPU2
P3
Ready
Doing I/O
Doing I/O
Exit
Running on CPU2
Time
Ready Queue
Of Processes
Time Out
( After Pre-fixed Interval)
Running
Request for
Peripheral / Wait for Event # 1
Request for
Peripheral / Wait for Event #n
Doing I/O
Running
P1
Ready
Running
Time Out
Running
Time Out
P2
Runnin
g
Ready
P3
T1
T2
Time Out
Doing I/O
T3
M u l t i Ta s k in g
( Sa l ien t F ea t u r es )
z Eliminates / Minimizes CPU waiting time / process in order to
give guaranteed response time to each user process lying in
the READY Queue.
z Eliminates need for multiple CPUs.
z Round Robin / Time shared scheduling of tasks/processes
to a single CPU . ( Co-Operative / Pre_Emptive).
z Each process is granted a prefixed Time Slice based on a
prefixed policy. After using CPU for that prefixed Time Period ,
the concerned process either voluntarily yields the CPU to other
processes [ Co-Operative] or is preempted through a internally
generated Timer Interrupt.
z Existence of a dedicated Hardware Interval Timer which is
initialized by the O.S. in addition to all the features of any Multi
programmed System is necessary.
Multi Threading
1. Thread is the basic Execution unit.
2. Threads share among themselves address space [ global
variables+ code], peripherals [ NOT CONCURRENTLY] .
3. Each thread has got its own set of Registers and Stack.
4. Sharing a CPU among several peer threads of the same
process OR among peer threads of different User
Processes in a Time Shared Fashion.
5. Whenever the currently running thread becomes BLOCKED /
goes to WAIT state some other thread is scheduled for
execution .
6. Multi Threading hence represents a very fine grain multi
tasking at the level of a very few instructions thereby
permitting FAST SWITCHING among them.
Ready Queue
of Threads ?
Time Out
( After Pre-fixed Interval)
Running
Request for
Peripheral / Wait for Event # 1
Request for
Peripheral / Wait for Event #n
Hyper Threading
1.
2.
3.
4.
H y per Th r ea d in g ( St a t e D ia g r a m)
z Several thr eads
z Several identical CPU Cores
CPU / Core #1
ed
/
d
e
l
u
d
e
TIMED
OUT
h
c
S
Scheduled / Dispatched
CPU/ Core # J
tch
Centralized O.S. & Some Global l Memor
Dispa y.
Ready Queue
Of THREADS ?
Sch edu
led / DisTIMED OUT
patched
CPU/ Core #N
TIMED OUT
Peripheral Over
(H/W Interrupt) Peripheral
WAIT Queue
Peripheral Over
(H/W Interrupt)
Peripheral request
(SVC)
Case Studies
A. Mars Pathfinder ( A Classic Case of
Priority Inversion).
B. Symbian Operating System used in
Mobile Phones.
Each of the Tasks carried out by the Space Craft was treated as a Thread with
pre-fixed static priority.
2.
VxWorks provides pre-emptive priority based scheduling of these threads.
3.
The Pathfinder contained an information bus which can be thought of as a
shared memory area used for passing information between its different
components.
4.
Access to this piece of shared memory was controlled by mutual exclusion locks
(Semaphores).
5.
A Bus Management task ran frequently with high priority to move certain kinds of
data in and out of this shared information Bus.
6.
Meteorological Data Gathering was a low priority thread while the communications
task having medium priority.
7.
If at any point of time , albeit infrequently, any of the lower priority threads holds
the shared information bus thereby forcing the high priority Bus Management
task to WAIT for more than a predefined period a time out signal from a watchdog
timer will cause system reset.
Solution : Allow the low priority thread currently using the BUS to INHERIT the
high priority of the Blocked process for the time being to prevent the
WATCHDOG TIMER to go off.
7.
2.
3.
4.
Symbian O.S.
[ Client Server Model ]
Symbian O.S.
[ Communication Architecture ]
References
1.
2.
3.
4.