A task can exist in one of the following states in CooCox CoOS.
Ready State(TASK_READY):Ready tasks are those that are able to execute (they are not waiting or dormant) but are not currently executing because a different task of equal or higher priority is already in the Running state. A task will be in this state after being created.
Running State(TASK_RUNNING):When a task is actually executing it is said to be in the Running state. It is currently occupying the processor.
Waiting State(TASK_WAITING):Wait for an event to occur. A task will be in the waiting state if it is currently waiting for a certain event in CooCox CoOS.
The Dormant State(TASK_DORMANT):The task has been deleted and is not available for scheduling. The dormant state is not the same as the waiting state. Tasks in the waiting state will be reactivated and be available for the scheduling when its waiting events have satisfied. However, tasks in the dormant state will never be reactivated.
The state of a task can be changed among the above four states. You can call CoSuspendTask ( ) to convert a task which in the running or ready state to the waiting state. By calling CoAwakeTask ( ) you can also convert the state of a task from the waiting state to the ready state(as shown in Figure 2.2.1).