7 | | A GIET_VM task is similar to a POSIX thread. A task is statically allocated to a physical processor, as defined in the mapping, and the GIET-VM does not support task migration. There is one scheduler per processor, and the max number of task on one single processor cannot be larger than 13. A task can be in three different states: |
8 | | * '''RUNNING''' the task is currently executed. |
9 | | * '''RUNABLE''' the task is not running, but can be selected for execution at the next TICK. |
10 | | * '''BLOCKED''' the task is blocked, waiting on a condition defined in the NORUN context slot. |
| 7 | The GIET_VM threads try to implement the POSIX threads. A thread is statically allocated to a physical processor, as defined in the mapping, and the GIET-VM does not support thread migration. There is one scheduler per processor, and the max number of threads on one single processor cannot be larger than 13. A thread can be in three different states: |
| 8 | * '''RUNNING''' the thread is currently executed. |
| 9 | * '''RUNNABLE''' the thread is not running, but can be selected for execution at the next TICK. |
| 10 | * '''BLOCKED''' the thread is blocked, waiting on a condition defined in the NORUN context slot. |
49 | | This function performs a context switch between the running (calling) task and another runable task, using a round-robin sheduling policy between all tasks allocated to a given processor (static allocation). |
50 | | It selects the next runable task to resume execution. |
51 | | If the only runable task is the current task, return without context switch. |
52 | | If there is no runable task, the scheduler switch to the default "idle" task. |
53 | | The return address contained in $31 is saved in the current task context (in the ctx[31] slot), and the function actually returns to the address contained in the ctx[31] slot of the next task context. |
54 | | |
55 | | === void '''_ctx_exec_task'''( unsigned int ltid ) |
56 | | |
57 | | === void '''_ctx_kill_task'''( unsigned int ltid ) |
| 48 | This function performs a context switch between the running (calling) thread and another runnable thread, using a round-robin sheduling policy between all threads allocated to a given processor (static allocation). |
| 49 | It selects the next runable thread to resume execution. |
| 50 | If the only runnable task is the current task, return without context switch. |
| 51 | If there is no runable task, the scheduler switch to the default "idle" thread. |
| 52 | The return address contained in $31 is saved in the current thread context (in the ctx[31] slot), and the function actually returns to the address contained in the ctx[31] slot of the next thread context. |