Problem
Is there a way to programmatically lock data into memory in order to stop it from being potentially paged or swapped out to disk?
Solution
The following system calls are provided in either SCO OpenServer Release 5 or SCO UnixWare 2.1, which enable the locking of data or code into memory:
SCO OpenServer 5 and SCO UnixWare 2.1
-------------------------------------lock(S), lock(2XNX)
locks the entire process into memory.plock(S), plock(2) locks code and/or data segments into memory. (doesn't include the locking of shared memory segments.)
shmctl(S), shmctl(2)
locks a shared memory segment into memory
(SHM_LOCK command).SCO UnixWare 2.1 only
---------------------memcntl(2)
locks pages which contain the specified memory
address range.mlock(3C)
similar to memcntl().mctl(3BSD)
similar to memcntl().mlockall(3C) locks all pages mapped by an address space.
NOTE: Although the routines memcntl(), mlock(), and mlockall()
are included in SCO OpenServer Release 5, they are currently
undocumented and their use is therefore unsupported.