embedded seminar

Views:
 
     
 

Presentation Description

No description available.

Comments

Presentation Transcript

Seminar on :

Seminar on Multi-tasking

Introduction :

Introduction The system has to perform two or more tasks simultaneously called as ……. Multi-tasking For e.g.:- washing machine It has the following tasks such as operation of the wash motor, timers, water level sensing and keypad scanning. “scheduler”- part of RTOS

Ways of multi-tasking:

Ways of multi-tasking There are many ways of multi-tasking:- Round robin Round robin with interrupts Function queue scheduling RTOS

Round robin:

Round robin void main(void { While(1) { If(device 1 needs service) Perform device1 I/O functions; If(device 2 needs service) Perform device2 I/O functions; If(deivce3 needs service) Perform device3 I/O functions; . . . If( deviceN needs service) Perform deviceN I/O functions; } }

Round robin with interrupts:

Round robin with interrupts BOOL flag_device1 = false; . . BOOL flag_deviceN = false; Void interrupts ISR_device1(void) { critical code for servicing of device1; Flag_device1 = true; } . . Void interrupts ISR_deviceN(void) { critical code for servicing of deviceN; Flag_deviceN = true; } conti ….. void main(void) { while(1) { if(flag_device1) { Non critical code of servicing device1; } . . If( flag_deviceN ) { Flag_deviceN = false; Non critical code of servicing deviceN; } } }

Function queue scheduling:

Function queue scheduling queue of function pointers; Void interrupts ISR_device1(void) { Critical code for servicing of device1; Put function1 on queue of functions pointer; } . . Void interrupts ISR_deviceN(void) { Critical code for servicing of deviceN; Put functionN on queue of functions pointer; } conti ….. Void function1(void) { Non critical code of servicing device1; } . . Void functionN (void) { Non critical code of servicing deviceN; } Void main(void) { While(1) { While(function queue is empty); Call the first functn in the queue and update the queue; } }

RTOS:

RTOS Void interrupts ISR_device1(void) { Critical code for servicing of device1; Set signal1; } . . Void interrupts ISR_deviceN(void) { Critical code for servicing of deviceN; Set signalN ; } conti ……. Void tasks1(void) { While(1) { Wait for signal1; Non critical code of servicing device1; } } . . Void tasksN (void) { While(1) { Wait for signalN ; Non critical code of servicing deviceN; } }

Basic RTOS principles related to multi-tasking :

Basic RTOS principles related to multi-tasking running ready block Task has the highest Task is initialized and enters the Task no longer has the highest Task is unblocked and the highest priority task Task is block due to the request for an unavailable resource