Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

50. Virtual Memory Operations > Determining Memory Residence: mincore()

Determining Memory Residence: mincore()

The mincore() system call is the complement of the memory locking system calls. It reports which pages in a virtual address range are currently resident in RAM, and thus won’t cause a page fault if accessed.

SUSv3 doesn’t specify mincore(). It is available on many, but not all, UNIX implementations. On Linux, mincore() has been available since kernel 2.4.

#define _BSD_SOURCE           /* Or: #define _SVID_SOURCE */
#include <sys/mman.h>

int mincore(void *addr, size_t length, unsigned char *vec);

Note

Returns 0 on success, or -1 on error

The mincore() system call returns memory-residence information about pages in the virtual address range starting at addr and running for length bytes. The address supplied in addr must be page-aligned, and, since information is returned about whole pages, length is effectively rounded up to the next multiple of the system page size.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint