segmentation
DESCRIPTION
TRANSCRIPT
Segmentation
Pradyumna
Definition
• Way of offering protection to different data types and code.
Descriptor Tables
• Descriptor table is a array of 8k Descriptors• 3 types – Global Descriptor Table (GDT)– Local Descriptor Table (LDT)– Interrupt Descriptor Table (IDT)
GDT&LDT
GDT• Contains Global descriptors
common to all tasks• Contains al the descriptor
types except interrupt & trap descriptors
LDT• Contains descriptors specific
to a particular task• Contains segment , task
gate & call gate descriptors.
IDT• The Interrupt Descriptor Table (IDT) is a data
structure used to implement an interrupt vector table.
• The IDT is used by the processor to determine the correct response to interrupts & exceptions.
• Use of the IDT is triggered by three types of events: hardware interrupts, software interrupts, and processor exceptions, which together are referred to as "interrupts".
• The IDT consists of 256 interrupt vectors
Descriptors
• These carry all the info about a segment and its access rights
• These have 20 bit segment limit and 32-bit segment address.
• 5 types of descriptors– Code or data segment Descriptors– System Descriptors– Local Descriptors– TSS (Task State segment) Descriptors– GATE Descriptors
Segment descriptor
• Segment descriptors are a part of the segmentation unit, used for translating a logical address to linear address. Segment descriptors describe the memory segment referred in the logical address
TSS• The Task State Segment is a structure which
holds information about a task. • It is used by the OS kernel for task management. • Specifically, the following information is stored
in the TSS:– Processor register state– I/O Port permissions– Inner level stack pointers– Previous TSS link
Gate Descriptors
• Mechanism, for changing the privilege level of the CPU when it executes a predefined function callusing a CALL FAR instruction.
• A Accessed Bit• G Granularity Bit-1=Segment
Length is page granular,0=Segment length is byte granular
• D Default Operation Size-1=32 bit segment,0=16-segment
• 0 Bit must be zero for compatibility with future processors
• AVL Available field for user or OS
• BASE Base Address of the segment
• LIMIT the length of the segment
• P Present BIT-1=Present,0=Not Present
• DPL Descriptor Privilege Level 0-3
• S Segment Descriptor -0=System Descriptor ,1=Code or Data Segment Descriptor
• TYPE type of segment
Advantages
• memory protection added to segment table like paging
• sharing of memory similar to paging (but per area rather than per page)
Drawbacks
• Allocation algorithms as for memory partitions• External fragmentation, back to compaction
problem.