Segmentation
Presented
By:
• Segmentation is a technique for breaking
memory up into logical pieces
• Each “piece” is a grouping of related
information
– data segments for each process
– code segments for each process
– data segments for the OS
– etc.
• Like paging, use virtual addresses and use disk
to make memory look bigger than it really is
• Segmentation can be implemented with or
without paging
Addressing Segments
• Let’s first assume no paging in the system
• User generates logical addresses
• These addresses consist of a segment number and an
offset into the segment
• Use segment number to index into a table
• Table contains the physical address of the start of
the segment(base address) and the limit.
• Add the offset to the base and generate the physical
address
– before doing this, check the offset against a limit
– the limit is the size of the segment
Addressing Segments
S o
o < limit
limit base
+ Physical Address
error
yes
no
segment table
logical
address
Segmentation logical address space
logical address space
OS Code OS data OS stack
P1 data
P1 code
print
function
P2 code
P2 data
Segmentation logical address space
logical address space
OS Code OS data OS stack
P1 data
P1 code
print
function
P2 code
P2 data

Segmentation

  • 1.
  • 2.
    • Segmentation isa technique for breaking memory up into logical pieces • Each “piece” is a grouping of related information – data segments for each process – code segments for each process – data segments for the OS – etc. • Like paging, use virtual addresses and use disk to make memory look bigger than it really is • Segmentation can be implemented with or without paging
  • 3.
    Addressing Segments • Let’sfirst assume no paging in the system • User generates logical addresses • These addresses consist of a segment number and an offset into the segment • Use segment number to index into a table • Table contains the physical address of the start of the segment(base address) and the limit. • Add the offset to the base and generate the physical address – before doing this, check the offset against a limit – the limit is the size of the segment
  • 4.
    Addressing Segments S o o< limit limit base + Physical Address error yes no segment table logical address
  • 5.
    Segmentation logical addressspace logical address space OS Code OS data OS stack P1 data P1 code print function P2 code P2 data
  • 6.
    Segmentation logical addressspace logical address space OS Code OS data OS stack P1 data P1 code print function P2 code P2 data