>> I am looking for some ways to get memory from the system in pages
>>using system calls.
I'm not aware of any UNIX implementations that provides a system call or
library function to do this. The traditional methods of getting memory
(malloc, mmap of /dev/zero) require that you specify how much memory you
want in bytes, not pages.
Of course, the system must round up to the nearest page what actually gets
allocated to the processes VA space, since a page is the smallest unit the
OS can allocate/map/protect.
If you're interested in pages, than I suggest you use an implementation
specific routine to get the systems page size (sysconf(SC_PAGESIZE) in
solaris, getpagesize(2) is BSD, etc) and do the arithmetic in your code,
althought it is not clear to me what use this information would be.
>> There should be some way of protecting these pages and a handler
>>should be called if the particular page is not in the system.
Unless I'm completely misinterpreting what you're asking, you concerning yourself
with things you do not need to concern yourself with. The OS will page-in on
an as needed basis. You can use routines like memcntl(3) to tweak the permissions
of pages you own.