-
The Intel 8086 processor does not support virtual memory. Nevertheless,
some companies previously sold systems that contained an unmodified 8086
CPU and do paging. Make an educated guess as to how they did it. (Hint:
think about the logical location of the MMU).
The purpose of the MMU is to translate memory references caused
by machine code instructions from virtual addresses to real addresses.
Hence, the logical location of the MMU is between the CPU and the memory.
In particular, this means that the MMU does not need to be part of the
CPU - it can simply sit on the system bus between the CPU and memory, and
provide translation facilities.
-
Why are page sizes always powers of 2?
The bytes within a page are addressed using the last N bits of a
virtual address, for some value of N. Since the number of addresses
that can be expressed with N bits is 2N, the page size is a
power of
-
Consider a logical address space of eight pages of 1024 words each, mapped
onto a physical memory of 32 frames.
-
How many bits are there in the logical address?
-
How many bits are there in the physical address?
Addressing within a 1024-word page requires 10 bits because 1024 = 210.
Since the logical address space consists of 8 = 23 pages, the
logical addresses must be 10+3 = 13 bits. Similarly, since there
are 32 = 25 physical pages, phyiscal addresses are 5 + 10 =
15 bits long.
Physical Address (P = page number bits)
P |
P |
P |
P |
P |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
Logical Address (P = page number bits)
P |
P |
P |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
Consider a base & bounds-based system where a program can be separated
into two parts: code and data. The CPU knows whether it wants an instruction
(instruction fetch) or data (data fetch or store). Therefore, two base
& bounds register pairs are provided: one for instructions and one
for data. The instruction base & bounds register pair is automatically
read-only, so a program's code can be shared among different users. Discuss
the advantages and disadvantages of this scheme.
This scheme is somewhere between the simple base-bounds system and
a segmented system in terms. Hence, it shares advantages and disadvantages
with both systems:
PROS
-
Simple and fast.
-
No need for lookup tables b/c the hardware can automatically distinguish
between code and data references.
-
Code can be shared between programs, while data and stack can be separate.
-
Allows more flexibility for heap and stack growth than simple base and
bounds.
CONS
-
Memory allocation may result in external fragmentation. This means
that either memory is underutilized, or the OS is required to copy memory
regions in order to coalesce the free space.
-
Doesn't allow easy sharing of parts of the data space.
-
Growth of heap and stack is more complicated than in paged systems.