SlideShare a Scribd company logo
1 of 10
RTX KERNEL
By Preeti Punia
12ECP035
INTRODUCTION
• The Keil RTX is a royalty-free, deterministic Real-Time
Operating System designed for ARM and Cortex-M devices.
• It allows you to create programs that simultaneously
perform multiple functions
• It helps to create applications which are better structured
and more easily maintained
• The RTX kernel is an easy to use Real Time eXecutive (RTX)
providing a set of C functions and macros for building real-
time applications which are using tasks running quasi-
parallel on the CPU.
• The RTX kernel provides basic functionality to start and stop
concurrent tasks (processes)
Advantages
• The RTX kernel is based on the idea of parallel tasks (processes).In the RTX kernel,
the task that a system must fulfill is split up into several smaller tasks that run
concurrently.
• Real world processes consist, usually, of several concurrent activities. This pattern
can be represented in software by using the RTX kernel.
• You can make different activities occur at different times, for example, just at the
moment when they are needed. This is possible because each activity is packed
into a separate task, which can be executed on its own.
• Tasks can be prioritized.
• It is easier to understand and manage smaller pieces of code than one large piece
of software.
• Splitting up the software into independent parts reduces the system complexity,
the number of errors, and even facilitates testing.
• The RTX kernel is scalable. Additional tasks can be added easily at a later time.
• The RTX kernel offers services needed in many real-time applications, for example,
good handling of interrupts, periodical activation of tasks, and time-limits on wait
functions.
SOME BASIC FUNCTIONS
• os_sys_init
• os_tsk_create
• os_tsk_delete
• task_id
• These functions are in the RL-RTX library. The
prototype is defined in rtl.h
1. os_sys_init
• The os_sys_init function initializes and starts the Real-
Time eXecutive (RTX) kernel. The task argument points to
the task function to start after the kernel is initialized. The
RTX kernel gives the task a default priority of 1.
• Return Value- The os_sys_init function does not return.
Program execution continues with the task identified by
the task argument.
• Example
#include <rtl.h>
void main (void) {
os_sys_init (task1); /* start the kernel */
while(1); /* will never come here */
}
2. os_tsk_create
• The os_tsk_create function creates the task identified by the task function pointer
argument and then adds the task to the ready queue. It dynamically assigns a task
identifier value (TID) to the new task.
• Return Value- The os_tsk_create function returns the task identifier value (TID) of
the new task. If the function fails, for example due to an invalid argument, it
returns 0.
• Example
#include <rtl.h>
OS_TID tsk1, tsk2;
__task void task1 (void) {
..
tsk2 = os_tsk_create (task2, 1);
..
}
__task void task2 (void) {
..
}
3. os_tsk_delete
• If a task has finished all its work or is not needed
anymore, you can terminate it using
theos_tsk_delete function.
The os_tsk_delete function stops and deletes the task
identified by task_id.
• If task_id has a value of 0, the task that is currently
running is stopped and deleted. The program
execution continues with the task with the next
highest priority in the ready queue.
• Return Value
• The os_tsk_delete function returns OS_R_OK if the
task was successfully stopped and deleted. In all other
cases, for example if the task with task_id does not
exist or is not running, the function returns OS_R_NOK.
• Example
#include <rtl.h>
OS_TID tsk3;
__task void task2 (void) {
tsk3 = os_tsk_create (task3, 0);
..
if (os_tsk_delete (tsk3) == OS_R_OK) {
printf("n'task 3' deleted.");
}
else {
printf ("nFailed to delete 'task 3'.");
}
}
__task void task3 (void) {
..
}
/*Program to run two tasks viz. ‘T1’ and ‘T2’ using
RTOS and show the result on LEDs connected on P0 of
ARM7*/
(This program have errors…it only tells the pattern)#include <RTL.h> /* RTX header file */
#include <LPC17xx.H> /* LPC17xx definitions (or your own part) */
unsigned int counta = 0; /* counta and countb used in RTX demo */
unsigned int countb = 0;
__task void task1 (void) { /* __task is a RTX keyword. */
for (;;) { /* Infinite loop – runs while task1 runs. */
counta++; /* Increment global variable counta. */
}
}
__task void task2 (void) {
for (;;) {
countb++;
}
}
__task void init (void) {
os_tsk_create (task1, 1); /* Creates task1 with priority 1 (default)*/
os_tsk_create (task2, 1); /* Creates task2 with priority 1 (default)*/
os_task_delete_self (); /* Goes away and task1 starts */
}
int main (void) {
SystemInit(); /* initialize the Coretx-M3 processor */
os_sys_init(init); /* Start the init task */
}
THANK YOU

More Related Content

What's hot

Seattle Cassandra Meetup - Cassandra 1.2 - Eddie Satterly
Seattle Cassandra Meetup - Cassandra 1.2 - Eddie SatterlySeattle Cassandra Meetup - Cassandra 1.2 - Eddie Satterly
Seattle Cassandra Meetup - Cassandra 1.2 - Eddie Satterly
btoddb
 

What's hot (20)

Storm
StormStorm
Storm
 
BIG DATA ANALYTICS
BIG DATA ANALYTICSBIG DATA ANALYTICS
BIG DATA ANALYTICS
 
Reactive by example - at Reversim Summit 2015
Reactive by example - at Reversim Summit 2015Reactive by example - at Reversim Summit 2015
Reactive by example - at Reversim Summit 2015
 
Performance improvement techniques for software distributed shared memory
Performance improvement techniques for software distributed shared memoryPerformance improvement techniques for software distributed shared memory
Performance improvement techniques for software distributed shared memory
 
RxJava - introduction & design
RxJava - introduction & designRxJava - introduction & design
RxJava - introduction & design
 
Round Robin Algorithm.pptx
Round Robin Algorithm.pptxRound Robin Algorithm.pptx
Round Robin Algorithm.pptx
 
Continuous Performance Regression Testing with JfrUnit
Continuous Performance Regression Testing with JfrUnitContinuous Performance Regression Testing with JfrUnit
Continuous Performance Regression Testing with JfrUnit
 
Core Services behind Spark Job Execution
Core Services behind Spark Job ExecutionCore Services behind Spark Job Execution
Core Services behind Spark Job Execution
 
Apache Flink Training Workshop @ HadoopCon2016 - #1 System Overview
Apache Flink Training Workshop @ HadoopCon2016 - #1 System OverviewApache Flink Training Workshop @ HadoopCon2016 - #1 System Overview
Apache Flink Training Workshop @ HadoopCon2016 - #1 System Overview
 
Practical Experience with Automation Tools by Tim Walsh (Archivematica Camp B...
Practical Experience with Automation Tools by Tim Walsh (Archivematica Camp B...Practical Experience with Automation Tools by Tim Walsh (Archivematica Camp B...
Practical Experience with Automation Tools by Tim Walsh (Archivematica Camp B...
 
rx-java-presentation
rx-java-presentationrx-java-presentation
rx-java-presentation
 
Seattle Cassandra Meetup - Cassandra 1.2 - Eddie Satterly
Seattle Cassandra Meetup - Cassandra 1.2 - Eddie SatterlySeattle Cassandra Meetup - Cassandra 1.2 - Eddie Satterly
Seattle Cassandra Meetup - Cassandra 1.2 - Eddie Satterly
 
Effective java item 80 prefer executors, tasks, and streams to threads
Effective java   item 80  prefer executors, tasks, and  streams to threadsEffective java   item 80  prefer executors, tasks, and  streams to threads
Effective java item 80 prefer executors, tasks, and streams to threads
 
S3, Cassandra or Outer Space? Dumping Time Series Data using Spark - Demi Ben...
S3, Cassandra or Outer Space? Dumping Time Series Data using Spark - Demi Ben...S3, Cassandra or Outer Space? Dumping Time Series Data using Spark - Demi Ben...
S3, Cassandra or Outer Space? Dumping Time Series Data using Spark - Demi Ben...
 
Streams, Streams Everywhere! An Introduction to Rx
Streams, Streams Everywhere! An Introduction to RxStreams, Streams Everywhere! An Introduction to Rx
Streams, Streams Everywhere! An Introduction to Rx
 
Reactive systems
Reactive systemsReactive systems
Reactive systems
 
Apache Flink Training Workshop @ HadoopCon2016 - #4 Advanced Stream Processing
Apache Flink Training Workshop @ HadoopCon2016 - #4 Advanced Stream ProcessingApache Flink Training Workshop @ HadoopCon2016 - #4 Advanced Stream Processing
Apache Flink Training Workshop @ HadoopCon2016 - #4 Advanced Stream Processing
 
Real time operating systems (rtos) concepts 3
Real time operating systems (rtos) concepts 3Real time operating systems (rtos) concepts 3
Real time operating systems (rtos) concepts 3
 
RxJava in practice
RxJava in practice RxJava in practice
RxJava in practice
 
Load test REST APIs using gatling
Load test REST APIs using gatlingLoad test REST APIs using gatling
Load test REST APIs using gatling
 

Viewers also liked

Computer Aided Design: Layout Compaction
Computer Aided Design: Layout CompactionComputer Aided Design: Layout Compaction
Computer Aided Design: Layout Compaction
Team-VLSI-ITMU
 
Placement in VLSI Design
Placement in VLSI DesignPlacement in VLSI Design
Placement in VLSI Design
Team-VLSI-ITMU
 
VLSI-Physical Design- Tool Terminalogy
VLSI-Physical Design- Tool TerminalogyVLSI-Physical Design- Tool Terminalogy
VLSI-Physical Design- Tool Terminalogy
Murali Rai
 
Operating system and its function
Operating system and its functionOperating system and its function
Operating system and its function
Nikhi Jain
 

Viewers also liked (20)

CAD: Layout Extraction
CAD: Layout ExtractionCAD: Layout Extraction
CAD: Layout Extraction
 
Reduced ordered binary decision diagram
Reduced ordered binary decision diagramReduced ordered binary decision diagram
Reduced ordered binary decision diagram
 
scripting in Python
scripting in Pythonscripting in Python
scripting in Python
 
Different types of kernels
Different types of kernelsDifferent types of kernels
Different types of kernels
 
Computer Aided Design: Global Routing
Computer Aided Design:  Global RoutingComputer Aided Design:  Global Routing
Computer Aided Design: Global Routing
 
CAD: Floorplanning
CAD: Floorplanning CAD: Floorplanning
CAD: Floorplanning
 
Computer Aided Design: Layout Compaction
Computer Aided Design: Layout CompactionComputer Aided Design: Layout Compaction
Computer Aided Design: Layout Compaction
 
CAD: introduction to floorplanning
CAD:  introduction to floorplanningCAD:  introduction to floorplanning
CAD: introduction to floorplanning
 
Ch 6 randomization
Ch 6 randomizationCh 6 randomization
Ch 6 randomization
 
CNTFET
CNTFETCNTFET
CNTFET
 
Placement in VLSI Design
Placement in VLSI DesignPlacement in VLSI Design
Placement in VLSI Design
 
VLSI routing
VLSI routingVLSI routing
VLSI routing
 
Nmos design using synopsys TCAD tool
Nmos design using synopsys TCAD toolNmos design using synopsys TCAD tool
Nmos design using synopsys TCAD tool
 
Physical design-complete
Physical design-completePhysical design-complete
Physical design-complete
 
twin well cmos fabrication steps using Synopsys TCAD
twin well cmos fabrication steps using Synopsys TCADtwin well cmos fabrication steps using Synopsys TCAD
twin well cmos fabrication steps using Synopsys TCAD
 
Kernel (OS)
Kernel (OS)Kernel (OS)
Kernel (OS)
 
types of operating system
types of operating systemtypes of operating system
types of operating system
 
VLSI-Physical Design- Tool Terminalogy
VLSI-Physical Design- Tool TerminalogyVLSI-Physical Design- Tool Terminalogy
VLSI-Physical Design- Tool Terminalogy
 
Operating system and its function
Operating system and its functionOperating system and its function
Operating system and its function
 
Types of operating system
Types of operating systemTypes of operating system
Types of operating system
 

Similar to RTX Kernal

REAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEMREAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEM
prakrutijsh
 
Real Time Kernels
Real Time KernelsReal Time Kernels
Real Time Kernels
Arnav Soni
 
El camino a las Cloud Native Apps - Introduction
El camino a las Cloud Native Apps - IntroductionEl camino a las Cloud Native Apps - Introduction
El camino a las Cloud Native Apps - Introduction
Plain Concepts
 
Survey of task scheduler
Survey of task schedulerSurvey of task scheduler
Survey of task scheduler
elisha25
 

Similar to RTX Kernal (20)

Lab6 rtos
Lab6 rtosLab6 rtos
Lab6 rtos
 
.NET Multithreading/Multitasking
.NET Multithreading/Multitasking.NET Multithreading/Multitasking
.NET Multithreading/Multitasking
 
Real Time Operating System Concepts
Real Time Operating System ConceptsReal Time Operating System Concepts
Real Time Operating System Concepts
 
unit5 uc.pptx
unit5 uc.pptxunit5 uc.pptx
unit5 uc.pptx
 
Design of Real - Time Operating System Using Keil µVision Ide
Design of Real - Time Operating System Using Keil µVision IdeDesign of Real - Time Operating System Using Keil µVision Ide
Design of Real - Time Operating System Using Keil µVision Ide
 
Embedded_ PPT_4-5 unit_Dr Monika-edited.pptx
Embedded_ PPT_4-5 unit_Dr Monika-edited.pptxEmbedded_ PPT_4-5 unit_Dr Monika-edited.pptx
Embedded_ PPT_4-5 unit_Dr Monika-edited.pptx
 
REAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEMREAL TIME OPERATING SYSTEM
REAL TIME OPERATING SYSTEM
 
Real Time Kernels
Real Time KernelsReal Time Kernels
Real Time Kernels
 
SparkSQL: A Compiler from Queries to RDDs
SparkSQL: A Compiler from Queries to RDDsSparkSQL: A Compiler from Queries to RDDs
SparkSQL: A Compiler from Queries to RDDs
 
RTOS implementation
RTOS implementationRTOS implementation
RTOS implementation
 
Parallel Programming With Dot Net
Parallel Programming With Dot NetParallel Programming With Dot Net
Parallel Programming With Dot Net
 
Porting a Streaming Pipeline from Scala to Rust
Porting a Streaming Pipeline from Scala to RustPorting a Streaming Pipeline from Scala to Rust
Porting a Streaming Pipeline from Scala to Rust
 
Async and parallel patterns and application design - TechDays2013 NL
Async and parallel patterns and application design - TechDays2013 NLAsync and parallel patterns and application design - TechDays2013 NL
Async and parallel patterns and application design - TechDays2013 NL
 
Workflow as code with Azure Durable Functions
Workflow as code with Azure Durable FunctionsWorkflow as code with Azure Durable Functions
Workflow as code with Azure Durable Functions
 
El camino a las Cloud Native Apps - Introduction
El camino a las Cloud Native Apps - IntroductionEl camino a las Cloud Native Apps - Introduction
El camino a las Cloud Native Apps - Introduction
 
Rtos 8051
Rtos 8051Rtos 8051
Rtos 8051
 
Survey of task scheduler
Survey of task schedulerSurvey of task scheduler
Survey of task scheduler
 
freertos-proj.pdf
freertos-proj.pdffreertos-proj.pdf
freertos-proj.pdf
 
Process Scheduler and Balancer in Linux Kernel
Process Scheduler and Balancer in Linux KernelProcess Scheduler and Balancer in Linux Kernel
Process Scheduler and Balancer in Linux Kernel
 
Mmap failure analysis
Mmap failure analysisMmap failure analysis
Mmap failure analysis
 

More from Team-VLSI-ITMU (7)

Intermediate Fabrics
Intermediate FabricsIntermediate Fabrics
Intermediate Fabrics
 
Linux Basics
Linux BasicsLinux Basics
Linux Basics
 
floor planning
floor planningfloor planning
floor planning
 
Cmos inverter design using tanner 180nm technology
Cmos inverter design using tanner 180nm technologyCmos inverter design using tanner 180nm technology
Cmos inverter design using tanner 180nm technology
 
SRAM- Ultra low voltage operation
SRAM- Ultra low voltage operationSRAM- Ultra low voltage operation
SRAM- Ultra low voltage operation
 
All opam assignment2_main
All opam assignment2_mainAll opam assignment2_main
All opam assignment2_main
 
MOSFET Small signal model
MOSFET Small signal modelMOSFET Small signal model
MOSFET Small signal model
 

Recently uploaded

1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
AldoGarca30
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
MayuraD1
 
Digital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxDigital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptx
pritamlangde
 

Recently uploaded (20)

Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic Marks
 
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
Jaipur ❤CALL GIRL 0000000000❤CALL GIRLS IN Jaipur ESCORT SERVICE❤CALL GIRL IN...
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech Civil
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
Digital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxDigital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptx
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 

RTX Kernal

  • 1. RTX KERNEL By Preeti Punia 12ECP035
  • 2. INTRODUCTION • The Keil RTX is a royalty-free, deterministic Real-Time Operating System designed for ARM and Cortex-M devices. • It allows you to create programs that simultaneously perform multiple functions • It helps to create applications which are better structured and more easily maintained • The RTX kernel is an easy to use Real Time eXecutive (RTX) providing a set of C functions and macros for building real- time applications which are using tasks running quasi- parallel on the CPU. • The RTX kernel provides basic functionality to start and stop concurrent tasks (processes)
  • 3. Advantages • The RTX kernel is based on the idea of parallel tasks (processes).In the RTX kernel, the task that a system must fulfill is split up into several smaller tasks that run concurrently. • Real world processes consist, usually, of several concurrent activities. This pattern can be represented in software by using the RTX kernel. • You can make different activities occur at different times, for example, just at the moment when they are needed. This is possible because each activity is packed into a separate task, which can be executed on its own. • Tasks can be prioritized. • It is easier to understand and manage smaller pieces of code than one large piece of software. • Splitting up the software into independent parts reduces the system complexity, the number of errors, and even facilitates testing. • The RTX kernel is scalable. Additional tasks can be added easily at a later time. • The RTX kernel offers services needed in many real-time applications, for example, good handling of interrupts, periodical activation of tasks, and time-limits on wait functions.
  • 4. SOME BASIC FUNCTIONS • os_sys_init • os_tsk_create • os_tsk_delete • task_id • These functions are in the RL-RTX library. The prototype is defined in rtl.h
  • 5. 1. os_sys_init • The os_sys_init function initializes and starts the Real- Time eXecutive (RTX) kernel. The task argument points to the task function to start after the kernel is initialized. The RTX kernel gives the task a default priority of 1. • Return Value- The os_sys_init function does not return. Program execution continues with the task identified by the task argument. • Example #include <rtl.h> void main (void) { os_sys_init (task1); /* start the kernel */ while(1); /* will never come here */ }
  • 6. 2. os_tsk_create • The os_tsk_create function creates the task identified by the task function pointer argument and then adds the task to the ready queue. It dynamically assigns a task identifier value (TID) to the new task. • Return Value- The os_tsk_create function returns the task identifier value (TID) of the new task. If the function fails, for example due to an invalid argument, it returns 0. • Example #include <rtl.h> OS_TID tsk1, tsk2; __task void task1 (void) { .. tsk2 = os_tsk_create (task2, 1); .. } __task void task2 (void) { .. }
  • 7. 3. os_tsk_delete • If a task has finished all its work or is not needed anymore, you can terminate it using theos_tsk_delete function. The os_tsk_delete function stops and deletes the task identified by task_id. • If task_id has a value of 0, the task that is currently running is stopped and deleted. The program execution continues with the task with the next highest priority in the ready queue. • Return Value • The os_tsk_delete function returns OS_R_OK if the task was successfully stopped and deleted. In all other cases, for example if the task with task_id does not exist or is not running, the function returns OS_R_NOK.
  • 8. • Example #include <rtl.h> OS_TID tsk3; __task void task2 (void) { tsk3 = os_tsk_create (task3, 0); .. if (os_tsk_delete (tsk3) == OS_R_OK) { printf("n'task 3' deleted."); } else { printf ("nFailed to delete 'task 3'."); } } __task void task3 (void) { .. }
  • 9. /*Program to run two tasks viz. ‘T1’ and ‘T2’ using RTOS and show the result on LEDs connected on P0 of ARM7*/ (This program have errors…it only tells the pattern)#include <RTL.h> /* RTX header file */ #include <LPC17xx.H> /* LPC17xx definitions (or your own part) */ unsigned int counta = 0; /* counta and countb used in RTX demo */ unsigned int countb = 0; __task void task1 (void) { /* __task is a RTX keyword. */ for (;;) { /* Infinite loop – runs while task1 runs. */ counta++; /* Increment global variable counta. */ } } __task void task2 (void) { for (;;) { countb++; } } __task void init (void) { os_tsk_create (task1, 1); /* Creates task1 with priority 1 (default)*/ os_tsk_create (task2, 1); /* Creates task2 with priority 1 (default)*/ os_task_delete_self (); /* Goes away and task1 starts */ } int main (void) { SystemInit(); /* initialize the Coretx-M3 processor */ os_sys_init(init); /* Start the init task */ }