【译】x86程序员手册24-第7章 多任务

Chapter 7 Multitasking 多任务

To provide efficient, protected multitasking, the 80386 employs several special data structures. It does not, however, use 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:

为提供高效的、保护的多任务,80386实现了几个数据结构。然而,不能使用特殊的指令来控制多任务;相反,它当普通的控制转移指令引用特定的数据结构时,以不同的方式来解释。这些用来支撑多任务的寄存器和数据结构是:

  • Task state segment 任务状态段
  • Task state segment descriptor 任务状态描述符
  • Task register 任务寄存器
  • Task gate descriptor 任务门描述符

With these structures the 80386 can rapidly switch execution from one task to another, saving the context of the original task so that the task can be restarted later. In addition to the simple task switch, the 80386 offers two other task-management features:

利用这些特性,80386可以迅速地从一个任务切换到另一个任务执行,保存原始任务的上下文环境以便任务可以在随后继续执行。对于简单的任务切换,80386额外提供了两个任务管理特性:

  1. Interrupts and exceptions can cause task switches (if needed in the system design). The processor not only switches automatically 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. Interrupt tasks may interrupt lower-priority interrupt tasks to any depth.

中断的异常可以导致任务切换(视系统设计需求)。处理器不仅自动切换到一个处理中断或异常的任务,而且当中断或异常结束服务后会自动切换回被中断的任务。中断任务可以中断低优先级的中断任务到任何深度。

  1. With each switch to another task, the 80386 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. This is yet another protection feature, because tasks can be isolated and prevented from interfering with one another.

当每次切换到另一个任务时,80386也可以切换到另一个LDT和另一个页目录。这样,每个任务都可以有不同的逻辑到线性地址的映射和不同的线性地址到物理地址的映射。这也是另一个保护特性,因为任务可以被隔离并阻止任务间相互干扰。

原文地址:https://www.cnblogs.com/mqmelon/p/6692624.html