2.8   POSIX Memory-Locking Interface

Many operating systems perform memory paging and swapping. These techniques allow the use of more virtual memory than there is physical memory on a system, by copying blocks of memory out to disk and back. These techniques impose severe and unpredictable delays in execution time; they are therefore undesirable in real-time systems.

Because the wind kernel is designed specifically for real-time applications, it never performs paging or swapping. However, the POSIX 1003.1b standard for real-time extensions also covers operating systems that perform paging or swapping. On such systems, applications that attempt real-time performance can use the POSIX page-locking facilities to declare that certain blocks of memory must not be paged or swapped.

To help maximize portability, VxWorks includes the POSIX page-locking routines. Executing these routines makes no difference in VxWorks, because all memory is, in effect, always locked. They are included only to make it easier to port programs between other POSIX-conforming systems and VxWorks.

The POSIX page-locking routines are in mmanPxLib (the name reflects the fact that these routines are part of the POSIX "memory-management" routines). Because in VxWorks all pages are always kept in memory, the routines listed in Table 2-25 always return a value of OK (0), and have no further effect.

The mmanPxLib library is included automatically when the configuration constant INCLUDE_POSIX_MEM is selected for inclusion in the project facility VxWorks view.

Table 2-25:  POSIX Memory Management Calls


Call
Purpose on Systems with Paging or Swapping

mlockall( ) 
Lock into memory all pages used by a task. 
munlockall( ) 
Unlock all pages used by a task. 
mlock( ) 
Lock a specified page. 
munlock( ) 
Unlock a specified page.