Multitasking
Multitasking is a technique that manages a computer system's work
when that work consists of multiple activities such as editing a
file, compiling a program, or performing inter-system transfers.
Individual tasks execute as if they run on dedicated processors
and share a common memory. It appears that, except for pauses to
communicate or synchronize with other tasks, each task runs in
parallel with all other tasks. The 80386 (80286+) contains
hardware to support multitasking.
The 80386 uses no special instructions to control multitasking.
Instead, it interprets ordinary control-transfer instructions
differently when they refer to the special data structures. The
registers and data structures that support multitasking are:
- Task State Segment (TSS)
- TSS descriptor
- Task Register (TR)
- Task Gate descriptor
──────────────────────────────────────────────────────────────────
In addition to the simple task switch, the 80386 offers two other
task-management features:
■ With each task switch, the processor can also switch to
another LDT and to another page directory. Thus each task can
have a different logical-to-linear mapping and a different
linear-to-physical mapping. Using this feature, tasks can be
isolated and prevented from interfering with one another.
■ Interrupts and exceptions can cause task switches if needed in
the system design. The 80386 not only switches to the task
that handles the interrupt or exception, but it automatically
switches back to the interrupted task when the interrupt or
exception has been serviced.
In reality, the multitasking simulates multiple processors by
providing each task with a virtual processor. That is, at any one
instant, the operating system assigns the real processor to any
one of the virtual processors, which then runs that virtual
processor's task. To do this, the 80386 uses Task State Segments
(TSS) and instructions that switch tasks.