mo@messy.bellcore.com (Michael O'Dell) (07/13/90)
SunOS 4.0 and later will page on anything handy - raw disk paritition, NFS file or local ufs file. One problem with the stock implementation is the absence of "swapoff()" to release an added area. That turns out to be pretty non-trivial and is directly related to implementing "deferred swap allocation", both of which we did at Prisma did before the untimely demise. Turns out this isn't as obvious as it looks at first. The SunOS 4.0 and later virtual memory model is familiar: everything of interest (files, process address space segments, etc) is a virtual memory object and that main memory is only a cache for the active objects. The important implication is that an object must have a "real home" since memory is only a cache and nothing is naturally "in memory." Here lies the rub! The implementation we did at Prisma basically allowed swapon mem which allowed a tunable number of pages to be assigned to the "memory" swap device. Essentially then, memory was "overcommitted" and some pages were just not pagable in the usual sense. The trick was to allow those "paged-out-to-memory" pages to rotate through the active set of pages as needed (and still be directly available via the page lookup algorithms without logically paging them back in). This required "renaming pages" in the page cache since pages named by the <vnode, byte offet> of their "home" vnode. The general case is more than a bit messy in terms of races, especially when doing "swapoff()", but a quite useful capability can be had with some reduction in generality with a concomitant decrease in algorithmic complexity. So, the moral of the story is that the canonical "real memory is just a cache for virtual store objects" model, while sounding quite appealing on the blackboard in an operating systems class, gets a bit messy when you want to add these kinds of wrinkles. We thought a lot about how one might do things a bit differently, but that's another tale.... -Mike O'Dell ex-Prisma Chief Computer Scientist -------------- This has nothing to do with Bellcore!