vxworks嵌入式操作系统.pptx
《vxworks嵌入式操作系统.pptx》由会员分享,可在线阅读,更多相关《vxworks嵌入式操作系统.pptx(92页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、TaskEach task has its own context,which is the CPU environment and system resources that the task sees each time it is scheduled to run by the kernel.A tasks context is saved in the task control block(TCB).第1页/共92页TaskA tasks context includes:-a thread of execution;that is,the tasks program counter
2、-the CPU registers and(optionally)floating-point registers -I/O assignments for standard input,output,and error -a delay timer -a time-slice timer -kernel control structures -signal handlers -debugging and performance monitoring values第2页/共92页TaskThe default task scheduling algorithm in wind is prio
3、rity-based preemptive scheduling.Round Robin is an optional algorithm.The wind kernel has 256 priority levels,numbered 0 through 255.Priority 0 is the highest and priority 255 is the lowest.第3页/共92页Task Scheduler Control Routines第4页/共92页TaskTask LockWhen a task disables the scheduler by calling task
4、Lock(),no priority-based preemption can take place while that task is running.If the task explicitly blocks or suspends,the scheduler selects the next highest-priority eligible task to execute.When the preemption-locked task unblocks and begins running again,preemption is again disabled.The taskLock
5、()prevent task context switching,but do not lock out interrupt handling.第5页/共92页Task Control Routine第6页/共92页TasktaskSpawnTask Name and ID RoutinesTask Information RoutinesTask Deleting RoutinesTask Control RoutinesTask Hook Routines第7页/共92页Task Spawn第8页/共92页Task Name and ID Routines第9页/共92页Task Info
6、rmation Routines第10页/共92页Task Information Routines第11页/共92页Task Deleting Routines第12页/共92页Task Deleting Routines第13页/共92页Task Control Routines第14页/共92页Task Hook Routines第15页/共92页Shared Code and ReentrancyA single copy of code executed by multiple tasks is called shared code.A subroutine is reentrant
7、 if a single copy of the routine can be called from several task contexts simultaneously without conflict.Modify global or static variables.第16页/共92页Code Reentrancy SolutionsDynamic Stack VariablesGuarded Global and Static VariablesTask Variables第17页/共92页Dynamic Stack Variables第18页/共92页Guarded Globa
8、l and Static VariablesProviding a mutual-exclusion mechanism to prohibit tasks from simultaneously executing critical sections of code.第19页/共92页Task Variables第20页/共92页Intertask CommunicationShared Data StructureMutual ExclusionSemaphoresMessage QueuesPipesNetwork Intertask CommunicationSignals第21页/共
9、92页Shared Data StructuresGlobal variablesLinear buffersRing buffersLinked listsPointers第22页/共92页Shared Data Structures第23页/共92页Mutual ExclusionDisable interruptsDisable preemptionResource locking with semaphores第24页/共92页Disable InterruptsThe most powerful methodIt prevents the system from responding
10、 to external events for the duration of these locks.Keep the duration of interrupt lockouts short.第25页/共92页Preemptive locksLess restrictive form of mutual exclusion.No other task is allowed to preemptive the current executing task,ISR are able to execute.Tasks of higher priority are unable to execut
11、e until the locking task leaves the critical region.第26页/共92页SemaphoresHighly optimized and provide the fastest intertask communication mechanism in VxWorks.Three types of Wind semaphores:-Binary-Mutual exclusion-Counting第27页/共92页Semaphore Control Routines第28页/共92页Binary Semaphore第29页/共92页Binary Sem
12、aphore第30页/共92页Binary Semaphore-Mutual Exclusion第31页/共92页Binary Semaphore-Mutual Exclusion第32页/共92页Binary Semaphore-Synchronization第33页/共92页Binary Semaphore-Synchronization第34页/共92页Binary Semaphore-Synchronization第35页/共92页Mutual Semaphore-Recursive Resource Access第36页/共92页Mutual Semaphore-Recursive
13、Resource Access第37页/共92页Counting Semaphores第38页/共92页Message QueueMessage queues allow a variable number of messages,each of variable length,to be queued.Tasks and ISRs can send messages to a message queue,and tasks can receive message form a message queue.Multiple tasks can send to and receive from
14、the same message queue.Full-duplex communication between two tasks generally requires two message queues,one for each direction.第39页/共92页Message Queues第40页/共92页Wind Message Queue Control第41页/共92页Message Queue Example第42页/共92页Message Queue Example第43页/共92页Message Queue Example第44页/共92页Message Queues第
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- vxworks 嵌入式 操作系统
限制150内