180 likes | 367 Views
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. Real Time Operating System.
E N D
Development of Real Time KernelMaster of TechnologyInEMBEDDED 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
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,
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.
Task Management • Creation of Task • Scheduling of Task • Finishing of Task • Wait Task • Resume Task
Os_Create_Task Macro Task_id, Priority Start Task_id, Priority Memory allocation for (TIB) Task_id, Priority, Context Register etc. Stop
Task ManagementTask 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) 2 Task priority (“0” highest/”0FFh” lowest) 3 Task 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 4 Task stack pointer 5 to 10 Task context registers in the stack 11 to 15 For saving data and calling subroutine
Memory Allocation: 128 byte RAM are allocated statically as : 70 to 7F 60 to 6F 50 to 5F 40 to 4F 30 to 3F 20 to 2F 00 to 1F
Priority based Pre-emptive Scheduler Start Status of tasks from TIB After Each Second Scheduler is started again by RTC it also check starvation of task Check State if ready Yes Take Priorities and Task_id from TIB’s Sort priorities, Make list of Task_id accordingly No Call next Task Compare Sorted priority (rem. task) Wait task or End Task update State &/or Priority and switch Same Set Context switch flag set Start first task Task are called in time slice mode (context switching) Check Flag by RTC
Context Switching Start Cont. SW flag, Cur_task Set SP, Save Cont reg. Check flag, set next task. End
End Task Start State = Finish Priority = 0FF Switch to Scheduler End
Real Time Clock & Environment • Timer Real Time Clock • After 5 mille Sec. Context Switching • After each Second Scheduler is restarted
Real Time Clock & Environment Start Tick, Sec., Min., Hour, Flag, TimerInterrupt Set & start Pop Context Reg Set & start Timer Interrupt Call Context Switch No Main Prg. Watch Timer Flag If set Yes Push Context Reg., INC Tick No No If Tick ==200 If Context Switching Require Yes Exit RTC INC Sec ,Tick=0, Save context Start Scheduler, check starvat. Yes No If Sec ==60 No Yes Yes INC Hour INC Min, Sec=0 If Min ==60
Starvation Solution Start Current time – start time =>10 Sec Call Wait task End
Wait Task Start Delay_Time in hh,mm,ss State = Wait, Resu_Time = Curr_Time + delay_Time, Switch to Scheduler End
Resume Task Start If Cur_time=>Resu_Time State = ready End
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.
Interrupt Handler Start at ISR PushContext Reg. acall os_int_X Pop Context Reg. Reti