SlideShare a Scribd company logo
1 of 29
An RTOS is an OS for response time-controlled and event-
controlled processes. It is very essential for large scale embedded
systems.
RTOS occupy little space from 10 KB to 100KB The
main task of a RTOS is to manage the
resources of the computer such that a particular operation
executes in precisely the same amount of time every time it occur.
Hard Real time system: Failure to meet such a deadline
is considered to be a fatal fault and will lead to disastrous
consequences e.g. Response of the break system of a
speeding Train approaching a Red Signal to the stop
command must come before the train crosses the Red signal.
Soft Real time system : Failure to miss a Soft Deadline
is undesirable but a few misses does no serious harm like
occasional delay in an on line trading of stocks. However the
system’s overall performance becomes poorer and poorer as
more and more jobs starts missing the deadline.
The most important component of RTOS
is its kernel (Monolithic & Microkernel).
BSP or Board Support Package makes an
RTOS target-specific (It’s a processor
specific code onto (processor) which we
like to have our RTOS running).
8051, ARM7,ARM9, Intel
Xscale, AVR, Blackfin, C167, Coldfire,, MIPS, MSP430, PIC, PowerPC, R
8C, SHARC, ST6, SuperH, TLCS-47, TLCS-870, TLCS-900, Tricore, etc.
1. Task Management
2. Intertask Communication &
Synchronization
3. Dynamic Memory Allocation
4. Timers
5. Devices I/O Supervisor
An operating system generally consists of two parts:
kernel space (kernel mode) and user space (user mode).
Kernel is the smallest and central component of an
operating system.
Its services include managing memory and devices and
also to provide an interface for software applications to
use the resources.
Additional services such as managing protection of
programs and multitasking may be included depending
on architecture of operating system.
There are three broad categories of kernel models
available, namely:
Monolithic kernel
Microkernel
Exokernel
These are the embedded program that run on CPU.
It consist of :
 Sequentially executable program
 State information
Task states consists of
1. Idle
2. Ready
3. Running
4. Blocked
5. Deleted
Idle
Task is created and memory is allocated but it is not
scheduled by kernel.
Ready
Task is ready and scheduled by kernel but not running
Running state :
Task will be running it will need some input
Blocked state :
Execution of the codes terminates after saving the needed
parameter
Deleted state :
The task created the memory has been de allocated and
frees the memory.
 Direct call to an ISR
1. Process running at CPU is interrupted and ISR starts
executing
2. ISR sends a enter message to RTOS
3. ISR code can send into mailbox
4. When the ISR completes the execution it sends Exist
message to OS
1. RTOS first itself gets the hardware source call
2.Initiates the ISR for saving the processor
status.
3. ISR during execution can post 2 or more
outputs.
4. Message is send
5.Involves the one ISR function and two
processes
Multiprocessing :
 Ability of an operating system to have
multiple programs.
 In uniprocessor system this wont be
possible.
Multitasking :
 Ability of an operating system to have
multiple process in memory .
 Co-operative multitasking
Holds CPU as much time it needs for executing
 Preemptive multitasking
Ensures every task will get a chance for
processing
 Non- Preemptive multitasking
Process or task given can be executed until it
terminates
The scheduler keeps record of the state of each task
and selects from among them that are ready to
execute and allocates the CPU to one of them.
A scheduler helps to minimize CPU utilization
among different tasks in a multi-tasking program and
to minimize waiting time.
There are generally two types of schedulers: non-
preemptive and priority-based preemptive.
•Non-preemptive scheduling or cooperative multitasking requires the tasks
to cooperate with each other to explicitly give up control of the processor.
•When a task releases the control of the processor, the next most important
task that is ready to run will be executed.
•A task that is newly assigned with a higher priority will only gain control of
the processor when the current executing task voluntarily gives up the
control.
•Priority-based preemptive scheduling requires control of the
processor be given to the task of the highest priority at all
•time.
•In the event that makes a higher priority task ready to run,
the current task is immediately suspended and the control of
the processor is given to the higher priority task.
In RTOS, the OS copies a pointer to the
message, delivers the pointer to the message-receiver
task, and then deletes the copy of the pointer with
message-sender task.
Message Sender
Task
RAM
Message Receiver
Task
RTOS
msg_ptr
msg_ptr
Message Message
in RTOS
RTOS does it by a mechanism known as Pools.
Pools memory allocation mechanism allows application software to
allocate chunks of memory of 4 to 8 different buffer sizes per
pool.
Pools avoid external memory fragmentation, by not permitting a
buffer that is returned to the pool to be broken into smaller
buffers in the future.
20
Intertask communication involves sharing of data
among tasks through sharing of memory space,
transmission of data and etc.
Few of mechanisms available for executing intertask
communications includes:
Message queues
Pipes
Remote procedural calls (RPC)
 It is a variable or signal which provides
synchronization mechanism
 synchronization mechanism is required at the
entry and the exist of critical section .
 Two purposes:
Mutex- ensures the thread doesn’t access the
cirtical section at the same time .
Scheduling constraints –ensures the thread
operates at specific order.
 When the semaphore is used at the beginning
and the end of critical section in that case
only one section code can run then the
semaphore.
 A piece of code that access a shared resource
but that must not be used by one or more
thread at the same time
 Deadlock – two or more processes are waiting indefinitely for
an event that can be caused by only one of the waiting
processes
 Let S and Q be two semaphores initialized to 1
P0 P1
wait (S); wait (Q);
wait (Q); wait (S);
Starvation: indefinite blocking. A process may never
be removed from the semaphore queue in which it
is suspended
Consider the executions of four periodic threads: A, B, C, and D; two
resources : Q and V
Thread Priority Execution Sequence Arrival Time
 A 1 EQQQQE 0
 B 2 EE 2
 C 3 EVVE 2
 D 4 EEQVE 4
Where E is executing for one time unit, Q is accessing resource Q for one time
unit, V is accessing resource V for one time unit
 From the previous figure we can see that thread D has the
higher priority and finished the last one, this is the problem
of priority inversion ( the threads with medium priority
suspend the higher priority threads) .
 Priority Inheritance: Let the lower priority task use the
highest priority of the higher priority tasks it blocks. In this
way, the medium priority tasks can no longer preempt low
priority task , which has blocked the higher priority task.
 Linux
◦ Is Linux
◦ Runs on anything, even toasters
◦ Hardware support for anything
◦ Linux
◦ RTLinux
◦ RTAI
◦ RTEMS
◦ QNX
◦ VxWorks
◦ LynxOS

More Related Content

Similar to Rtos

embedded system CHAPTER four about design .pdf
embedded system CHAPTER four about design .pdfembedded system CHAPTER four about design .pdf
embedded system CHAPTER four about design .pdfabdulkerimaragaw936
 
Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)IJERD Editor
 
LM1 - Computer System Overview, system calls
LM1 - Computer System Overview, system callsLM1 - Computer System Overview, system calls
LM1 - Computer System Overview, system callsmanideepakc
 
REAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEMREAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEMprakrutijsh
 
Processor management
Processor managementProcessor management
Processor managementdev3993
 
RTOS Material hfffffffffffffffffffffffffffffffffffff
RTOS Material hfffffffffffffffffffffffffffffffffffffRTOS Material hfffffffffffffffffffffffffffffffffffff
RTOS Material hfffffffffffffffffffffffffffffffffffffadugnanegero
 
lecture 1 (Part 2) kernal and its categories
lecture 1 (Part 2) kernal and its categorieslecture 1 (Part 2) kernal and its categories
lecture 1 (Part 2) kernal and its categoriesWajeehaBaig
 
Unit 4 Real Time Operating System
Unit 4 Real Time Operating SystemUnit 4 Real Time Operating System
Unit 4 Real Time Operating SystemDr. Pankaj Zope
 
OVERVIEW OF RTOS
OVERVIEW OF RTOSOVERVIEW OF RTOS
OVERVIEW OF RTOStaruian
 
Real Time Operating Systems
Real Time Operating SystemsReal Time Operating Systems
Real Time Operating SystemsPawandeep Kaur
 
Operating system Interview Questions
Operating system Interview QuestionsOperating system Interview Questions
Operating system Interview QuestionsKuntal Bhowmick
 
Operating system Q/A
Operating system Q/AOperating system Q/A
Operating system Q/AAbdul Munam
 

Similar to Rtos (20)

embedded system CHAPTER four about design .pdf
embedded system CHAPTER four about design .pdfembedded system CHAPTER four about design .pdf
embedded system CHAPTER four about design .pdf
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 
Unit v
Unit vUnit v
Unit v
 
Mid1 Revision
Mid1  RevisionMid1  Revision
Mid1 Revision
 
Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)
 
Lab6 rtos
Lab6 rtosLab6 rtos
Lab6 rtos
 
LM1 - Computer System Overview, system calls
LM1 - Computer System Overview, system callsLM1 - Computer System Overview, system calls
LM1 - Computer System Overview, system calls
 
REAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEMREAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEM
 
Processor management
Processor managementProcessor management
Processor management
 
RTOS Material hfffffffffffffffffffffffffffffffffffff
RTOS Material hfffffffffffffffffffffffffffffffffffffRTOS Material hfffffffffffffffffffffffffffffffffffff
RTOS Material hfffffffffffffffffffffffffffffffffffff
 
lecture 1 (Part 2) kernal and its categories
lecture 1 (Part 2) kernal and its categorieslecture 1 (Part 2) kernal and its categories
lecture 1 (Part 2) kernal and its categories
 
Unit 4 Real Time Operating System
Unit 4 Real Time Operating SystemUnit 4 Real Time Operating System
Unit 4 Real Time Operating System
 
RTOS
RTOSRTOS
RTOS
 
OVERVIEW OF RTOS
OVERVIEW OF RTOSOVERVIEW OF RTOS
OVERVIEW OF RTOS
 
Real Time Operating Systems
Real Time Operating SystemsReal Time Operating Systems
Real Time Operating Systems
 
Operating system Interview Questions
Operating system Interview QuestionsOperating system Interview Questions
Operating system Interview Questions
 
Linux Internals - Interview essentials 4.0
Linux Internals - Interview essentials 4.0Linux Internals - Interview essentials 4.0
Linux Internals - Interview essentials 4.0
 
Operating system Q/A
Operating system Q/AOperating system Q/A
Operating system Q/A
 
Operating System.ppt
Operating System.pptOperating System.ppt
Operating System.ppt
 
Memory management
Memory managementMemory management
Memory management
 

Recently uploaded

MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 

Recently uploaded (20)

MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 

Rtos

  • 1.
  • 2. An RTOS is an OS for response time-controlled and event- controlled processes. It is very essential for large scale embedded systems. RTOS occupy little space from 10 KB to 100KB The main task of a RTOS is to manage the resources of the computer such that a particular operation executes in precisely the same amount of time every time it occur.
  • 3. Hard Real time system: Failure to meet such a deadline is considered to be a fatal fault and will lead to disastrous consequences e.g. Response of the break system of a speeding Train approaching a Red Signal to the stop command must come before the train crosses the Red signal. Soft Real time system : Failure to miss a Soft Deadline is undesirable but a few misses does no serious harm like occasional delay in an on line trading of stocks. However the system’s overall performance becomes poorer and poorer as more and more jobs starts missing the deadline.
  • 4. The most important component of RTOS is its kernel (Monolithic & Microkernel). BSP or Board Support Package makes an RTOS target-specific (It’s a processor specific code onto (processor) which we like to have our RTOS running). 8051, ARM7,ARM9, Intel Xscale, AVR, Blackfin, C167, Coldfire,, MIPS, MSP430, PIC, PowerPC, R 8C, SHARC, ST6, SuperH, TLCS-47, TLCS-870, TLCS-900, Tricore, etc.
  • 5. 1. Task Management 2. Intertask Communication & Synchronization 3. Dynamic Memory Allocation 4. Timers 5. Devices I/O Supervisor
  • 6. An operating system generally consists of two parts: kernel space (kernel mode) and user space (user mode). Kernel is the smallest and central component of an operating system. Its services include managing memory and devices and also to provide an interface for software applications to use the resources. Additional services such as managing protection of programs and multitasking may be included depending on architecture of operating system. There are three broad categories of kernel models available, namely: Monolithic kernel Microkernel Exokernel
  • 7. These are the embedded program that run on CPU. It consist of :  Sequentially executable program  State information Task states consists of 1. Idle 2. Ready 3. Running 4. Blocked 5. Deleted
  • 8. Idle Task is created and memory is allocated but it is not scheduled by kernel. Ready Task is ready and scheduled by kernel but not running Running state : Task will be running it will need some input Blocked state : Execution of the codes terminates after saving the needed parameter Deleted state : The task created the memory has been de allocated and frees the memory.
  • 9.  Direct call to an ISR
  • 10. 1. Process running at CPU is interrupted and ISR starts executing 2. ISR sends a enter message to RTOS 3. ISR code can send into mailbox 4. When the ISR completes the execution it sends Exist message to OS
  • 11.
  • 12. 1. RTOS first itself gets the hardware source call 2.Initiates the ISR for saving the processor status. 3. ISR during execution can post 2 or more outputs. 4. Message is send 5.Involves the one ISR function and two processes
  • 13. Multiprocessing :  Ability of an operating system to have multiple programs.  In uniprocessor system this wont be possible. Multitasking :  Ability of an operating system to have multiple process in memory .
  • 14.  Co-operative multitasking Holds CPU as much time it needs for executing  Preemptive multitasking Ensures every task will get a chance for processing  Non- Preemptive multitasking Process or task given can be executed until it terminates
  • 15. The scheduler keeps record of the state of each task and selects from among them that are ready to execute and allocates the CPU to one of them. A scheduler helps to minimize CPU utilization among different tasks in a multi-tasking program and to minimize waiting time. There are generally two types of schedulers: non- preemptive and priority-based preemptive.
  • 16. •Non-preemptive scheduling or cooperative multitasking requires the tasks to cooperate with each other to explicitly give up control of the processor. •When a task releases the control of the processor, the next most important task that is ready to run will be executed. •A task that is newly assigned with a higher priority will only gain control of the processor when the current executing task voluntarily gives up the control.
  • 17. •Priority-based preemptive scheduling requires control of the processor be given to the task of the highest priority at all •time. •In the event that makes a higher priority task ready to run, the current task is immediately suspended and the control of the processor is given to the higher priority task.
  • 18. In RTOS, the OS copies a pointer to the message, delivers the pointer to the message-receiver task, and then deletes the copy of the pointer with message-sender task. Message Sender Task RAM Message Receiver Task RTOS msg_ptr msg_ptr Message Message
  • 19. in RTOS RTOS does it by a mechanism known as Pools. Pools memory allocation mechanism allows application software to allocate chunks of memory of 4 to 8 different buffer sizes per pool. Pools avoid external memory fragmentation, by not permitting a buffer that is returned to the pool to be broken into smaller buffers in the future.
  • 20. 20 Intertask communication involves sharing of data among tasks through sharing of memory space, transmission of data and etc. Few of mechanisms available for executing intertask communications includes: Message queues Pipes Remote procedural calls (RPC)
  • 21.  It is a variable or signal which provides synchronization mechanism  synchronization mechanism is required at the entry and the exist of critical section .  Two purposes: Mutex- ensures the thread doesn’t access the cirtical section at the same time . Scheduling constraints –ensures the thread operates at specific order.
  • 22.  When the semaphore is used at the beginning and the end of critical section in that case only one section code can run then the semaphore.  A piece of code that access a shared resource but that must not be used by one or more thread at the same time
  • 23.  Deadlock – two or more processes are waiting indefinitely for an event that can be caused by only one of the waiting processes  Let S and Q be two semaphores initialized to 1 P0 P1 wait (S); wait (Q); wait (Q); wait (S); Starvation: indefinite blocking. A process may never be removed from the semaphore queue in which it is suspended
  • 24. Consider the executions of four periodic threads: A, B, C, and D; two resources : Q and V Thread Priority Execution Sequence Arrival Time  A 1 EQQQQE 0  B 2 EE 2  C 3 EVVE 2  D 4 EEQVE 4 Where E is executing for one time unit, Q is accessing resource Q for one time unit, V is accessing resource V for one time unit
  • 25.
  • 26.  From the previous figure we can see that thread D has the higher priority and finished the last one, this is the problem of priority inversion ( the threads with medium priority suspend the higher priority threads) .  Priority Inheritance: Let the lower priority task use the highest priority of the higher priority tasks it blocks. In this way, the medium priority tasks can no longer preempt low priority task , which has blocked the higher priority task.
  • 27.
  • 28.  Linux ◦ Is Linux ◦ Runs on anything, even toasters ◦ Hardware support for anything
  • 29. ◦ Linux ◦ RTLinux ◦ RTAI ◦ RTEMS ◦ QNX ◦ VxWorks ◦ LynxOS