mcet.jpg
Unit 4
Operating Systems
Embedded for Mechatronics
Dr.Mahalingam College of Engg & Tech
2020
Embedded for Mechatronics Unit 4
mcet.jpg
Operating Systems
An embedded operating system is simply an operating sys-
tem designed for embedded systems
The embedded operating system comes into existence be-
cause we have a very limited amount of hardware like RAM,
ROM, timer-counters and other on-chip peripherals.
For instance, all mobile phones essentially consist of an op-
erating system that always boots up when the mobile phone
is in running condition.
Embedded operating systems runs on embedded proces-
sors.
Embedded for Mechatronics Unit 4
mcet.jpg
Examples of Embedded OS
Examples of Embedded OS
Raspian & Noobs used in Rasberry Pi
Symbian: It was used in mobile phones mainly in Nokia for
many years
BlackBerry Operating System: It is particularly used in
BlackBerry Phones
Embedded Linux: It is used in Android phones and other
devices like printers
IOS: It is used in Apple phones
Embedded for Mechatronics Unit 4
mcet.jpg
Embedded vs. Non-Embedded
Embedded vs. Non-Embedded
Embedded Os has very limited features and memory as it is
designed for some specific purpose but crucial to device op-
eration.For instance Raspberry pi os can be boot-ted from
SD card.
Non Embedded Os like windows are designed for general
purpose and usually occupies large amount of memory
Embedded for Mechatronics Unit 4
mcet.jpg
Kernel
Embedded for Mechatronics Unit 4
mcet.jpg
Kernel
Kernel
A kernel is the core component of an operating system
It also acts like a bridge between application and hardware
of the computer
It is one of the first programs loaded on start-up (after the
Bootloader).
When an operating system is loaded into memory, the ker-
nel loads first and remains in memory until the operating
system is shut down again
The kernel is responsible for low-level tasks such as disk
management, task management and memory manage-
ment.
Embedded for Mechatronics Unit 4
mcet.jpg
Process Vs Thread
Process
Process means any program is in execution.
A process can creates other processes which are known
as Child Processes.
Process takes more time to terminate and it is isolated
means it does not share memory with any other process.
Thread
A thread is a path of execution within a process. A process
can contain multiple threads
Thread takes less time to terminate as compared to
process and like process threads do not isolate
Embedded for Mechatronics Unit 4
mcet.jpg
Difference between Process & Thread
Embedded for Mechatronics Unit 4
mcet.jpg
Context switching
Context switching
A context switch is a procedure that a computer’s CPU (cen-
tral processing unit) follows to change from one task (or pro-
cess) to another while ensuring that the tasks do not con-
flict.
Switching of CPU to another process means saving the
state of old process and loading saved state for new pro-
cess.
In Context Switching the process is stored in the Process
Control Block to serve the new process,so that old process
can be resumed from the same part it was left. modern
CPU can perform hundreds of context switches per second.
Therefore, the user gets the impression that the computer
is performing multiple tasks in a parallel fashion
Embedded for Mechatronics Unit 4
mcet.jpg
Context switching
Embedded for Mechatronics Unit 4
mcet.jpg
Scheduling
Scheduling
CPU Scheduling is a process of determining which process
to execute while another process is on hold
There are a number of processes that are to be executed
in an operating system. The operating system cannot make
one process to start only after the previous process has
finished its execution, since a process can take indefinite
time to complete its execution.
For example, a process might be waiting for an input/output
operation to get completed. As the process is waiting and is
in an idle state, it uses none of the processing power. This
idle time of the processor can be utilized by running other
process that is ready to run.
Embedded for Mechatronics Unit 4
mcet.jpg
Different time with respect to a scheduling process.
Time
Arrival Time: Time at which the process arrives in the ready
queue.
Completion Time: Time at which process completes its
execution.
Burst Time: Time required by a process for CPU execution.
Turn Around Time: Time Difference between completion time
and arrival time.
Turn Around Time = Completion Time – Arrival Time
Waiting Time(W.T): Time Difference between turn around time
and burst time.
Waiting Time = Turn Around Time – Burst Time
Embedded for Mechatronics Unit 4
mcet.jpg
Types of CPU Scheduling
Preemptive Scheduling
In Preemptive Scheduling, the tasks are mostly assigned with
their priorities. Sometimes it is important to run a task with
a higher priority before another lower priority task, even if the
lower priority task is still running. The lower priority task holds
for some time and resumes when the higher priority task finishes
its execution
Non-Preemptive Scheduling
In this type of scheduling method, the CPU has been allocated
to a specific process. The process that keeps the CPU busy will
release the CPU either by switching context or terminating. It is
the only method that can be used for various hardware
platforms. That’s because it doesn’t need special hardware (for
example, a timer) like preemptive scheduling.
Embedded for Mechatronics Unit 4
mcet.jpg
Types of CPU scheduling Algorithm
First Come First Serve
Shortest Remaining Time
Round-Robin Scheduling
Priority Based Scheduling
Embedded for Mechatronics Unit 4
mcet.jpg
Inter Process Communication(IPC)
Inter Process Communication
Inter process communication (IPC) is used for exchanging data
between multiple threads in one or more processes or programs.
The Processes may be running on single or multiple computers
connected by a network. A process can be of two type:
Independent process.(Not affected by the execution of other
processes)
Co-operating process.(Affected by other executing pro-
cesses)
Embedded for Mechatronics Unit 4
mcet.jpg
Real time memory management
Real time memory management
Memory management is the process of controlling and
coordinating computer memory, assigning portions called
blocks
The memory management function keeps track of the sta-
tus of each memory location, either allocated or free
It determines how memory is allocated among competing
processes, deciding which gets memory, when they receive
it, and how much they are allowed.
Embedded for Mechatronics Unit 4
mcet.jpg
RTOs
Real time Operating systems
Suppose a person is driving a car on a highway at a speed
of 70 miles per hour. Now, somehow the car meets with an
accident. Fortunately the airbag deployed at the right time
and saved the life of the driver.So, we see that airbag is a
very good feature in a car which can save a life someday.
But, did we think what would have happened if the airbag
would have deployed a few seconds late? Yes, we would
have lost a life. So just imagine the dependency on the
accuracy of opening of the airbag.
So, what makes that airbag deploy at the right time? Well,
welcome to the world of RTOS.
A real-time operating system (RTOS) is an operating sys-
tem (OS) intended to serve real-time applications that pro-
cess data as it comes in, typically without buffer delays
Embedded for Mechatronics Unit 4

Embedded systems unit4

  • 1.
    mcet.jpg Unit 4 Operating Systems Embeddedfor Mechatronics Dr.Mahalingam College of Engg & Tech 2020 Embedded for Mechatronics Unit 4
  • 2.
    mcet.jpg Operating Systems An embeddedoperating system is simply an operating sys- tem designed for embedded systems The embedded operating system comes into existence be- cause we have a very limited amount of hardware like RAM, ROM, timer-counters and other on-chip peripherals. For instance, all mobile phones essentially consist of an op- erating system that always boots up when the mobile phone is in running condition. Embedded operating systems runs on embedded proces- sors. Embedded for Mechatronics Unit 4
  • 3.
    mcet.jpg Examples of EmbeddedOS Examples of Embedded OS Raspian & Noobs used in Rasberry Pi Symbian: It was used in mobile phones mainly in Nokia for many years BlackBerry Operating System: It is particularly used in BlackBerry Phones Embedded Linux: It is used in Android phones and other devices like printers IOS: It is used in Apple phones Embedded for Mechatronics Unit 4
  • 4.
    mcet.jpg Embedded vs. Non-Embedded Embeddedvs. Non-Embedded Embedded Os has very limited features and memory as it is designed for some specific purpose but crucial to device op- eration.For instance Raspberry pi os can be boot-ted from SD card. Non Embedded Os like windows are designed for general purpose and usually occupies large amount of memory Embedded for Mechatronics Unit 4
  • 5.
  • 6.
    mcet.jpg Kernel Kernel A kernel isthe core component of an operating system It also acts like a bridge between application and hardware of the computer It is one of the first programs loaded on start-up (after the Bootloader). When an operating system is loaded into memory, the ker- nel loads first and remains in memory until the operating system is shut down again The kernel is responsible for low-level tasks such as disk management, task management and memory manage- ment. Embedded for Mechatronics Unit 4
  • 7.
    mcet.jpg Process Vs Thread Process Processmeans any program is in execution. A process can creates other processes which are known as Child Processes. Process takes more time to terminate and it is isolated means it does not share memory with any other process. Thread A thread is a path of execution within a process. A process can contain multiple threads Thread takes less time to terminate as compared to process and like process threads do not isolate Embedded for Mechatronics Unit 4
  • 8.
    mcet.jpg Difference between Process& Thread Embedded for Mechatronics Unit 4
  • 9.
    mcet.jpg Context switching Context switching Acontext switch is a procedure that a computer’s CPU (cen- tral processing unit) follows to change from one task (or pro- cess) to another while ensuring that the tasks do not con- flict. Switching of CPU to another process means saving the state of old process and loading saved state for new pro- cess. In Context Switching the process is stored in the Process Control Block to serve the new process,so that old process can be resumed from the same part it was left. modern CPU can perform hundreds of context switches per second. Therefore, the user gets the impression that the computer is performing multiple tasks in a parallel fashion Embedded for Mechatronics Unit 4
  • 10.
  • 11.
    mcet.jpg Scheduling Scheduling CPU Scheduling isa process of determining which process to execute while another process is on hold There are a number of processes that are to be executed in an operating system. The operating system cannot make one process to start only after the previous process has finished its execution, since a process can take indefinite time to complete its execution. For example, a process might be waiting for an input/output operation to get completed. As the process is waiting and is in an idle state, it uses none of the processing power. This idle time of the processor can be utilized by running other process that is ready to run. Embedded for Mechatronics Unit 4
  • 12.
    mcet.jpg Different time withrespect to a scheduling process. Time Arrival Time: Time at which the process arrives in the ready queue. Completion Time: Time at which process completes its execution. Burst Time: Time required by a process for CPU execution. Turn Around Time: Time Difference between completion time and arrival time. Turn Around Time = Completion Time – Arrival Time Waiting Time(W.T): Time Difference between turn around time and burst time. Waiting Time = Turn Around Time – Burst Time Embedded for Mechatronics Unit 4
  • 13.
    mcet.jpg Types of CPUScheduling Preemptive Scheduling In Preemptive Scheduling, the tasks are mostly assigned with their priorities. Sometimes it is important to run a task with a higher priority before another lower priority task, even if the lower priority task is still running. The lower priority task holds for some time and resumes when the higher priority task finishes its execution Non-Preemptive Scheduling In this type of scheduling method, the CPU has been allocated to a specific process. The process that keeps the CPU busy will release the CPU either by switching context or terminating. It is the only method that can be used for various hardware platforms. That’s because it doesn’t need special hardware (for example, a timer) like preemptive scheduling. Embedded for Mechatronics Unit 4
  • 14.
    mcet.jpg Types of CPUscheduling Algorithm First Come First Serve Shortest Remaining Time Round-Robin Scheduling Priority Based Scheduling Embedded for Mechatronics Unit 4
  • 15.
    mcet.jpg Inter Process Communication(IPC) InterProcess Communication Inter process communication (IPC) is used for exchanging data between multiple threads in one or more processes or programs. The Processes may be running on single or multiple computers connected by a network. A process can be of two type: Independent process.(Not affected by the execution of other processes) Co-operating process.(Affected by other executing pro- cesses) Embedded for Mechatronics Unit 4
  • 16.
    mcet.jpg Real time memorymanagement Real time memory management Memory management is the process of controlling and coordinating computer memory, assigning portions called blocks The memory management function keeps track of the sta- tus of each memory location, either allocated or free It determines how memory is allocated among competing processes, deciding which gets memory, when they receive it, and how much they are allowed. Embedded for Mechatronics Unit 4
  • 17.
    mcet.jpg RTOs Real time Operatingsystems Suppose a person is driving a car on a highway at a speed of 70 miles per hour. Now, somehow the car meets with an accident. Fortunately the airbag deployed at the right time and saved the life of the driver.So, we see that airbag is a very good feature in a car which can save a life someday. But, did we think what would have happened if the airbag would have deployed a few seconds late? Yes, we would have lost a life. So just imagine the dependency on the accuracy of opening of the airbag. So, what makes that airbag deploy at the right time? Well, welcome to the world of RTOS. A real-time operating system (RTOS) is an operating sys- tem (OS) intended to serve real-time applications that pro- cess data as it comes in, typically without buffer delays Embedded for Mechatronics Unit 4