Tasks, Process and Threads
Sequential Execution of Instructions
- Each task is independent since it is controlled by a scheduler or kernel of an Operating System
- No task can call other tasks. since the Scheduler schedules the tasks
- Each task is associated with an ID.
- Each task has priority. for a 1 byte priority assignment, values 0 to 255 is used. higher the value higher the priority
- Each task should coded in such a way that, they are waiting for a endless - event waiting loop.
- Each task has a Task Control Block (TCB)
- Each task will be having its own context and values at an instant. it is having its own Program counter(PC) and stack pointer (SP.
- Each task will be in any one of the following 4 states
- idle - After the completion of one cycle of execution, a task will be in idle state until an event is fired
- ready - the task is ready to execute on the CPU, but the CPU is busy with executing higher priority tasks
- Running - currently the task is executing on the CPU - only one task can be in this state at any point of time
- Blocked or waiting - the task is waiting for an event to execute
- Each task or process contains light weight process called threads. Each process or tasks more than one thread.
- Tasks are kernel controlled entity where the threads are task controlled entity
- Threads are sub process or sub tasks.
- Different threads of same task can share the common structure available for the tasks