freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

tornadovxworks培訓-wenkub

2022-09-12 14:26:44 本頁面
 

【正文】 入式培訓專題 微迪軟件培訓中心 Overview 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 before tasks are spawned. Several tasks can execute the same code (., printf()). 嵌入式培訓專題 微迪軟件培訓中心 Creating a Task taskSpawn Stack TCB PC foo () { ... } 嵌入式培訓專題 微迪軟件培訓中心 Creating a Task int taskSpawn (name, priority, options, stackSize, entryPt, arg1, ..., arg10) name Task name, if NULL gives a default name. priority Task priority, 0255. options Task options . VX_UNBREAKABLE. stackSize Size of stack to be allocated in bytes. entryPt Address of code to start executing (initial PC) arg1, ..., arg10 Up to 10 arguments to entry point routine. Returns a task id or ERROR if unsuccessful. 嵌入式培訓專題 微迪軟件培訓中心 Task ID?s Efficient 32bit handle for task. Assigned by kernel when task is created. May be reused after task exists. A task id of zero refers to task making call (self). Relevant taskLib routines: taskIdSelf() Get ID of calling task. taskIdListGet() Fill array with ID?s of all existing tasks. taskIdVerify() Verify a task ID is valid. Unique to each task. 嵌入式培訓專題 微迪軟件培訓中心 Task Names Provided for human convenience. Typically used only from the shell (during development). Within programs, use task Ids. By convention, start with a t. Default is an ascending integer following a t. Promotes interpretation as a task name. Doesn?t have to be unique (but usually is). Relevant taskLib routines. taskName() Get name from tid. taskNameToId() Get tid from task name. 嵌入式培訓專題 微迪軟件培訓中心 Task Priorities Range from 0 (highest) to 255 (lowest). No hard rules on how to set priorities. There are two (often contradictory) “rules of thumb”: Shorter deadline = higher priority. More important = higher priority. Can manipulate priorities dynamically with: taskPriorityGet (tid, amp。 } … pMem=malloc(sizeof(myStruct))。 case S_rctorLib_TEMP_CRITICAL_ZONE: logMsg (“Run!”)。 default: startEmergProc ()。它的類型定義如下:(用類PASCAL語言表述) semaphore = record value: integer。 =0時, ; 0時, 的個數(shù); 嵌入式培訓專題 微迪軟件培訓中心 PV原語(一) ? 對一個信號量變量可以進行兩種原語操作: p操作和 v操作,定義如下: procedure p(var s:samephore)。 { =+1。將 1時,可以用來實現(xiàn)進程的互斥。 ? 信號量機制必須有公共內(nèi)存,不能用于分布式操作系統(tǒng),這是它最大的弱點。 } Task may need to wait for an event to occur. Busy waiting (., polling) is inefficient. Pending until the event occurs is better. 嵌入式培訓專題 微迪軟件培訓中心 The Synchronization Solution Create a binary semaphore for the event. Full (event has occurred). Binary semaphores exist in one of two states: Empty (event has not occurred). Task waiting for the event calls semTake(), and blocks until semaphore is given. Task or interrupt service routine detecting the event calls semGive(), which unblocks the waiting task. 嵌入式培訓專題 微迪軟件培訓中心 Binary Semaphores SEM_ID semBCreate (options, intialState) options Sepcify queue type (SEM_Q_PRIORITY or SEM_Q_FIFO) for tasks pended on this semaphore. initialState Initialize semaphore to be available (SEM_FULL) or unavailable (SEM_EMPTY). Semaphores used for synchronization are typically initialized to SEM_EMPTY (event has not occurred). Returns a SEM_ID, or NULL on error. 嵌入式培訓專題 微迪軟件培訓中心 Taking a Semaphore STATUS semTake (semId, timeout) semId The SEM_ID returned from semBCreate(). timeout Maximum time to wait for semaphore. Value can be clock ticks, WAIT_FOREVER, or NO_WAIT. Can pend the task until either Semaphore left unavaiable. Semaphore is given or Timeout expires. Returns OK if successful, ERROR on timeout (or invalid semId). 嵌入式培訓專題 微迪軟件培訓中心 Taking a Binary Semaphore semaphore available ? task pends until sem is given or timeout timeout task unpends semTake() returns ERROR no task continues semTake() returns OK yes task unpends, semTake() returns OK semaphore given 嵌入式培訓專題 微迪軟件培訓中心 Giving a Semaphores STATUS semGive (semId) Unblocks a task waiting for semId. If no task is waiting, make semId available. Returns OK, or ERROR if semId is invalid. 嵌入式培訓專題 微迪軟件培訓中心 Giving a Binary Semaphore tasks pended ? semaphore made available no task at front of queue made ready semaphore remains unavailable yes 嵌入式培訓專題 微迪軟件培訓中心 Information Leakage Fast event occurrences can cause lost information. Suppose a VxWorks task (priority=100) is executing the following code, with semId initially unavailable: FOREVER { semTake (semId, WAIT_FOREVER)。 3. repeat (3, semGive, semId)。 7 myBuf [myBufIndex] = ch。 /* Index of last data */ 6 LOCAL SEM_ID mySemId。 19 myBuf[myBufIndex] = ch。 ? 我們設想下面的情況:一個任務獲得一些數(shù)據(jù)結(jié)構(gòu)的互斥訪問權,當它正在臨界區(qū)內(nèi)執(zhí)行時被另一個任務刪除。當被保護的任務完成臨界區(qū)操作以后,它將取消刪除保護以使自己可以被刪除,從而解阻塞刪除任務。當 T1搶占 T3,為競爭使用該資源而請求相同的信號量的時候,它被阻塞。這種情況可能會持續(xù)阻塞 T1等待一段不可確定的時間。這防止了 T3,間接地防止 T1,被 T2搶占。 嵌入式培訓專題 微迪軟件培訓中心 Priority Inheritance Priority inheritance algorithm solves priority inversion problem. Task owning a mutex semaphore is elevated to priority of highest priority task waiting for that semaphore. Enabled on mutex semaphore by specifying the SEM_INVERSION_SAFE option during semMCreat( ). Must also specify SEM_Q_PRIORITY (SEM_Q_FIFO is inpatible with SEM_INVERSION_SAFE). 嵌入式培訓專題 微迪軟件培訓中心 Priority Inversion Safety High Priority Medium Priority Low Priority Pended tHigh unblocks tMediumunblocks semTake( ) Pended Pend Ready semTake( ) Critical Region Ready time semGive( ) 嵌入式培訓專題 微迪軟件培訓中心 Avoiding Mista
點擊復制文檔內(nèi)容
教學課件相關推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1