0
23kviews
What is a task and various states that a task can lie in embedded environment.
1 Answer
4
1.8kviews
  1. A task is also called a thread, is a simple program that thinks it has a CPU all to itself.
  2. A task consists of a sequentially executable program under a state-control by OS.
  3. The state information of a task is represented by task state, task structure – its data, objects and resource and task control block.
  4. The design for real time application involves splitting the work into tasks responsible for a portion of problem.
  5. Each task has its own priority, its own set of CPU register and its own stack area.
  6. Thus a task can be defined as an embedded program computational unit that runs on a CPU under the state-control of kernel of an OS. It has a state which at instance defines its status, structure, data, objects and resources and control block.

Task States:

enter image description here

Each task typically is an infinite loop that can be in any one of five states: dormant, ready, running, waiting (for an event), or ISR (interrupted)

  1. Dormant: The task has been created and a memory is allotted to its structure but the kernel has not scheduled this task.
  2. Ready: The created task is ready and has been scheduled by the kernel. This task however is not running because a higher priority task is under execution by the CPU.
  3. Running: The task has access to all the shared resources required for its execution. The CPU executes the task in this state until an higher priority task requests the CPU for its execution
  4. Waiting: The task is said to be blocked. In this case the task is waiting for a resource which could be some data being processed by some other task or an external real- world input.
  5. Interrupted (ISR): Finally, a task is in the ISR state when an interrupt has occurred and the CPU is in the process of servicing the interrupt. Figure also shows the functions provided by μC/OS-II to make a task move from one state to another.
Please log in to add an answer.