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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.6. MEMORY POOL MANAGEMENT FUNCTIONS 155<br />

4.6.2 Variable-size Memory Pool<br />

A variable-size memory pool is an object for dynamically managing memory blocks of any size. Functions<br />

are provided for creating and deleting a variable-size memory pool, allocating and returning memory<br />

blocks in a variable-size memory pool, and referencing the status of a variable-size memory pool. A<br />

variable-size memory pool is an object identified by an ID number called a variable-size memory pool<br />

ID.<br />

A variable-size memory pool has a memory space used as the variable-size memory pool (called a<br />

variable-size memory pool area or simply memory pool area), and a queue for tasks waiting for memory<br />

block allocation. A task wanting to allocate a memory block from a variable-size memory pool that<br />

lacks sufficient available memory space goes to WAIT state for variable-size memory block until memory<br />

blocks are returned to the pool. A task in this state is put in the task queue of the variable-size memory<br />

pool.<br />

[Additional Notes]<br />

When tasks are waiting for memory block allocation from a variable-size memory pool, they are served in<br />

queued order. If, for example, Task A requesting a 400-byte memory block from a variable-size memory<br />

pool is queued along with Task B requesting a 100-byte block, in A-B order, then even if 200 bytes of<br />

space are free, Task B is made to wait until Task A has acquired the requested memory block.<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!