USF CS 630 - Task-Switching (25 pages)

Previewing pages 1, 2, 24, 25 of 25 page document View the full content.
View Full Document

Task-Switching



Previewing pages 1, 2, 24, 25 of actual document.

View the full content.
View Full Document
View Full Document

Task-Switching

72 views

Lecture Notes


Pages:
25
School:
University of San Francisco
Course:
Cs 630 - Advanced Microcomputer Programming
Advanced Microcomputer Programming Documents

Unformatted text preview:

Task Switching How the x86 processor assists with context switching among multiple program threads Program Model Programs consist of data and instructions Data consists of constants and variables which may be persistent or transient Instructions may be private or shared These observations lead to a conceptual model for the management of programs and to special processor capabilities that assist in supporting that conceptual model Conceptual Program Model runtime library STACK created during runtime Private Data transient heap BSS created at compile time Shared Instructions and Data persistent DATA TEXT Uninitialized Data persistent Initialized Data persistent Private Instructions persistent Task Isolation The CPU is designed to assist the system software in isolating the private portions of one program from those of another while they both are residing in physical memory while allowing them also to share certain instructions and data in a controlled way This sharing includes access to the CPU whereby the tasks take turns at executing IDT Multi tasking GDT IDTR TR GDTR TSS 1 TSS 2 shared runtime library STACK STACK supervisor space ring0 user space ring3 SP SS heap heap BSS BSS DATA DATA TEXT TEXT Task 1 Task 2 DS IP CS Context Switching The CPU can perform a context switch to save the current values of all its registers in the memory area referenced by the TR register and to load new values into all its registers from the memory area specified by a new Task State Segment selector There are four ways to trigger this taskswitch operation on x86 processors How to cause a task switch Use an ljmp instruction long jump ljmp task selector 0 Use an lcall instruction long call lcall task selector 0 Use an int n instruction with a task gate int 0x80 Use an iret instruction with NT 1 iret ljmp and lcall These instructions are similar they both make use of a selector for a Task State Segment descriptor Base 31 24 A Limit 000 V P 19 16 L Base 15 0 D P 0 type Base 23 16 L Limit



View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view Task-Switching and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Task-Switching and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?