13.07.2015 Views

iAPX 286 Operating System Writers Guide 1983

iAPX 286 Operating System Writers Guide 1983

iAPX 286 Operating System Writers Guide 1983

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 4TASK MANAGEMENTThe primary responsibility of an operating system is to allocate the processor to the executing tasks sothat each task makes progress consistent with its role in the application. This chapter examines howthe task-oriented features of the <strong>iAPX</strong> <strong>286</strong> hardware apply to conventional task-management concepts.HARDWARE TASK-MANAGEMENT FEATURESThe operating system's responsibility for managing a multitasking system is reduced by <strong>iAPX</strong> <strong>286</strong>features for saving and restoring task state and switching between tasks.Storing Task StateThe state of a task (from the processor's point of view) is the contents of the registers used by thattask. The architecture of the <strong>iAPX</strong> <strong>286</strong> defines a special type of segment, the task state segment (TSS),for storing the 80<strong>286</strong>-related state of a task. Multitasking operating systems on any processor need tostore similar information. The <strong>iAPX</strong> <strong>286</strong> requires merely that a specific format be used so that theCPU can store and restore task state automatically. Figure 4-1 illustrates a TSS and related hardwarestructures.The processor keeps the location of the TSS of the currently executing task in the task register. Thetask register has two parts:• The "visible" portion, which a task can access. This part contains a selector to the descriptor (inthe GDT) for the current TSS.• The "invisible" portion, which tasks do not control. When the contents of the visible portion arechanged, the processor loads the invisible portion with the base and limit values from the TSSdescriptor indexed by the selector in the visible portion.There are two ways to change the task register:• By one of the task switching operations described later in this section.• By the LTR instruction. L TR is used to give the task register its initial value during system initialization.Only privilege-level 0 (PL-O) procedures can execute L TR.Because TSSs correspond one-to-one with tasks, the selector of a TSS uniquely identifies a task. TheSTR instruction reads the task register into a selector. <strong>Operating</strong>-system procedures can use STR toidentify the calling task. The built-in variable TASK$REGISTER gives PL/M-<strong>286</strong> programs accessto the task register.The items in the TSS fall into four classes:• Back link. Contains a selector to the TSS of the calling (or interrupted) task (if any).• LDT selector. Contains a selector to this task's LDT.4-1 121960-001

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!