Welcome!!
Siraj Munir – CS@DSU12/21/2016 1
CS206 Operating System
Siraj Munir – CS@DSU12/21/2016 2
Tip of The Day
discourager.ignore();
(Courtesy: Syed Hammad Ahmed – CS@DSU)
12/21/2016 3
Recap:
• Contiguous Memory
• Fragmentation
Siraj Munir – CS@DSU
12/21/2016 4
Segmentation
12/21/2016 5
Segmentation:
Memory-management scheme that supports user view of memory
(Programmar’s View).
A program is a collection of segments. A segment is a logical unit such as:
• main program
• procedure
• function
• method
• object
• local variables, global variables
• common block
• stack
• symbol table
• arrays
Siraj Munir – CS@DSU
12/21/2016 6
User’s View of a Program:
Siraj Munir – CS@DSU
12/21/2016 7
Logical View of Segmentation
Siraj Munir – CS@DSU
1
2
3
4
1
4
2
3
user space physical memory space
12/21/2016 8
Segmentation :
Each segment has a name and length
Address specify both the segment name and offset
Instead of using name the segments are numbered
The logical address consists of a tuple:
<segment-number,offset>
Siraj Munir – CS@DSU
12/21/2016 9
Segmentation Architecture:
Logical address consists of a two tuple:
<segment-number, offset>,
Segment table – maps two-dimensional physical addresses; each table entry has:
base – contains the starting physical address where the segments reside in memory
limit – specifies the length of the segment
Segment-table base register (STBR) points to the segment table’s location in memory
Segment-table length register (STLR) indicates number of segments used by a program;
segment number s is legal if s < STLR
Siraj Munir – CS@DSU
12/21/2016 10
Segmentation Hardware:
Siraj Munir – CS@DSU
12/21/2016 11
Segmentation Hardware:
Logical address generated by CPU consists of two parts
Segment no. ‘s’:-used as a index into segment table
Offset ‘d’:- must be between ‘0’ and segment limit
A trap is generated if offset exceeds the segment limit
(Correct offset + segment base = address in physical memory)
Segment table is an array of base-limit register pair
Siraj Munir – CS@DSU
12/21/2016 12
Siraj Munir – CS@DSU
Questions??
12/21/2016 13
Siraj Munir – CS@DSU
Reference:
https://www.youtube.com/watch?v=HWwNTWY1rxo
http://www.slideshare.net/rajmohan50/paging-and-segmentation-in-operating-system
https://classroom.udacity.com/courses/ud923/lessons/301489
8657/concepts/30515485910923#
https://en.wikibooks.org/wiki/Operating_System_Design/Segmentation
12/21/2016 14
Siraj Munir – CS@DSU
Thankyou!
12/21/2016 15

Segmentation in Operating Systems.

  • 1.
    Welcome!! Siraj Munir –CS@DSU12/21/2016 1
  • 2.
    CS206 Operating System SirajMunir – CS@DSU12/21/2016 2
  • 3.
    Tip of TheDay discourager.ignore(); (Courtesy: Syed Hammad Ahmed – CS@DSU) 12/21/2016 3
  • 4.
    Recap: • Contiguous Memory •Fragmentation Siraj Munir – CS@DSU 12/21/2016 4
  • 5.
  • 6.
    Segmentation: Memory-management scheme thatsupports user view of memory (Programmar’s View). A program is a collection of segments. A segment is a logical unit such as: • main program • procedure • function • method • object • local variables, global variables • common block • stack • symbol table • arrays Siraj Munir – CS@DSU 12/21/2016 6
  • 7.
    User’s View ofa Program: Siraj Munir – CS@DSU 12/21/2016 7
  • 8.
    Logical View ofSegmentation Siraj Munir – CS@DSU 1 2 3 4 1 4 2 3 user space physical memory space 12/21/2016 8
  • 9.
    Segmentation : Each segmenthas a name and length Address specify both the segment name and offset Instead of using name the segments are numbered The logical address consists of a tuple: <segment-number,offset> Siraj Munir – CS@DSU 12/21/2016 9
  • 10.
    Segmentation Architecture: Logical addressconsists of a two tuple: <segment-number, offset>, Segment table – maps two-dimensional physical addresses; each table entry has: base – contains the starting physical address where the segments reside in memory limit – specifies the length of the segment Segment-table base register (STBR) points to the segment table’s location in memory Segment-table length register (STLR) indicates number of segments used by a program; segment number s is legal if s < STLR Siraj Munir – CS@DSU 12/21/2016 10
  • 11.
    Segmentation Hardware: Siraj Munir– CS@DSU 12/21/2016 11
  • 12.
    Segmentation Hardware: Logical addressgenerated by CPU consists of two parts Segment no. ‘s’:-used as a index into segment table Offset ‘d’:- must be between ‘0’ and segment limit A trap is generated if offset exceeds the segment limit (Correct offset + segment base = address in physical memory) Segment table is an array of base-limit register pair Siraj Munir – CS@DSU 12/21/2016 12
  • 13.
    Siraj Munir –CS@DSU Questions?? 12/21/2016 13
  • 14.
    Siraj Munir –CS@DSU Reference: https://www.youtube.com/watch?v=HWwNTWY1rxo http://www.slideshare.net/rajmohan50/paging-and-segmentation-in-operating-system https://classroom.udacity.com/courses/ud923/lessons/301489 8657/concepts/30515485910923# https://en.wikibooks.org/wiki/Operating_System_Design/Segmentation 12/21/2016 14
  • 15.
    Siraj Munir –CS@DSU Thankyou! 12/21/2016 15

Editor's Notes

  • #5 Segmentation is a Memory management scheme that supports user view of memory.
  • #6 As we’ve already seen, the user’s view of memory is not the same as the actual physical memory. What if the hardware could provide a memory mechanism that mapped the programmer’s view to the actual physical memory? The system would have more freedom to manage memory, while the programmer would have a more natural programming environment. Segmentation provides such a mechanism.
  • #7 Segmentation is a Memory management scheme that supports user view of memory.
  • #9 User jo physical memory interact krne k liye asaani hou, 4 process hain, 1,4,2,3 ko aesay place krdia hai k 4ro k aik hisab se memory milay, Alag alag segments mei divide krde, agar koi naya process aye tou who aik format mei aajaega, bajae iske k who idhr udhr allocate hojae.
  • #11 Segment table has two addresses, Base and Limit, STBR location ko point krta hai, aur STLR segments ki length batata hai.