1. What is task?
A task is a unit of work that a processor can dispatch, execute, and suspend.
2. Task Structure.
A task is made up of two parts: a task execution space and a task-state segment
(TSS). The task execution space consists of a code segment(cs), a stack segment(ss), and
one or more data segments(ds).
The TSS specifies the segments that make up the task execution space and provides
3. Executing a task.
Software or the processor can dispatch a task for execution in one of the following
ways:
*A explicit call to a task with the CALL instruction.
*A explicit jump to a task with the JMP instruction.
*An implicit call (by the processor) to an interrupt-handler task.
*An implicit call to an exception-handler task.
*A return (initiated with an IRET instruction) when the NT flag in the EFLAGS
register is set.
4. Data structure for handling task-related activities:
a storage place for task state information. In multitasking systems, the TSS also
provides a mechanism for linking tasks.
Task-state segment (TSS). including all the general registers, segment selectors, iomap base address, espX...Similar as trap frame in jos.
Task-gate descriptor. -> A way to access TSS descriptor( final goal is still access a task), maybe in GDT, LDT or IDT.
TSS descriptor. -> it's stored only in GDT, not LDT or IDT
Task register. 2 parts, visible part point to TSS descriptor in GDT, invisible part cache the segment descriptor. Use STR/LDR to w/r visible part.
NT flag in the EFLAGS register.
5. What's in GDT?
Different Segment Descriptors: Kernel text, Kernel data, User text, User data, TSS descriptors for each CPU.