You are on page 1of 29

Intel 32 and 64-bit Architectures

IA-32 Architecture
IA-32 Segmentation
• The IA-32 architecture allows a segment to be as large as 4 GB, and the
maximum number of segments per process is 16 K.
• The logical address space of a process is divided into two partitions.
– The first partition consists of up to 8K segments that are private to
that process.
– The second partition consists of up to 8 K segments that are shared
among all the processes.
• Information about the first partition is kept in the local descriptor table
(LDT); information about the second partition is kept in the global
descriptor table (GDT).
• Each entry in the LDT and GDT consists of an 8-byte segment descriptor
with detailed information about a particular segment, including the
base location and limit of that segment.
• The logical address is a pair (selector, offset), where
the selector is a 16-bit number in which s designates
the segment number, g indicates whether the
segment is in the GDT or LDT, and p deals with
protection.

• offset is a 32-bit number


IA-32 segmentation
IA-32 Paging
Paging in the IA-32 architecture
Page address extensions
x86-64 bit architecture
Virtual Memory
Virtual address space
Shared library using virtual memory
Demand Paging
Page Replacement
Page Replacement
Page-replacement algorithm
• FIFO Page Replacement
• Optimal Page Replacement
• LRU Page Replacement
• LRU-Approximation Page Replacement
• Counting-Based Page Replacement
• Page-Buffering Algorithms
1. FIFO Page Replacement
• The simplest page-replacement algorithm is a
first-in, first-out (FIFO) algorithm. When a page
must be replaced, the oldest page is chosen.
Problem
Reference String:
1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5

No.of Frames: 3 Page Fault: ?


No.of Frames: 4 Page Fault: ?
Belady’s anomaly
• The number of faults for four frames (ten) is greater
than the number of faults for three frames (nine)!
• This most unexpected result is known as Belady’s
anomaly: for some page-replacement algorithms,
the page-fault rate may increase as the number of
allocated frames increases.
2. Optimal Page Replacement
• Replace the page that will not be used for the
longest period of time.
3. LRU Page Replacement
• Replace the page that has not been used for
the longest period of time.
3. LRU Page Replacement
Implementation
• Counter • Stack
4. LRU-Approximation Page Replacement

• Additional-Reference-Bits Algorithm
• Second-Chance Algorithm
• Enhanced Second-Chance Algorithm
(i) Additional-Reference-Bits
Algorithm
(ii) Second-Chance Algorithm
(iii) Enhanced Second-Chance Algorithm

By considering the reference bit and dirty bit as an


ordered pair, we now have four classes:
• (0,0): neither recently used nor modified --- best page
to replace
• (0,1): not recently used but modified --- not quite as
good, because the page will need to be written out
before replacement
• (1,0): recently used, but clean --- probably will be used
again soon
• (1,1): recently used and modified --- probably will be
used again soon, and the page will need to be written
out to disk before it can be replaced
Example

You might also like