SlideShare uma empresa Scribd logo
1 de 29
MicroC/OS-II
TOPIWALA MOHIT N.
VLSI DESIGN-1581210018
SRM UNIVERSITY,
CHENNAI
S
O
T
R
MicroC/OS-II (commonly termed as µC/OS-
II or uC/OS-II), is the acronym for Micro-Controller
Operating Systems Version 2.
It is a priority-based real-time multitasking operating
system kernel for microprocessors, written mainly in the
C programming language.
It is intended for use in embedded systems.
INTRODUCTION
9/29/2013 RTOS Mucos
It is a very small real-time kernel.
Memory footprint is about 20KB for a fully functional
kernel.
Source code is written mostly in ANSI C.
Highly portable, ROMable, very scalable, preemptive real-
time, deterministic, multitasking kernel.
It can manage up to 64 tasks (56 user tasks available).
It has connectivity with μC/GUI and μC/FS (GUI and File
Systems for μC/OS II).
Features of MicroC/OS-II :
9/29/2013 RTOS Mucos
It is ported to more than 100 microprocessors and
microcontrollers.
It is simple to use and simple to implement but very
effective compared to the price/performance ratio.
It supports all type of processors from 8-bit to 64-bit.
Cont…
9/29/2013 RTOS Mucos
µC/OS-II is a multitasking operating system. Each task is
an infinite loop and can be in any one of the following five
states:
 Dormant
 Ready
 Running
 Waiting
 ISR (Interrupt Service Routine)
Task states:
9/29/2013 RTOS Mucos
 Task Feature
 Task Creation
 Task Stack & Stack Checking
 Task Deletion
 Change a Task’s Priority
 Suspend and Resume a Task
 Get Information about a Task
Task Management (Services):
9/29/2013 RTOS Mucos
 μC/OS-II can manage up to 64 tasks.
The four highest priority tasks and the four lowest priority
tasks are reserved for its own use. This leaves 56 tasks for
applications.
The lower the value of the priority, the higher the priority
of the task. (Something on the lines of Rate Monotonic
Scheduling).
The task priority number also serves as the task identifier.
Task Feature :
9/29/2013 RTOS Mucos
Rate Monotonic Scheduling :
 In Rate Monotonic Scheduling tasks with the highest rate of
execution are given the highest priority
Assumptions:
 All tasks are periodic
 Tasks do not synchronize with one another, share resources, etc.
 Preemptive scheduling is used (always runs the highest priority
task that is ready)
 Under these assumptions, let n be the number of tasks, Ei be the
execution time of task i, and Ti be the period of task i. Then, all
deadlines will be met if the following inequality is satisfied:
ΣEi / Ti ≤ n(2^1/n – 1)
9/29/2013 RTOS Mucos
Rate Monotonic Scheduling :
Suppose we have 3 tasks. Task 1 runs at 100 Hz and takes 2
ms. Task 2 runs at 50 Hz and takes 1 ms. Task 3 runs at 66.7 Hz
and takes 7 ms. Apply RMS theory…
(2/10) + (1/20) + (7/15) = 0.717 ≤ 3(21/3 – 1) = 0.780
Thus, all the deadlines will be met
 General Solution?
 As n →∞, the right-hand side of the inequality goes to
ln(2)=0.6931. Thus, you should design your system to use less
than 60-70% of the CPU
9/29/2013 RTOS Mucos
PROCESS CYCLE :
9/29/2013 RTOS Mucos
There are two functions for creating a task:
OSTaskCreate()
 OSTaskCreateExt().
Task Creation :
9/29/2013 RTOS Mucos
Task Management :
9/29/2013 RTOS Mucos
Task Management :
After the task is created, the task has to get a stack in
which it will store its data.
 A stack must consist of contiguous memory locations.
 It is necessary to determine how much stack space a
task actually uses.
 Deleting a task means the task will be returned to its
dormant state and does not mean that the code for the
task will be deleted. The calling task can delete itself.
9/29/2013 RTOS Mucos
If another task tries to delete the current task, the
resources are not freed and thus are lost. So the task has to
delete itself after it uses its resources
Priority of the calling task or another task can be changed
at run time.
A task can suspend itself or another task, a suspended task
can resume itself.
A task can obtain information about itself or other tasks.
This information can be used to know what the task is doing
at a particular time.
Task Management (cont…):
9/29/2013 RTOS Mucos
The services of Memory management includes:
Initializing the Memory Manager.
Creating a Memory Partition.
Obtaining Status of a Memory Partition.
Obtaining a Memory Block.
Returning a Memory Block.
Waiting for Memory Blocks from a Memory Partition.
Memory Management :
9/29/2013 RTOS Mucos
Each memory partition consists of several fixed-sized memory
blocks.
A task obtains memory blocks from the memory partition. A
task must create a memory partition before it can be used.
Allocation and de-allocation of these fixed-sized memory
blocks is done in constant time and is deterministic.
Multiple memory partitions can exist, so a task can obtain
memory blocks of different sizes.
A specific memory block should be returned to its memory
partition from which it came.
Memory Management :
9/29/2013 RTOS Mucos
Clock Tick : A clock tick is a periodic time source to
keep track of time delays and time outs.
Here, tick intervals varies from 10 ~ 100 ms.
The faster the tick rate, the higher the overhead
imposed on the system.
Whenever a clock tick occurs μC/OS-II increments
a 32- bit counter, the counter starts at zero, and rolls
over to 4,294,967,295 (2^32-1) ticks.
A task can be delayed and a delayed task can also be
resumed.
Time Management :
9/29/2013 RTOS Mucos
It involves five services that includes:
OSTimeDLY()
OSTimeDLYHMSM()
OSTimeDlyResume()
OSTimeGet()
OSTimeSet()
Time Management :
9/29/2013 RTOS Mucos
Inter-task or inter process communication in μC/OS
takes place using:
Semaphores
Message mailbox
Message queues
Tasks and Interrupt service routines (ISR). They can
interact with each other through an ECB (event control
block).
Inter-Task Communication :
9/29/2013 RTOS Mucos
Inter-Task Communication :
Single task waiting
9/29/2013 RTOS Mucos
Inter-Task Communication :
Multiple tasks waiting and signaling
9/29/2013 RTOS Mucos
Inter-Task Communication :
Tasks can wait and signal along with an optional time out
9/29/2013 RTOS Mucos
Inter-Task Communication :
μC/OS-II semaphores consist of two elements
16-bit unsigned integer count
list of tasks waiting for semaphore
μC/OSII provides
Create, post, pend accept and query services
9/29/2013 RTOS Mucos
Inter-Task Communication :
μC/OS-II message-mailboxes: an μC/OSII object that allows
a task or ISR to send a pointer sized variable (pointing to a
message) to another task.
9/29/2013 RTOS Mucos
Inter-Task Communication :
 μC/OS-II message-queues
Available services: Create, Post (FIFO), PostFront (LIFO),
Pend, Accept, Query, Flush
 N = #of entries in the queue: Queue full if Post or
PostFront called N times before a Pend or Accept
9/29/2013 RTOS Mucos
Inter-Task Communication :
μC/OS-II message-queues organized as circular buffers.
9/29/2013 RTOS Mucos
Tasks running under a multitasking kernel should be written in one of two
ways:
1. A non-returning forever loop. For example:
void Task (void *)
{
DoInitStuff();
while (1)
{ do this;
do that;
do the other thing;
call OS service (); // e.g. OSTimeDelay, OSSemPend, etc.
}
}
Writing Applications Under μC/OS -II:
9/29/2013 RTOS Mucos
2. A task that deletes itself after running.
For example:
void Task (void *)
{ do this;
do that;
do the other thing;
call OS service (); // e.g. OSTimeDelay, OSSemPend, etc.
OSTaskDelete(); // Ask the OS to delete the task
}
9/29/2013 RTOS Mucos
9/29/2013 RTOS Mucos

Mais conteúdo relacionado

Mais procurados

INTERRUPT ROUTINES IN RTOS EN VIRONMENT HANDELING OF INTERRUPT SOURCE CALLS
INTERRUPT ROUTINES IN RTOS EN VIRONMENT HANDELING OF INTERRUPT SOURCE CALLSINTERRUPT ROUTINES IN RTOS EN VIRONMENT HANDELING OF INTERRUPT SOURCE CALLS
INTERRUPT ROUTINES IN RTOS EN VIRONMENT HANDELING OF INTERRUPT SOURCE CALLSJOLLUSUDARSHANREDDY
 
UNIT-I-RTOS and Concepts
UNIT-I-RTOS and ConceptsUNIT-I-RTOS and Concepts
UNIT-I-RTOS and ConceptsDr.YNM
 
Introduction to Embedded System I: Chapter 2 (5th portion)
Introduction to Embedded System I: Chapter 2 (5th portion)Introduction to Embedded System I: Chapter 2 (5th portion)
Introduction to Embedded System I: Chapter 2 (5th portion)Moe Moe Myint
 
RTOS for Embedded System Design
RTOS for Embedded System DesignRTOS for Embedded System Design
RTOS for Embedded System Designanand hd
 
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT I Core of Embedded Systems
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT I   Core of Embedded SystemsSYBSC IT SEM IV EMBEDDED SYSTEMS UNIT I   Core of Embedded Systems
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT I Core of Embedded SystemsArti Parab Academics
 
ARM Exception and interrupts
ARM Exception and interrupts ARM Exception and interrupts
ARM Exception and interrupts NishmaNJ
 
Typical Embedded System
Typical Embedded SystemTypical Embedded System
Typical Embedded Systemanand hd
 
Digital signal processor architecture
Digital signal processor architectureDigital signal processor architecture
Digital signal processor architecturekomal mistry
 
Embedded Systems
Embedded SystemsEmbedded Systems
Embedded SystemsNavin Kumar
 
Introduction to embedded system design
Introduction to embedded system designIntroduction to embedded system design
Introduction to embedded system designMukesh Bansal
 

Mais procurados (20)

Embedded System Basics
Embedded System BasicsEmbedded System Basics
Embedded System Basics
 
INTERRUPT ROUTINES IN RTOS EN VIRONMENT HANDELING OF INTERRUPT SOURCE CALLS
INTERRUPT ROUTINES IN RTOS EN VIRONMENT HANDELING OF INTERRUPT SOURCE CALLSINTERRUPT ROUTINES IN RTOS EN VIRONMENT HANDELING OF INTERRUPT SOURCE CALLS
INTERRUPT ROUTINES IN RTOS EN VIRONMENT HANDELING OF INTERRUPT SOURCE CALLS
 
RTOS - Real Time Operating Systems
RTOS - Real Time Operating SystemsRTOS - Real Time Operating Systems
RTOS - Real Time Operating Systems
 
UNIT-I-RTOS and Concepts
UNIT-I-RTOS and ConceptsUNIT-I-RTOS and Concepts
UNIT-I-RTOS and Concepts
 
ARM CORTEX M3 PPT
ARM CORTEX M3 PPTARM CORTEX M3 PPT
ARM CORTEX M3 PPT
 
Introduction to Embedded System I: Chapter 2 (5th portion)
Introduction to Embedded System I: Chapter 2 (5th portion)Introduction to Embedded System I: Chapter 2 (5th portion)
Introduction to Embedded System I: Chapter 2 (5th portion)
 
Real-Time Operating Systems
Real-Time Operating SystemsReal-Time Operating Systems
Real-Time Operating Systems
 
RTOS Basic Concepts
RTOS Basic ConceptsRTOS Basic Concepts
RTOS Basic Concepts
 
RTOS for Embedded System Design
RTOS for Embedded System DesignRTOS for Embedded System Design
RTOS for Embedded System Design
 
Embedded system
Embedded systemEmbedded system
Embedded system
 
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT I Core of Embedded Systems
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT I   Core of Embedded SystemsSYBSC IT SEM IV EMBEDDED SYSTEMS UNIT I   Core of Embedded Systems
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT I Core of Embedded Systems
 
Embedded systems ppt
Embedded systems pptEmbedded systems ppt
Embedded systems ppt
 
ARM Exception and interrupts
ARM Exception and interrupts ARM Exception and interrupts
ARM Exception and interrupts
 
Typical Embedded System
Typical Embedded SystemTypical Embedded System
Typical Embedded System
 
Embedded systems
Embedded systemsEmbedded systems
Embedded systems
 
Fault tolerance techniques
Fault tolerance techniquesFault tolerance techniques
Fault tolerance techniques
 
Digital signal processor architecture
Digital signal processor architectureDigital signal processor architecture
Digital signal processor architecture
 
Task assignment and scheduling
Task assignment and schedulingTask assignment and scheduling
Task assignment and scheduling
 
Embedded Systems
Embedded SystemsEmbedded Systems
Embedded Systems
 
Introduction to embedded system design
Introduction to embedded system designIntroduction to embedded system design
Introduction to embedded system design
 

Semelhante a MicroC/OS-II

RTOS implementation
RTOS implementationRTOS implementation
RTOS implementationRajan Kumar
 
seminarembedded-150504150805-conversion-gate02.pdf
seminarembedded-150504150805-conversion-gate02.pdfseminarembedded-150504150805-conversion-gate02.pdf
seminarembedded-150504150805-conversion-gate02.pdfkarunyamittapally
 
REAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEMREAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEMprakrutijsh
 
Mca2050 computer architecture
Mca2050  computer architectureMca2050  computer architecture
Mca2050 computer architecturesmumbahelp
 
RTOS MICRO CONTROLLER OPERATING SYSTEM-2
RTOS MICRO CONTROLLER OPERATING SYSTEM-2RTOS MICRO CONTROLLER OPERATING SYSTEM-2
RTOS MICRO CONTROLLER OPERATING SYSTEM-2JOLLUSUDARSHANREDDY
 
Embedded operating system and industrial applications: a review
Embedded operating system and industrial applications: a reviewEmbedded operating system and industrial applications: a review
Embedded operating system and industrial applications: a reviewjournalBEEI
 
Types of Operating System-converted.pdf
Types of Operating System-converted.pdfTypes of Operating System-converted.pdf
Types of Operating System-converted.pdfOmid695066
 
Inter process communication
Inter process communicationInter process communication
Inter process communicationMohd Tousif
 
Types or evolution of operating system
Types or evolution of operating systemTypes or evolution of operating system
Types or evolution of operating systemEkta Bafna
 

Semelhante a MicroC/OS-II (20)

RTOS implementation
RTOS implementationRTOS implementation
RTOS implementation
 
Rtos
RtosRtos
Rtos
 
Os Concepts
Os ConceptsOs Concepts
Os Concepts
 
Real Time Operating Systems
Real Time Operating SystemsReal Time Operating Systems
Real Time Operating Systems
 
seminarembedded-150504150805-conversion-gate02.pdf
seminarembedded-150504150805-conversion-gate02.pdfseminarembedded-150504150805-conversion-gate02.pdf
seminarembedded-150504150805-conversion-gate02.pdf
 
Multitasking
MultitaskingMultitasking
Multitasking
 
Lab3F22.pdf
Lab3F22.pdfLab3F22.pdf
Lab3F22.pdf
 
REAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEMREAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEM
 
Mca2050 computer architecture
Mca2050  computer architectureMca2050  computer architecture
Mca2050 computer architecture
 
Embedded os
Embedded osEmbedded os
Embedded os
 
Os functions
Os functionsOs functions
Os functions
 
RTOS MICRO CONTROLLER OPERATING SYSTEM-2
RTOS MICRO CONTROLLER OPERATING SYSTEM-2RTOS MICRO CONTROLLER OPERATING SYSTEM-2
RTOS MICRO CONTROLLER OPERATING SYSTEM-2
 
Embedded operating system and industrial applications: a review
Embedded operating system and industrial applications: a reviewEmbedded operating system and industrial applications: a review
Embedded operating system and industrial applications: a review
 
Completeosnotes
CompleteosnotesCompleteosnotes
Completeosnotes
 
Complete Operating System notes
Complete Operating System notesComplete Operating System notes
Complete Operating System notes
 
Types of Operating System-converted.pdf
Types of Operating System-converted.pdfTypes of Operating System-converted.pdf
Types of Operating System-converted.pdf
 
Os concepts
Os conceptsOs concepts
Os concepts
 
Mid1 Revision
Mid1  RevisionMid1  Revision
Mid1 Revision
 
Inter process communication
Inter process communicationInter process communication
Inter process communication
 
Types or evolution of operating system
Types or evolution of operating systemTypes or evolution of operating system
Types or evolution of operating system
 

Último

ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxJanEmmanBrigoli
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEaurabinda banchhor
 
EMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docxEMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docxElton John Embodo
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsRommel Regala
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxRosabel UA
 

Último (20)

ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSE
 
EMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docxEMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docx
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World Politics
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptx
 

MicroC/OS-II

  • 1. MicroC/OS-II TOPIWALA MOHIT N. VLSI DESIGN-1581210018 SRM UNIVERSITY, CHENNAI S O T R
  • 2. MicroC/OS-II (commonly termed as µC/OS- II or uC/OS-II), is the acronym for Micro-Controller Operating Systems Version 2. It is a priority-based real-time multitasking operating system kernel for microprocessors, written mainly in the C programming language. It is intended for use in embedded systems. INTRODUCTION 9/29/2013 RTOS Mucos
  • 3. It is a very small real-time kernel. Memory footprint is about 20KB for a fully functional kernel. Source code is written mostly in ANSI C. Highly portable, ROMable, very scalable, preemptive real- time, deterministic, multitasking kernel. It can manage up to 64 tasks (56 user tasks available). It has connectivity with μC/GUI and μC/FS (GUI and File Systems for μC/OS II). Features of MicroC/OS-II : 9/29/2013 RTOS Mucos
  • 4. It is ported to more than 100 microprocessors and microcontrollers. It is simple to use and simple to implement but very effective compared to the price/performance ratio. It supports all type of processors from 8-bit to 64-bit. Cont… 9/29/2013 RTOS Mucos
  • 5. µC/OS-II is a multitasking operating system. Each task is an infinite loop and can be in any one of the following five states:  Dormant  Ready  Running  Waiting  ISR (Interrupt Service Routine) Task states: 9/29/2013 RTOS Mucos
  • 6.  Task Feature  Task Creation  Task Stack & Stack Checking  Task Deletion  Change a Task’s Priority  Suspend and Resume a Task  Get Information about a Task Task Management (Services): 9/29/2013 RTOS Mucos
  • 7.  μC/OS-II can manage up to 64 tasks. The four highest priority tasks and the four lowest priority tasks are reserved for its own use. This leaves 56 tasks for applications. The lower the value of the priority, the higher the priority of the task. (Something on the lines of Rate Monotonic Scheduling). The task priority number also serves as the task identifier. Task Feature : 9/29/2013 RTOS Mucos
  • 8. Rate Monotonic Scheduling :  In Rate Monotonic Scheduling tasks with the highest rate of execution are given the highest priority Assumptions:  All tasks are periodic  Tasks do not synchronize with one another, share resources, etc.  Preemptive scheduling is used (always runs the highest priority task that is ready)  Under these assumptions, let n be the number of tasks, Ei be the execution time of task i, and Ti be the period of task i. Then, all deadlines will be met if the following inequality is satisfied: ΣEi / Ti ≤ n(2^1/n – 1) 9/29/2013 RTOS Mucos
  • 9. Rate Monotonic Scheduling : Suppose we have 3 tasks. Task 1 runs at 100 Hz and takes 2 ms. Task 2 runs at 50 Hz and takes 1 ms. Task 3 runs at 66.7 Hz and takes 7 ms. Apply RMS theory… (2/10) + (1/20) + (7/15) = 0.717 ≤ 3(21/3 – 1) = 0.780 Thus, all the deadlines will be met  General Solution?  As n →∞, the right-hand side of the inequality goes to ln(2)=0.6931. Thus, you should design your system to use less than 60-70% of the CPU 9/29/2013 RTOS Mucos
  • 11. There are two functions for creating a task: OSTaskCreate()  OSTaskCreateExt(). Task Creation : 9/29/2013 RTOS Mucos
  • 13. Task Management : After the task is created, the task has to get a stack in which it will store its data.  A stack must consist of contiguous memory locations.  It is necessary to determine how much stack space a task actually uses.  Deleting a task means the task will be returned to its dormant state and does not mean that the code for the task will be deleted. The calling task can delete itself. 9/29/2013 RTOS Mucos
  • 14. If another task tries to delete the current task, the resources are not freed and thus are lost. So the task has to delete itself after it uses its resources Priority of the calling task or another task can be changed at run time. A task can suspend itself or another task, a suspended task can resume itself. A task can obtain information about itself or other tasks. This information can be used to know what the task is doing at a particular time. Task Management (cont…): 9/29/2013 RTOS Mucos
  • 15. The services of Memory management includes: Initializing the Memory Manager. Creating a Memory Partition. Obtaining Status of a Memory Partition. Obtaining a Memory Block. Returning a Memory Block. Waiting for Memory Blocks from a Memory Partition. Memory Management : 9/29/2013 RTOS Mucos
  • 16. Each memory partition consists of several fixed-sized memory blocks. A task obtains memory blocks from the memory partition. A task must create a memory partition before it can be used. Allocation and de-allocation of these fixed-sized memory blocks is done in constant time and is deterministic. Multiple memory partitions can exist, so a task can obtain memory blocks of different sizes. A specific memory block should be returned to its memory partition from which it came. Memory Management : 9/29/2013 RTOS Mucos
  • 17. Clock Tick : A clock tick is a periodic time source to keep track of time delays and time outs. Here, tick intervals varies from 10 ~ 100 ms. The faster the tick rate, the higher the overhead imposed on the system. Whenever a clock tick occurs μC/OS-II increments a 32- bit counter, the counter starts at zero, and rolls over to 4,294,967,295 (2^32-1) ticks. A task can be delayed and a delayed task can also be resumed. Time Management : 9/29/2013 RTOS Mucos
  • 18. It involves five services that includes: OSTimeDLY() OSTimeDLYHMSM() OSTimeDlyResume() OSTimeGet() OSTimeSet() Time Management : 9/29/2013 RTOS Mucos
  • 19. Inter-task or inter process communication in μC/OS takes place using: Semaphores Message mailbox Message queues Tasks and Interrupt service routines (ISR). They can interact with each other through an ECB (event control block). Inter-Task Communication : 9/29/2013 RTOS Mucos
  • 20. Inter-Task Communication : Single task waiting 9/29/2013 RTOS Mucos
  • 21. Inter-Task Communication : Multiple tasks waiting and signaling 9/29/2013 RTOS Mucos
  • 22. Inter-Task Communication : Tasks can wait and signal along with an optional time out 9/29/2013 RTOS Mucos
  • 23. Inter-Task Communication : μC/OS-II semaphores consist of two elements 16-bit unsigned integer count list of tasks waiting for semaphore μC/OSII provides Create, post, pend accept and query services 9/29/2013 RTOS Mucos
  • 24. Inter-Task Communication : μC/OS-II message-mailboxes: an μC/OSII object that allows a task or ISR to send a pointer sized variable (pointing to a message) to another task. 9/29/2013 RTOS Mucos
  • 25. Inter-Task Communication :  μC/OS-II message-queues Available services: Create, Post (FIFO), PostFront (LIFO), Pend, Accept, Query, Flush  N = #of entries in the queue: Queue full if Post or PostFront called N times before a Pend or Accept 9/29/2013 RTOS Mucos
  • 26. Inter-Task Communication : μC/OS-II message-queues organized as circular buffers. 9/29/2013 RTOS Mucos
  • 27. Tasks running under a multitasking kernel should be written in one of two ways: 1. A non-returning forever loop. For example: void Task (void *) { DoInitStuff(); while (1) { do this; do that; do the other thing; call OS service (); // e.g. OSTimeDelay, OSSemPend, etc. } } Writing Applications Under μC/OS -II: 9/29/2013 RTOS Mucos
  • 28. 2. A task that deletes itself after running. For example: void Task (void *) { do this; do that; do the other thing; call OS service (); // e.g. OSTimeDelay, OSSemPend, etc. OSTaskDelete(); // Ask the OS to delete the task } 9/29/2013 RTOS Mucos