Please enable JavaScript to view this site.

A-Shell Reference

Navigation: Subroutines > ASFLAG

Memory Mapping

Scroll Prev Top Next More

This activates automatic memory mapping for any files subsequently opened within the current program. Option 16 (Memory Map) causes the subsequently opened random files to be "memory mapped." Memory mapping is a technique used very effectively on Unix systems to greatly speed up file access. Essentially it makes the file act like virtual memory, such that you can then access it with memory (rather than disk) operations. This eliminates most of the overhead of disk service calls (which under Unix require a context switch to supervisor mode, and under Windows networks may require machine-to-machine messaging). The advantage is most pronounced in files which are accessed very frequently and have small record sizes. For this reason, A-Shell uses memory mapping on the qflock.sys and jobtbl.sys files under Unix.

There are, however, two downsides to memory mapping. The biggest one only affects Windows, where the memory "view" of a file is not kept coherent with the disk "view" of the file. Thus it is not a good idea to use this technique in multi-user mode, unless you are only planning to read from a file.

The second downside is that it causes a lot of memory to be allocated, which may decrease overall efficiency of the system if it is used too much. (If the total size of memory mapped files exceeds available memory, the system will begin to "thrash", which is not a pretty sight.)