Programs very often require memory that is not associated with a file. For example, malloc() may expand the program's data space or the stack might grow by another page. Neither of these actions needs data from a file to satisfy a page fault. For these cases, the only real requirement is a brand-new page that is initialized to zeroes and that can be saved someplace if it has to be paged out. This is known as anonymous memory, since it is not associated with a specific, named, disk file. The kernel will reserve some space in swap to hold the image in case paging out is required at some point. You will often hear anonymous memory loosely referred to as swap space (which is disk space in SunOS 4.x, but not necessarily so in Solaris 2), because that's where it lives. In the 4.x kernel, a whole collection of routines deals with anonymous memory. These routines do such things as:
In Solaris 2, anonymous memory is treated like a regular file. A special unnamed vnode is assigned to keep track of all swap space, so that the regular vnode processing code will work on anonymous space. The special anon routines have been removed. |