30.12.2013 Views

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

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.

60 CHAPTER 4. T-KERNEL/OS FUNCTIONS<br />

[Additional Notes]<br />

When a task is in WAIT state for resource acquisition (semaphore wait, etc.) and is also in SUSPEND<br />

state, the resource allocation (semaphore allocation, etc.) takes place under the same conditions as<br />

when the task is not in SUSPEND state. Resource allocation is not delayed by the SUSPEND state,<br />

and there is no change whatsoever in the priority of resource allocation or release from WAIT state. In<br />

this way SUSPEND state is in an orthogonal relation with other processing and task states.<br />

In order to delay resource allocation to a task in SUSPEND state (temporarily lower its priority), the<br />

user can employ tk sus tsk and tk rsm tsk in combination with tk chg pri.<br />

Task suspension is intended only for very limited uses closely related to the OS, such as page fault<br />

processing in a virtual memory system or breakpoint processing in a debugger. As a rule it should not<br />

be used in ordinary applications or in middleware.<br />

The reason is that task suspension takes place regardless of the target task running state. If, for example,<br />

a task is put in SUSPEND state while it is calling a middleware function, the task will be stopped in<br />

the course of middleware internal processing. In some cases middleware performs resource management<br />

or other mutual exclusion control. If a task stops inside middleware while it has resources allocated,<br />

other tasks may not be able to use that middleware. This situation can cause a chain reactions, with<br />

other tasks stopping and leading to system-wide deadlock.<br />

For this reason a task must not be stopped without knowing its status (what it is doing at the time),<br />

and ordinary tasks should not use the task suspension function.<br />

Copyright c○ 2002, 2003 by T-Engine Forum<br />

T-<strong>Kernel</strong> <strong>1.B0.02</strong>

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

Saved successfully!

Ooh no, something went wrong!