Everhart, Glenn From: Jerry Leichter [leichter@smarts.com] Sent: Tuesday, August 25, 1998 11:05 AM To: Info-VAX@Mvb.Saic.Com Cc: mcclelland@nesbit.enet.dec.com Subject: Re: Help required on Paging and segmentation in VMS ? Every other response has denied that VMS has segments. I'm going to disagree, though slightly. The VAX (and VMS, in its use of the VAX), uses segmentation in a very basic form. This shows up in the division of VM into P0, P1, and S0 regions - *each of which has a separate page table*, with its own length. If this were not the case, to keep the stack at the top of P1 and user data at the bottom of P0 would require a single, contiguous (in S0) page table mapping the entire 2 gig of P0+P1, which would quickly fill S0. Since the bottom of S0 is contiguous with P1, this particular consideration doesn't apply; however, having the S0 table separate makes it very cheap (0 cost) for VMS to be mapped into each process identically (thus avoiding all kinds of complications in interrupt-level code). Is this really "segmentation"? If you can define the term, we can perhaps answer the question! The Multics model of segmentation (and the rather similar models in Burroughs machines) is more general and powerful than the truncated version in the Intel 286, and the much more reasonable and complete versions in later x86 models. What's present in the VAX scheme is one of the main ideas in segmentation: Segments can be independently allocated, and can grow without impacting each other. What's missing is segment-relative addressing, which gives you a true 2-D address space; and, of course, the fixed, very small, number of segments supported. Perhaps that makes "regions" a better term than "segments", but "regions" is much less well-defined even than "segment". On Alpha, so much of the VM architecture is software-defined that it's not reasonable to talk about whether the *hardware* supports segments. VMS on Alpha makes use of the hardware in a way that avoids the second of the two ideas missing on the VAX: With multi-level page tables, it can do independent mapping for any number of non-contiguous regions/ segment/what have you. This has relatively little impact on the programming interface - it just means that some operations that were very expensive on the VAX (allocating a region well beyond the current top of P0 would require creating page table entries for all the unused space "in between") are now cheap. (The difference in cost does have a significant practical effect on how the programming interface will get *used*, of course.) The Unix VM model, which grew out of the VAX model on which it was originally developed, started off with the same three regions/segments, though under different names: data/text; stack; system. With the addition of shared memory and memory mapping calls, things got more complex, and the implementations tend to have separate regions/segments for individual shared memory/mmap'ed VM ranges. Early implementations of these services were inflexible and limited. Modern Unixes tend to use a style not very different from what VMS uses. To go back to the original (exam) question: As a former teacher of OS courses, I wouldn't have posed the question this way. Perhaps it might make sense within the context of a course that carefully defined such terms as "segmentation" for the purpose of the course; but I would never try to do such a thing, since it would only be confusing to students in any other context, where "segmentation" is used for so wide a variety of related, but by no means identical, things. -- Jerry