Monday, 5 December 2011

Memory Organization in 80386

The Physical memory of 80386 is organized as a sequence of bytes. Each byte is assigned a unique address that ranges from zero to a maximum of 2^(32) -1 (4 gigabytes). The logical memory of 80386 can address up to 2^(46) bytes (64 terabytes).
The two types of memory models in 80386 are

  • A "flat" address space consisting of a single array of up to 4 gigabytes.
  • A segmented address space consisting of a collection of segmants.
Both  model provides memory protection.

Flat Model
In a flat model , a programmer sees memory as a single array up to 4GB. The processor maps the 4 GB flat space onto the physical address space by the address translation mechanisms.
A pointer into this flat address space is a 32-bit ordinal number that may range from 0 to 2^(32) -1. Relocation of separately-compiled modules in this space must be performed by systems software (e.g., linkers, locators, binders, loaders)

Segmented Model
In Segmented model, address space is viewed as collection of segments. The segmented model can consist of 16,383 segments.
Applications programmers view the logical address space of the 80386 as a collection of up to 16,383 one-dimensional subspaces, each with a specified length. Each of these linear subspaces is called a segment. A segment is a unit of contiguous address space. Segment sizes may range from one byte up to a maximum of 2^(32) bytes (4 gigabytes).

A pointer in this address space consists of two parts:
  •  A segment selector, which is a 16-bit field that identifies a segment.
  •  An offset, which is a 32-bit ordinal that addresses to the byte level within a  segment.