4 ms·
That is why POSIX provides the mlock() and mlockall() system-calls, to prevent memory pages from being swapped.
by pritambaral 13y ago
That is why POSIX provides the mlock() and mlockall() system-calls, to prevent memory pages from being swapped.
- bnegreve 13y agoRight, but Linux won't bind any physical memory page until you actually read or write in it. So if you malloc() and mlock() 1GB of memory without reading/writing in it, that will not use any bit of physical memory.
- pritambaral 13y agoWill writing just one byte one time suffice? Genuinely unaware and curious.
- bnegreve 13y agoIf you only touch one byte, the system will only allocate one memory page. A memory page is typically 1024 KB so that wouldn't suffice.
- nkurz 13y agoOn Linux, 4K is still a much more common page size. Most "Huge Pages" ("Large Pages" in Windows speak) are 2 or 4 MB, and have been available since 2.6, but I don't think they are widely used yet. x86_64 also supports 1GB pages, but these are even less frequently used. http://lwn.net/Articles/374424/ http://lwn.net/Articles/374424/
- bnegreve 13y agoYes 4K is default page size. Sorry.