Download presentation
Presentation is loading. Please wait.
Published byAyana Littlepage Modified over 9 years ago
1
Development of Real Time Kernel Master of Technology In EMBEDDED SYSTEM SCHOOL OF ELECTRONICS DEVI AHILYA VISWAVIDYALAYA INDORE. April 2010 Guided by - Dr. RajKamal Head of Dept. Soex. Presented by - Barakha Raghuwanshi M.Tech. E.S.IV Sem
2
Real Time Operating System Real Time Operating Systems are used to control user programs and system resources in multitasking environment at real time systems. Kernel is the core program of operating system. Characteristics: RTOS kernel should be – Multitasking, pre-emptible. Task Priority, Prevent Starvation Real Time Operation, Fast response time Low Interrupt and Task switching latency. Resource allocation Other Operating systems function as Memory management,
3
Characteristics of Proposed kernel Multitasking, Priority based scheduler, Which also support Round Robin scheduling if priority of tasks are same. Solve starvation problem. Preemptive scheduler. Support Real time operation Provide Interrupt handlers with low latency Low task switching latency. Memory Management. Inter Task communication.
4
Task Management Creation of Task Scheduling of Task Finishing of Task Wait Task Resume Task
5
Os_Create_Task Macro Task_id, Priority Task_id, Priority Memory allocation for (TIB) Task_id, Priority, Context Register etc. Start Stop
6
Task Management Task Information Block Each task when created have a 16 byte (TIB) task information block in scratchpad RAM. Byte Description 0 - 1 Task ID (Starting Location of Task) 2Task priority (“0” highest/”0FFh” lowest) 3Task status 00000000- Task can execute 0001nnnn-Send message to task‘ nnnn’ 00100000-Wait for a message 010000ii – Waiting for interrupt ii 11111111-No task loaded for TIB 4Task stack pointer 5 to 10Task context registers in the stack 11 to 15For saving data and calling subroutine
7
Memory Allocation : 128 byte RAM are allocated statically as : Task 4 TIB Task 3 TIB Task 2 TIB Task 1 TIB Kernel Semaphore, Flag and Shared variable Bank Registers 70 to 7F 60 to 6F 50 to 5F 40 to 4F 30 to 3F 20 to 2F 00 to 1F
8
Priority based Pre-emptive Scheduler Start Check State if ready Status of tasks from TIB Take Priorities and Task_id from TIB’s Sort priorities, Make list of Task_id accordingly Yes Compare Sorted priority (rem. task) Context switch flag set Start first task Call next Task Task are called in time slice mode (context switching) Check Flag by RTC Wait task or End Task update State &/or Priority and switch After Each Second Scheduler is started again by RTC it also check starvation of task Same No Set
9
Context Switching Start Cont. SW flag, Cur_task Set SP, Save Cont reg. Check flag, set next task. End
10
End Task Start State = Finish Priority = 0FF Switch to Scheduler End
11
Real Time Clock & Environment Timer Real Time Clock After 5 mille Sec. Context Switching After each Second Scheduler is restarted
12
Real Time Clock & Environment Tick, Sec., Min., Hour, Flag, Timer Interrupt Set & start Watch Timer Flag If set Yes No Main Prg. Push Context Reg., INC Tick If Tick ==200 Yes No If Sec ==60 INC Sec,Tick=0, Save context Start Scheduler, check starvat. INC Hour INC Min, Sec=0If Min ==60 No Exit RTC If Context Switching Require Yes No Call Context Switch Pop Context Reg Set & start Timer Interrupt Start
13
Starvation Solution Start Current time – start time =>10 Sec End Call Wait task
14
Wait Task Start End Delay_Time in hh,mm,ss State = Wait, Resu_Time = Curr_Time + delay_Time, Switch to Scheduler
15
Resume Task Start State = ready End If Cur_time=>Resu_Time
16
Inter Task Communication Inter task communication is performed through Messages. Message pointer are sent to mailbox. Task read message from mailbox and make null to mailbox. Os_Create_Mbox, Os_Send_Msg, and Os_Read_msg macro are used for this purpose.
17
Interrupt Handler Start at ISR Push Context Reg. acall os_int_X Pop Context Reg. Reti
18
THANK YOU
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.