Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Flat memory model
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{More citations needed|date=December 2009}} '''Flat memory model''' or '''linear memory model''' refers to a [[memory address]]ing paradigm in which "[[computer memory|memory]] appears to the program as a single contiguous [[address space]]."<ref>{{cite book|last1=Gonzalez|first1=Antonio|last2=Latorre|first2=Fernando|last3=Magklis|first3=Grigorios|title=Processor Microarchitecture: An Implementation Perspective|year=2011|publisher=Morgan & Claypool Publishers|isbn=9781608454525|page=72|url=https://books.google.com/books?id=3fW4HiTiUo4C&dq=Processor+Microarchitecture%3A+An+Implementation+Perspective&pg=PP1}}</ref> The [[CPU]] can directly (and [[addressing mode#Sequential addressing modes|linearly]]) [[memory address|address]] all of the available [[computer memory|memory]] locations without having to resort to any sort of [[bank switching]], [[memory segmentation]] or [[paging]] schemes. Memory management and [[CPU cache#Address translation|address translation]] can still be implemented ''on top of'' a flat memory model in order to facilitate the [[operating system]]'s functionality, resource protection, [[computer multitasking|multitasking]] or to increase the memory capacity beyond the limits imposed by the processor's physical address space, but the key feature of a flat memory model is that the entire memory space is linear, sequential and contiguous. In a simple controller, or in a ''single tasking'' embedded application, where memory management is not needed nor desirable, the flat memory model is the most appropriate, because it provides the simplest interface from the programmer's point of view, with direct access to all memory locations and minimum design complexity. In a general purpose computer system, which requires multitasking, resource allocation, and protection, the flat memory system must be augmented by some memory management scheme, which is typically implemented through a combination of dedicated hardware (inside or outside the CPU) and software built into the operating system. The flat memory model (at the physical addressing level) still provides the greatest flexibility for implementing this type of memory management. ==Memory models== {{Prose|section|date=August 2018}} {{Main|1=Memory model (addressing scheme)|l1=Memory model}} Most modern memory models fall into one of three categories: ===Flat unpaged memory model=== *Simple interface for programmers, clean design *Greatest flexibility due to uniform access speed (segmented memory page switches usually incur varied latency due to longer accesses of other pages, either due to extra CPU logic in changing page, or hardware requirements) *Minimum hardware and CPU real estate for simple controller applications{{clarify|date=November 2016}} *Maximum execution speed, as there is no need to access auxiliary data structures such as a segment or page table in [[RAM]] *Not suitable for general computing or multitasking operating systems ===Paged memory model=== {{Main|Paging}} *Suitable for multitasking, general operating system design, resource protection and allocation *Suitable for virtual memory implementation *More CPU real estate, somewhat lower speed *More complex to program *Rigid page boundaries, not always the most memory efficient *This memory model is required when using [[Physical Address Extension]] (PAE) in [[Pentium Pro]] and later x86 CPUs to support 36-bit physical addresses to address more than 4GB of physical memory. ===x86 segmented memory model=== {{Main|Memory segmentation|x86 memory models}} *Similar to paged memory, but paging is achieved by the implicit addition of two relatively shifted registers: '''segment:offset''' *Variable page boundaries, more efficient and flexible than the paged memory model *Quite complex and awkward from a programmer's point of view *More difficult for compilers *Pages can overlap / poor resource protection and isolation *Many to one address translation correspondence: Many '''segment:offset''' combinations resolve to the same physical address *Greater chance of programming errors *Implemented in the original Intel 8086, [[8088]], [[80186]], [[80286]], and supported by [[80386]] and all subsequent [[x86]] machines through to present day [[Pentium]] and [[Core 2]] processors. This memory model has remained ever since in the x86 machines, which now provide multi-mode operation and rarely operate in the compatible segmented mode.{{Clarify|date=July 2010}} See [[x86 memory segmentation]] for details. *saves RAM by moving the segment address, this allows short jumps that require fewer bytes. Within the x86 architectures, when operating in the [[real mode]] (or emulation), physical address is computed as:<ref>[http://www.deinmeister.de/x86modes.htm General description of Real Mode] "The physical address can be calculated as Value_in_segment_register{{not a typo| *}}<!-- it is a citation --> 16 + Value_in_offset_register."</ref> :Address = 16 Γ segment + offset (I.e., the 16-bit segment register is shifted left by 4 bits and added to a 16-bit offset, resulting in a 20-bit address.) ==See also== *[[Address space]] *[[Memory model (disambiguation)]] ==References== {{Reflist}} [[Category:Computer memory]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite book
(
edit
)
Template:Clarify
(
edit
)
Template:Main
(
edit
)
Template:More citations needed
(
edit
)
Template:Not a typo
(
edit
)
Template:Prose
(
edit
)
Template:Reflist
(
edit
)