Page (computing)

Page (computing)

In a context of computer virtual memory, a page, memory page, or virtual page is a fixed-length block of main memory, that is contiguous in both physical memory addressing and virtual memory addressing. A page is usually a smallest unit of data for:
* memory allocation performed by the operating system for a program,
* transfer between main memory and any other auxiliary store, such as hard disk drive.

Virtual memory abstraction allows a page that does not currently reside in main memory to be addressed and used. If a program tries to access a location in such page, it generates an exception called page fault. The hardware or operating system is notified and loads the required page from auxiliary store automatically. A program addressing the memory has no knowledge of a page fault or a process following it. In consequence a program may be easily allowed to address more RAM than actually exists in the computer.

A transfer of pages between main memory and an auxiliary store, such as hard disk drive, is referred to as paging or swapping. [Citation
contribution = Virtual memory systems
title = Encyclopedia of computer science and technology
editor1-last = Belzer
editor1-first = Jack
editor2-last = Holzman
editor2-first = Albert G.
editor3-last = Kent
editor3-first = Allen
publisher = CRC Press
volume=14
pages = 32
year = 1981
url = http://books.google.com/books?id=KUgNGCJB4agC&printsec=frontcover
isbn = 0824722140
]

Page size trade-off

Page size is usually determined by a processor architecture. Traditionally, pages in a system had uniform size, for example 4096 bytes. However, processor designs often allow two or more, sometimes simultaneous, page sizes due to the benefits and penalties. There are several points that can factor into choosing the best page size.

Page size versus page table size

A system with a smaller page size uses more pages, requiring a page table that occupies more space. For example, if a 232 virtual address space is mapped to 4KB (212 bytes) pages, the number of virtual pages is 220 (20 = 32 - 12). However, if the page size is increased to 32KB (215 bytes), only 217 pages are required.

Page size versus TLB usage

Processors need to maintain a Translation Lookaside Buffer (TLB), mapping virtual to physical addresses, which are checked on every memory access. The TLB is typically of limited size, and when it cannot satisfy a given request (a TLB miss) the page tables must be searched manually (either in hardware or software, depending on the architecture) for the correct mapping, a time-consuming process. Larger page sizes mean that a TLB cache of the same size can keep track of larger amounts of memory, which avoids the costly TLB misses.

Internal fragmentation of pages

Rarely do processes require the use of an exact number of pages. As a result, the last page will likely only be partially full, wasting some amount of memory. Larger page sizes clearly increase the potential for wasted memory this way, as more potentially unused portions of memory are loaded into main memory. Smaller page sizes ensure a closer match to the actual amount of memory required in an allocation.

As an example, assume the page size is 1MB. If a process allocates 1025KB, two pages must be used, resulting in 1023KB of unused space.

Page size versus disk access

When transferring from disk, much of the delay is caused by the seek time. Because of this, large, sequential transfers are more efficient than several smaller transfers. Transferring larger pages from disk to memory therefore, does not require much more time than smaller pages.

Determining the page size in a program

Most operating systems allow programs to determine the page size at run time. This allows programs to use memory more efficiently by aligning allocations to this size and reducing overall internal fragmentation of pages.

UNIX and POSIX-based Operating Systems

UNIX and POSIX-based systems use the system function sysconf(), as illustrated in the following example written in the C programming language.
#include
#include // sysconf(3)

int main(){ printf("The page size for this system is %ld bytes ", sysconf(_SC_PAGESIZE)); //_SC_PAGE_SIZE is OK too. return 0;}

Windows-based operating systems

Win32-based operating system, such as Windows 9x, NT, ReactOS, use the system function GetSystemInfo() from kernel32.dll.


#include
#include

int main(){ SYSTEM_INFO si; GetSystemInfo(&si); printf("The page size for this system is %u bytes ", si.dwPageSize); return 0;}

Huge pages

Intel x86 supports 4MB pages (2MB pages if using PAE) in addition to its standard 4kB pages, and other architectures may often have similar features. IA-64 supports as many as eight different page sizes, from 4kB up to 256MB. This support for "huge pages" (or, in Microsoft Windows terminology, "large pages") allows for "the best of both worlds", reducing the pressure on the TLB cache (sometimes increasing speed by as much as 15%, depending on the application and the allocation size) for large allocations while still keeping memory usage at a reasonable level for small allocations.

Huge pages, despite being implemented in most contemporary personal computers, are not in common use except in large servers and computational clusters. Commonly, their use requires elevated privileges, cooperation from the application making the large allocation (usually setting a flag to ask the operating system for huge pages), or manual administrator configuration; operating systems commonly, sometimes by design, cannot page them out to disk.

Linux has supported huge pages on several architectures since the 2.6 series. Windows Server 2003 (SP1 and newer), Windows Vista and Windows Server 2008 support huge pages under the name of "large" pages. Windows Server 2000 and Windows XP support [http://support.microsoft.com/kb/270715 large pages internally] , but are not exposed to applications. Solaris beginning with version 9 supports large pages on SPARC and x86. [cite web
url = http://www.sun.com/blueprints/0304/817-5917.pdf
title = Supporting Multiple Page Sizes in the Solaris Operating System
accessdate = 2008-01-19
author =
authorlink =
coauthors =
date =
work = Sun BluePrints Online
publisher = Sun Microsystems
] [cite web
url = http://www.sun.com/blueprints/0304/817-6242.pdf
title = Supporting Multiple Page Sizes in the Solaris Operating System Appendix
accessdate = 2008-01-19
author =
authorlink =
coauthors =
date =
work = Sun BluePrints Online
publisher = Sun Microsystems
]

References

cite book
last = Dandamudi
first = Sivarama P.
title = Fundamentals of Computer Organization and Design
publisher = Springer
date = 2003
pages = 740-741
isbn = 038795211X

ee also

* Virtual memory
* Page table
* Paging
* Swapping


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • Page — may mean:Apprentice, assistant, errand boy*Page of Honour, the chilvalric and ceremonial position at a royal court in older times. *Page (servant), a traditionally young male servant. **Canadian Senate Page Program or Canadian House of Commons… …   Wikipedia

  • Computing Tabulating Recording Corporation — Fate Renamed Successor IBM Founded 1911 Defunct 1924 …   Wikipedia

  • Page orientation — is the way in which a rectangular page is oriented for normal viewing. The two most common types of orientation are portrait and landscape. The specific word definition comes from the fact that a close up portrait of a person s face and upper… …   Wikipedia

  • page — Ⅰ. page [1] ► NOUN 1) one side of a leaf of a book, magazine, or newspaper, or the material written or printed on it. 2) both sides of such a leaf considered as a single unit. 3) Computing a section of data displayed on a screen at one time. 4) a …   English terms dictionary

  • Page layout — is the part of graphic design that deals in the arrangement and style treatment of elements (content) on a page. Beginning from early illuminated pages in hand copied books of the Middle Ages and proceeding down to intricate modern magazine and… …   Wikipedia

  • Page 6 (computer magazine) — Page 6 (subtitled Atari User s Magazine , and later known as New Atari User ) was an independent British publication aimed at users of Atari home computers. It was published between 1982 and 1998. The magazine supported both the Atari 8 bit… …   Wikipedia

  • page break — ˈpage break held at its own POE as there is no corresponding sense of break; x ref from break added noun [countable] COMPUTING 1. the place in a document on a computer screen where one page ends and a new page begins, for example when you are… …   Financial and business terms

  • page break — UK US noun [countable] [singular page break plural page breaks] computing the place in a computer document where one page ends and another one begins Thesaurus: computer files and documents and collections of com …   Useful english dictionary

  • page down — ˌpage ˈdown [intransitive] [present tense I/you/we/they page down he/she/it pages down present participle paging down past tense …   Useful english dictionary

  • page setup — UK US noun [countable] [singular page setup plural page setups] computing the set of software choices, for example the size of pages or the size of the margins , that allow a user to decide how the page will look when it is …   Useful english dictionary

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”