...
/*在freelist中, 只有application存取, 可用semaphore取代, 但最好不要, 因為overhead大*/
OS_ENTER_CRITICAL();
ptcb=OSTCBFreeList;
if(){
OSTCBFreeList=ptcb->OSTCBNext;
OS_EXIT_CRITICAL();
...
...
...
/*不可用semaphore取代, 此段功能是把task放到readyQ中, 若用semaphore取代, ISR可能會去存取readyQ, 故不可取代*/
OS_ENTER_CRITICAL();
OSTCBPrioTbl[prio]=ptcb;
ptcb->OSTCBNext=OSTCBList;
ptcb->OSTCBPrev=(OS_TCB*)0;
if(OSTCBList!=(OS_TCB*)0){
OSTCBList->OSTCBPrev=ptcb;
}
OSTCBList=ptcb;
OSRdyGrp:=ptcb->OSTCBBitY;
OSRdyTbl[ptcb->OSTCBY]:=ptcb->OSTCBBitX;
OS_EXIT_CRITICAL();
...
}
ready list:
在readyQ中要做的3件事:
- insert
- delete
- find min. priority
由ready list再加上 OSUnMapTbl[]可迅速查出目前readyQ中priority最高的task位在哪個位置
沒有留言:
張貼留言