Editing
Resource Limits
(section)
From Linix VServer
Jump to navigation
Jump to search
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!
== Determining the Page Size == You can use the following program to determine the page size for your architecture (if it supports the getpagesize() function) <pre> #include <stdlib.h> #include <stdint.h> #include <unistd.h> int main(int argc, char *argv[]) { int page_size = getpagesize(); printf("The page size is %d\n", page_size); exit(0); } </pre> Here's how to compile and run it (assuming you save it as pagesize.c): <pre> # gcc pagesize.c -o pagesize # ./pagesize The page size is 4096 </pre> '''Note''': Whether getpagesize() is present as a Linux system call depends on the architecture. If it is, it returns the kernel symbol PAGE_SIZE, which is architecture and machine model dependent. Generally, one uses binaries that are architecture but not machine model dependent, in order to have a single binary distribution per architecture. This means that a user program should not find PAGE_SIZE at compile time from a header file, but use an actual system call, at least for those architectures (like sun4) where this dependency exists. Here libc4, libc5, glibc 2.0 fail because their getpagesize() returns a statically derived value, and does not use a system call. Things are OK in glibc 2.1. If you prefer, you can get the pagesize using python, just start a python console and write: <pre> >>> import resource >>> resource.getpagesize() 4096 </pre> Most Linux operating systems also just support a simple native command <pre> getconf PAGESIZE </pre> Here are some typical page sizes ... {| class="wikitable_list" ! arch ! pagesize |- | arm, extensa, s390, sh64, x86, x86_64, v850 | 4k |- | alpha, cris | 8k |- | m68k, sparc | 4k, 8k |- | powerpc | 4k, 64k |- | parisc | 4k, 16k, 64k |- | ia64, mips | 4k, 8k, 16k, 64k |}
Summary:
Please note that all contributions to Linix VServer may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Linix VServer:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Page actions
Page
Discussion
Read
Edit
History
Page actions
Page
Discussion
More
Tools
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
About
Overview
Paper
News
Developers
Donations
Search
Getting Started
Downloads
FAQs
Documentation
Support
Participate
How to participate
Report a Bug
Communicate
Teams/Projects
Hall of Fame
Resources
Archives
Recent Wiki Changes
Pastebin
Related Projects
VServer Hosting
Happy VServer Users
Tools
What links here
Related changes
Special pages
Page information