Memory segmentation: Difference between revisions

Content deleted Content added
Reaur (talk | contribs)
Tags: canned edit summary Mobile edit Mobile app edit Android app edit
Citation bot (talk | contribs)
Alter: title. Add: s2cid, doi, pages, issue, volume. Formatted dashes. | Use this bot. Report bugs. | Suggested by Whoop whoop pull up | #UCB_toolbar
Line 6:
Different segments may be created for different program [[module (programming)|module]]s, or for different classes of memory usage such as [[Code segment|code]] and [[data segment]]s.<ref name="glaser1965"/> Certain segments may be shared between programs.<ref name="holt1961"/><ref name="englander" />
 
Segmentation was originally invented as a method by which [[system software]] could isolate different software [[Process (computing)|processes]] ([[Task (computing)|tasks]]) and data they are using. It was intended to increase reliability of the systems running multiple processes simultaneously.<ref name=":0">{{Cite book|url=https://www.amd.com/system/files/TechDocs/24593.pdf|title=AMD64 Technology AMD64 Architecture Programmer’sProgrammer's Manual Volume 2: System Programming|publisher=Advanced Micro Devices|year=2018|volume=2|pages=5|language=en|chapter=1.2 Memory Management}}</ref> In a [[X86-64|x86-64 architecture]] it is considered legacy and most x86-64-based modern system software don't use memory segmentation. Instead they handle programs and their data by utilizing [[Paging|memory-paging]] which also serves as a way of memory protection. However most x86-64 implementations still support it for backward compatibility reasons.<ref name=":0" />
 
==Hardware implementation==
Line 18:
In this case each segment has an associated flag indicating whether it is present in main memory or not. If a segment is accessed that is not present in main memory, an exception is raised, and the [[operating system]] will read the segment into memory from secondary storage.
 
Segmentation is one method of implementing [[memory protection]].<ref name="ostep-1">{{cite book|title=Operating Systems: Three Easy Pieces|chapter=Segmentation|chapter-url=http://pages.cs.wisc.edu/~remzi/OSTEP/vm-segmentation.pdf|publisher= Arpaci-Dusseau Books|year = 2014|first1 = Remzi H.|last1 =Arpaci-Dusseau|first2=Andrea C.|last2 = Arpaci-Dusseau}}</ref> [[Page (computer memory)|Paging]]<!-- please, do not "simplify" or "fix" the link. The [[paging]] article is about a virtual memory technique, not about memory protection --> is another, and they can be combined. The size of a memory segment is generally not fixed and may be as small as a single [[byte]].<ref>{{cite book|publisher=Intel Corporation|title=Intel® 64 and IA-32 Architectures Software Developer’sDeveloper's Manual Volume 3 (3A, 3B & 3C): System Programming Guide|year=2012|pages=3–13|url=http://download.intel.com/products/processor/manual/325384.pdf}}</ref>
 
Segmentation has been implemented in several different ways on different hardware, with or without paging. Intel [[x86 memory segmentation]] does not fit either model and is discussed separately below, and also in greater detail in a separate article.
Line 98:
The [[Intel 80386]] and later processors also support paging; in those processors, the segment table, rather than pointing to a page table for the segment, contains the segment address in ''linear memory''. Addresses in linear memory are then mapped to physical addresses using a separate page table, if paging is enabled.
 
The [[x86-64]] architecture does not use segmentation in long mode (64-bit mode).<ref name=":1">{{Cite book|url=https://www.amd.com/system/files/TechDocs/24594.pdf|title=AMD64 Technology AMD64 Architecture Programmer’sProgrammer's Manual Volume 2: System Programming|publisher=Advanced Micro Devices|year=2018|volume=2|language=en}}</ref> In a [[X86-64|x86-64 architecture]] it is considered legacy and most x86-64-based modern system software don't use memory segmentation. Instead they handle programs and their data by utilizing [[Paging|memory-paging]] which also serves as a way of memory protection. Though most x86-64 implementations still support it for backward compatibility reasons.<ref name=":0" /> Four of the segment registers: CS, SS, DS, and ES are forced to 0, and the limit to 2<sup>64</sup>. The segment registers FS and GS can still have a nonzero base address. This allows operating systems to use these segments for special purposes.
 
== See also ==
Line 121:
|year=1961
|journal=Communications of the ACM
|volume=4
|issue=10
|pages=422–431
|doi=10.1145/366786.366795
|s2cid=18973700
}}
</ref>