Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mailrus!uflorida!haven!vrdxhq!daitc!bms-at!stuart From: stuart@bms-at.UUCP (Stuart Gathman) Newsgroups: comp.arch Subject: Re: 386/486 Virtual Memory Question... Summary: 386 paging vs segments Message-ID: <162@bms-at.UUCP> Date: 14 Jun 89 01:11:15 GMT References: Organization: Business Management Systems, Inc., Fairfax, VA Lines: 37 The 386 has one page register that points to tables mapping 2^32 bytes. In addition, there are up to 2^14 entries in a segment table. Each segment has a 32 bit offset and size. (The size is actually less than 32 bits, it uses kind of floating point with 1 bit exponents.) The logical address space is therefore 2^46. However, Changing the page register causes all kinds of TLB misses and extra memory reads to load needed pieces of the new page tables. This is very inefficient. The most efficient way to use both segments and paging is to map the segments onto a single 2^32 paged space and never change the page register. The paged space should be treated as a scarce resource and only the most recently used segments mapped to it. Stale segments are unmapped and the segment entry marked not present. On a segment fault, the oldest segment is mapped out, and the faulting segment mapped back in. Since the processor can have 6 segment registers loaded simultaneously, you have to guarrantee that all 6 will fit into 2^32 bytes. (Segment faults are detected when loading, not when referencing segment registers.) The simplest way to do this is to limit the size of a single segment to 2^32/6. This gives you a virtual space of 2^46/6 bytes. A max sement size of 2^32/8 has certain advantages, so I would make the virtual space 2^43 bytes. Therefore, the maximum address space actual usable is somewhat smaller than claimed by Intel, but still quite large. I can see using 2^45 bytes with severe restrictions on application code. (Only two segments are valid at any one time. Don't mess with the code segment.) I can't see any reasonable way to use 2^46. Because AT&T UNIX doesn't provide for two level VM without some hacking, so *nix implementations simply ignore the segments. -- Stuart D. Gathman <..!{vrdxhq|daitc}!bms-at!stuart>