Embedded Operating System: Unit-I (4 HRS.)
Embedded Operating System: Unit-I (4 HRS.)
Unit-I
( 4 Hrs.)
Course Objective
• To Learn the Concepts of Embedded Systems
processors and Operating System
• Develop ability to use Embedded Operating
utilities in Embedded Linux
Content of Unit-I
• Reference Book :
– Embedded System : An Integrated Approach by
Lyla B. Das (Chapter 7 & 8)
• Operating Systems Concepts (Chapter 7)
• Real-Time Tasks (Chapter 8)
• Real-Time Systems (Chapter 8)
• Types of Real-Time Tasks (Chapter 8)
• Real-Time Operating Systems (Chapter 8)
Operating System Concepts (Chapter 7)
– To write programs that could run on any UNIX system, IEEE developed a
standard for UNIX, called POSIX
– in 1987, the author released a small clone of UNIX, called MINIX, for
educational purposes. Functionally, MINIX is very similar to UNIX, including
POSIX support
– IBM PC/AT came out in 1983 with the Intel 80286 CPU.
Operating System Concepts (Chapter 7)
• History of an Operating System :
– Bell Labs found they needed an operating system for their computer center
which at the time was running various batch jobs. The BESYS operating system
was created at Bell Labs to deal with these needs. (1957)
– 1969 Unix was developed.First edition of Unix released 11/03/1971.
– Two major versions of UNIX developed, System V, from AT&T, and BSD,
(Berkeley Software Distribution) from the University of California at Berkeley
(1977)
– To write programs that could run on any UNIX system, IEEE developed a standard
for UNIX, called POSIX
– in 1987, the author released a small clone of UNIX, called MINIX, for educational
purposes. Functionally, MINIX is very similar to UNIX, including POSIX support
– Linux system was developed on MINIX and originally supported various MINIX
features like MINIX file system
– IBM PC/AT came out in 1983 with the Intel 80286 CPU.
– In 1994 Red Hat Linux is introduced.
– IRIX 6.5 the fifth generation of SGI Unix is released July 6, 1998.
Operating System Concepts (Chapter 7)
• Component of an Operating System :
– Process Management
– Memory Management
– File Management
– I/O Management
– Network Management
Memory Management tasks
• All programs executed in RAM. OS keeps track
of RAM for allocation and de allocation.
P1 P2 P3
0 24 27 30
0 3 6 30
P4 P1 P3 P2
0 3 9 16 24
P1 P3 P2 P4
•
0 3 7 8 12 16
Average waiting time
= ( (0 – 0) + (8 – 2) + (7 – 4) + (12 – 5) )/4
= (0 + 6 + 3 + 7)/4 = 4
• Average turn-around time:
= ( (7 – 0) + (12 – 2) + (8 - 4) + (16 – 5))/4
= ( 7 + 10 + 4 + 11)/4 = 8
SJF (Pre-emptive and varied arrival)
SRTF
Process Arrival Time Burst Time
P1 0.0 7
P2 2.0 4
P3 4.0 1
P4 5.0 4
• SJF (preemptive, varied arrival times)
P1 P2 P3 P2 P4 P1
• Average
0 waiting
2 4
time 5 7 11 16
= ( [(0 – 0) + (11 - 2)] + [(2 – 2) + (5 – 4)] + (4 - 4) + (7 – 5) )/4
= 9 + 1 + 0 + 2)/4
=3
• Average turn-around time = (16 + 7 + 5 + 11)/4 = 9.75
Priority Sceduling
• A priority number (integer) is associated with each process
• The CPU is allocated to the process with the highest priority
(smallest integer highest priority)
– Preemptive
– nonpreemptive
• SJF is a priority scheduling where priority is the predicted next
CPU burst time
• Problem Starvation – low priority processes may never
execute
• Solution Aging – as time progresses increase the priority of
the process
Round Robin
Process Burst Time
P1 53
P2 17
P3 68
P4 24
•
P1 P2 P3 P4 P1 P3 P4 P1 P3 P3
• Typically,
0 higher
20 average
37 turnaround
57 77 than97 SJF,117 121 134
but better 154
response time162
• Average waiting time
= ( [(0 – 0) + (77 - 20) + (121 – 97)] + (20 – 0) + [(37 – 0) + (97 - 57) + (134 – 117)] + [(57 –
0) + (117 – 77)] ) / 4
= (0 + 57 + 24) + 20 + (37 + 40 + 17) + (57 + 40) ) / 4
= (81 + 20 + 94 + 97)/4
= 292 / 4 = 73
• Average turn-around time = 134 + 37 + 162 + 121) / 4 = 113.5
Operating System Concepts (Chapter 7)
• Threads
• Interrupt Handling
• Inter-Process Communication
– Shared Memory
– Message Passing
– Message Pipes
– Mailboxes
– Transfer Protocol
• Blocking Sender, Blocking Receiver
• Non-blocking sender, Blocking Receiver
– Producer Consumer Paradigm
– Remote Procedure Call
Processing Environment
• Program is an executable file stored in disk.
• Example?
Interrupts
• Interrupts are associated with delay called
interrupt latency.
• Sequence of actions that follows an interrupt
– Saving the current Context
– Determining the identity of the interrupt
– Switching to the new context
– Starting the execution of the Interrupt handler.
Interrupts and Process Switching
• Process switching is accomplished by soft
interrupts
• Total task switching latency = interrupt
latency+ dispatch latency
Computation speed-up
Modularity
Convenience
IPC
• Cooperating processes need interprocess
communication (IPC)
• Two models of IPC
– Shared memory
– Message passing
IPC
• Client
• Server
• Endpoint
Deadlocks
• What is deadlock?
• What are the conditions necessary to consider
a deadlock?
• What are the methods available to handle it?
Condition for deadlock
• Mutual exclusion: Resource cannot be shared.
(Resource is occupied in mutually exclusive way)
• Hold and Wait: A condition where a process is
holding a resource but require more resource
to continue with its execution
• No Pre emption: Resource cannot be forcibly
taken away by OS.
• Circular Wait: Circular queue of waiting task.
What can be done about deadlock
• Ignore deadlock
• Avoidance
• Prevention