DOC PREVIEW
UNCC ECGR 4101 - Real Time Operating Systems

This preview shows page 1-2-16-17-18-33-34 out of 34 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Real Time Operating SystemsObjectiveDefining application requirementsBasic concepts and definitionsSlide 5Slide 6Context Switch and Task Control BlockH8S Stack frames during a context switchPreemptionEmbedded programming modelsSlide 11Where does an RTOS fit in?RTOS ServicesTask Management & SchedulingTask ManagementSlide 16Scheduler and Scheduling PolicyInterrupt HandlingClocks and TimersSynchronizationSynchronization and SemaphoresPriority InversionInter Task CommunicationMailbox/Message QueueMemory ManagementDynamic Memory allocation: RTOS heapRTOS classification based on architectureRTOS aware debuggingBuy vs Roll your OwnSlide 30Slide 31Slide 32Slide 33Objectives: RecapReal Time Operating SystemsMichael ThomasDate:Rev. 1.00Date2ObjectiveIdentify embedded programming modelsUnderstand basic RTOS definitions and conceptsPoints to consider when you “Buy or roll your own”3Defining application requirementsReal time: Computing with a deadlineA required level of service has to be provided in a bounded response timeConsequence of missing deadlines: “Hardness” of the problem/applicationHard real-time - absolute deadlines must be metFirm real-time - low occurrence of missing a deadline can be toleratedSoft real-time - tolerance in the order of human reaction time (50ms)4Basic concepts and definitionsTask: Self contained code that handles a singular functionality or semi-independent portion of the application that handles a specific duty.Threads: Access to entire memory spaceProcesses: Memory access area limited based on process creation parametersPriority5Basic concepts and definitionsReal-time SchedulingHardPreemptiveDynamicStaticPreemptive Non-preemptiveNon-preemptiveSoftSchedulerImplements the scheduling policy6Basic concepts and definitionsDeterminismExact time taken for each thread to execute is a constantKernel(Scheduler + Memory management + IPC + Synchronization) primitivesKernel latency (microkernel, picokernel etc)Kernel space7Other InfoTask IDPriorityTask StatusRegister ContentsProgram CounterContextTypical TCBContext switch timecurrent CPU taskSave context to TCB1Save context to TCB2Load context from TCB2 Load context from TCB1Context Switch and Task Control Block8H8S Stack frames during a context switchtask1 task2task1 readytask1 runningtask2 readyContext Switchtask2 runningLOCALVARIABLESLOCALVARIABLES9Clock Interrupts occur every ~10 ms (allow OS to run)OS checks to see if any higher priority process available in ready queueIf so, suspend current process and switch to new processPreemptionPriorityRTOS Context-Switch serviceISRTimeContext Switchtask 2task 1RUNNINGWAITING10Embedded programming modelsSystem designed around task scheduling policyEndless loopSimple cyclic executiveTime driven cyclicMulti-rate cyclicMulti-rate cyclic for periodic tasksMulti-rate cyclic with interrupts (bg/fg programming)Priority based pre-emptive11Task1Task2Task5Task4Task3Simple cyclicTask1Task2Task5Task4Task3Timer InterruptTime driven cyclicTimer InterruptTask1Task1Task1Task2Task3Multi-rate cyclicTask1Task1Task1Task2Task3Timer InterruptMulti-rate cyclic for periodic12Where does an RTOS fit in?Task management viewpoint:13RTOS Services14Task Management & SchedulingTask is considered as a scheduling unit which implements a functionOS services that collectively move tasks from one state to anotherProvide context switching servicesTask parameters like deadline, period, priority etc need to be specified15Task ManagementTask states in a typical RTOS:DormantWaitingReadyRunningInterrupted16Task ManagementState transitions of a task in a typical RTOSWaiting for resourcesResourcesavailableInterruptISR doneTask resumedTask preemptedtask deleted17Scheduler and Scheduling PolicyScheduling algorithms generate a feasible execution sequence based ontask prioritytask deadlinesresource requirementsRound Robin Earliest deadline First (EDF)Maximum Urgency First (MUF)Priority Ceiling Protocol (Resource based)18Interrupt HandlingRTOS Independent InterruptsISR preempts the RTOS and runsUsed for events that require accurate timing•RTOS Dependant Interrupts:ISR is run within the RTOS•RTOS should allow lower level ISR to be pre-empted by higher level ISR (RTOS Dependant Interrupts)•ISR must complete as quickly as possible.•Both Dependant and Independent ISRs can exist in one system19Clocks and TimersTick timerDecides granularity of system.System response time limited by tick timerEg: 50 microsec motor control interrupt cannot be handled by a 1 millisec tick timer OS.Timer primitivesAllow user to specify “Run task every x unit of time” during task creation. eg: scan keyboard20SynchronizationSynchronization primitive used to provide:Mutual exclusion: Critical sections not accessed simultaneouslyConditional synchronization: Ensure tasks run in a specific order•Synchronization constructs:Mutex (Binary semaphore)Semaphore (Counting semaphore)21Synchronization and SemaphoresTwo tasks and single bufferProducer task and consumer taskConsumer task to wait till producer task is done with buffer.Synchronization and data integrity achieved by using a semaphore to lock access to buffer.Issues:DeadlocksPriority Inversion: Low priority thread obtains a lock that blocks a higher priority thread22Priority InversionTasks L & H both need access to resource XTask L has locked this resource and hence delays H.Task M preempts L causing further delay to H; this is priority inversionReady to runRunningtimepreemptionPreemption after resource X releasedHigh priority task HLow priority task LMedium priority task MX23Inter Task CommunicationPrimary requirements/characteristics:Non-blocking communicationBounded latencyAsynchronous communicationShared MemoryMailbox/Message Queues24Mailbox/Message QueueTask 1Task 3Task 2Mailbox 125Memory ManagementMemory Management Unit (MMU)Handles Virtual memory operations.Memory protection esp. in process based OSDynamic memory allocationHeap; non-fragmenting memory allocation techniques“Pool” allocation mechanism26Dynamic Memory allocation: RTOS heap31 62 127 255 511Buffer sizeFree buffer list27RTOS classification based on architectureSoft, Firm and Hard real-timePre-emptive, Non pre-emptiveThread based, Process basedScheduling policy: RM, EDF, RR, MUF etcDynamic, StaticCost structure28RTOS aware debuggingStandard source level debugging not sufficient in multithreaded/multitasking environment.Potential bugs:Data corruption due to improper synchronizationDeadlockStarvationStack


View Full Document

UNCC ECGR 4101 - Real Time Operating Systems

Documents in this Course
Load more
Download Real Time Operating Systems
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Real Time Operating Systems and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Real Time Operating Systems 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?