02.01.2015 Views

CooCox CoOS User's Guide

CooCox CoOS User's Guide

CooCox CoOS User's Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2.4 Task Ready List<br />

<strong>CooCox</strong> <strong>CoOS</strong> links all the TCB of ready tasks together according to the level<br />

of the priority through two-way linked list. This ensures that the first item of the<br />

list is always the one which has the highest priority and is the most in need of<br />

task scheduling.<br />

<strong>CooCox</strong> <strong>CoOS</strong> allows multiple tasks to share the same priority level.<br />

Therefore, tasks with the same priority will inevitably occur in the ready list.<br />

<strong>CooCox</strong> <strong>CoOS</strong> follows the principle "first-in-first out (FIFO)": put the latest task<br />

in the last of the tasks which share the same priority so that all of them can<br />

obtain its own CPU runtime.<br />

TCBRdy is the beginning of the ready list in <strong>CooCox</strong> <strong>CoOS</strong>. In other words,<br />

TCBRdy is the TCB of the task which has the highest priority in the ready list.<br />

Therefore, when starting a task scheduling, which only need to be checked is<br />

whether the priority of the task that TCBRdy pointed to is higher than the<br />

current running one. In this way, the efficiency of the task scheduling can be<br />

improved to the maximum.<br />

TCB 0(TCB Rdy) TCB 1 TCB 2 TCB n<br />

NULL<br />

TCBprev<br />

TCBprev<br />

TCBprev<br />

TCBprev<br />

TCBnext<br />

TCBnext<br />

TCBnext<br />

TCBnext<br />

NULL<br />

Figure 2.4.1 Task ready list<br />

15

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!