Difference between revisions of "Memory page"
(added C code to print pagesize on unix systems) |
Narcisgarcia (talk | contribs) (Command line) |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 3: | Line 3: | ||
Size of memory page is architecture and operating system dependant. On an x86 and x86_64 hardware, memory page is equal to 4KB. On an Intel Itanium (IA64) memory page size is 16KB. | Size of memory page is architecture and operating system dependant. On an x86 and x86_64 hardware, memory page is equal to 4KB. On an Intel Itanium (IA64) memory page size is 16KB. | ||
| + | <br /> | ||
You can get the actual value on your Linux/UNIX system with the '''getpagesize'''-Syscall. Here is a C Program that prints the pagesize on your system : | You can get the actual value on your Linux/UNIX system with the '''getpagesize'''-Syscall. Here is a C Program that prints the pagesize on your system : | ||
| − | < | + | <pre> |
#include <unistd.h> | #include <unistd.h> | ||
#include <stdio.h> | #include <stdio.h> | ||
| Line 15: | Line 16: | ||
return 0; | return 0; | ||
} | } | ||
| − | </ | + | </pre> |
| − | compile with : gcc -o getpagesize getpagesize.c | + | compile with : |
| + | <pre> | ||
| + | gcc -o getpagesize getpagesize.c | ||
| + | </pre> | ||
| + | You can get the page size in GNU/Linux from a terminal or shell: | ||
| + | getconf PAGE_SIZE | ||
[[Category:Definitions]] | [[Category:Definitions]] | ||
Latest revision as of 10:42, 23 November 2011
Memory page is a range of consecutive addresses in the virtual address space whose size is a power of two. Those virtual addresses are translated in a corresponding range of consecutive physical addresses. The memory referenced by such a range is called a page.
Size of memory page is architecture and operating system dependant. On an x86 and x86_64 hardware, memory page is equal to 4KB. On an Intel Itanium (IA64) memory page size is 16KB.
You can get the actual value on your Linux/UNIX system with the getpagesize-Syscall. Here is a C Program that prints the pagesize on your system :
#include <unistd.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
long sz = sysconf(_SC_PAGESIZE);
printf("memory pagesize on this box : %i\n", sz);
return 0;
}
compile with :
gcc -o getpagesize getpagesize.c
You can get the page size in GNU/Linux from a terminal or shell:
getconf PAGE_SIZE