2009-2011年中国石油化工行业深度评估及精选精选精选

上传人:繁星 文档编号:88167498 上传时间:2019-04-20 格式:PPT 页数:53 大小:312KB
返回 下载 相关 举报
2009-2011年中国石油化工行业深度评估及精选精选精选_第1页
第1页 / 共53页
2009-2011年中国石油化工行业深度评估及精选精选精选_第2页
第2页 / 共53页
2009-2011年中国石油化工行业深度评估及精选精选精选_第3页
第3页 / 共53页
2009-2011年中国石油化工行业深度评估及精选精选精选_第4页
第4页 / 共53页
2009-2011年中国石油化工行业深度评估及精选精选精选_第5页
第5页 / 共53页
点击查看更多>>
资源描述

《2009-2011年中国石油化工行业深度评估及精选精选精选》由会员分享,可在线阅读,更多相关《2009-2011年中国石油化工行业深度评估及精选精选精选(53页珍藏版)》请在金锄头文库上搜索。

1、 Wind River Systems, Inc. 1997,Chapter - 5,Real-Time Multitasking,5-2,Real-Time Multitasking,Introduction Task Basics Task Control Error Status System Tasks,5-3,What is Real-Time ?,A system is described as being deterministic if its response time is predictable.,Real-time denotes the ability of the

2、control system to keep up with the system being controlled.,The lag time between the occurrence of an event and the response to that event is called latency.,Deterministic performance is key to real-time performance.,5-4,Requirements of a Real-time System,Ability to control many external components:

3、,Fast response,High speed execution:,Low overhead,Independent components,Asynchronous components,Synchronous components,A late answer is a wrong answer.,Deterministic operation:,5-5,Design Options,shoulder,elbow,wrist,knuckle1,knuckle2,5-6,Unitasking Approach,One task controlling all the components

4、in a loop. arm () for (;) if (shoulder needs moving) moveShoulder(); if (elbow needs moving) moveElbow(); if (writst needs moving) moveWrist(); . ,5-7,Multitasking Approach,Create a separate task to manipulate each joint: Joint () for (;) wait; /* until this joint needs moving */ moveJoint(); ,Each

5、task alternates between “ready” and “waiting”.,VxWorks allows a task to wait for:,A specific time delay.,An event (e.g., an interrupt).,5-8,Task States,PENDED,SUSP & PENDED,SUSPENDED,SUSP & DELAYED,DELAYED,READY / EXEC,5-9,Multitasking Kernel,Manages tasks.,Transparently interleaves task execution,

6、creating the appearance of many programs executing simultaneously and independently.,Uses Task Control Blocks (TCBs) to keep track of tasks.,One per task.,Defined by WIND_TCB data structure defined in taskLib.h.,O.S. control information e.g., task priority, delay timer, I/O assignments for stdin, st

7、dout, stderr,CPU Context Information e.g., PC, SP, CPU registers, FPU registers,5-10,Kernel Function,Kernel,TCB,TCB,TCB,Suspended,Pended,Delayed,Ready,CPU,Executing,5-11,Context Switch,To schedule a new task to run, the kernel must:,Complete context switch must be very fast.,Save context of old exec

8、uting task into associated TCB.,Restore context of next task to execute from associated TCB.,5-12,Priority Scheduling,Different application jobs may have different precedences, which should be observed when allocating the CPU.,Preemptive scheduling is based on task priorities chosen to reflect job p

9、recedence,The highest priority task ready to run (not pended or delayed) is allocated the CPU.,Rescheduling can occur at any time as a result of:,Kernel calls,Interrupts (e.g.,System clock tick),Context switch latency is minimized by invoking scheduler when state transitions occur.,5-13,Priority Bas

10、ed Preemption,High Priority Task A,Medium Priority Task B,Low Priority Task C,Equal priority tasks wont preempt each other (by default).,Event,Event,5-14,Round-Robin Scheduling,Time Slice Period (Constant - Programmable),5-15,Kernel Time Slicing,To allow equal priority tasks to preempt each other, t

11、ime slicing must be turned on: kernelTimeSlice (ticks) If ticks = 0, time slicing turned off.,Priority scheduling always takes precedence.,Round-robin only applies to tasks of the same priority.,Priority based rescheduling can happen any time.,Round-robin rescheduling can only happen every few clock

12、 ticks.,5-16,Performance Enhancements,All tasks reside in a common address space.,All tasks run in supervisor (privileged) mode.,text,data,bss,RAM,fooLib,int fooVal; void fooSet (int x) fooVal = x; ,fooSet (4),tTaskA,fooSet (99),tTaskB,5-17,Multitasking Facilities,Interrupt,Device,Device,Network,Tas

13、k,ISR,Task,Interrupt,Task,Buffer,Task,5-18,How VxWorks Operating System Meets Real-time Requirements,High speed execution,Tasks are cheap (light-weight).,Deterministic operation.,Preemptive priority scheduling assures response for high priority tasks.,Able to control many external components.,Multit

14、asking allows solution to mirror the problem.,Independent functions are assigned to different tasks.,Intertask communication allows tasks to cooperate.,Fast context switch reduces system overhead.,5-19,Real-Time Multitasking,Introduction Task Basics Task Control Error Status System Tasks,5-20,Overvi

15、ew,Low level routines to create and manipulate tasks are found in taskLib.,Do not confuse executable code with the task(s) which execute it.,A VxWorks task consists of:,A stack (for local storage of automatic variables and parameters passed to routines).,A TCB (for OS control),Code is downloaded bef

16、ore tasks are spawned.,Several tasks can execute the same code (e.g., printf().,5-21,Creating a Task,taskSpawn,foo () . ,Stack,TCB PC,5-22,Creating a Task,int taskSpawn (name, priority, options, stackSize, entryPt, arg1, ., arg10) name Task name, if NULL gives a default name. priority Task priority, 0-255. options Task options e.g. VX_UNBREAKABLE. stackSize Size o

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 工作范文

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号