Академический Документы
Профессиональный Документы
Культура Документы
html
Operating Systems
3. (10 pts) Consider a paging system with the page table stored in memory.
o (4pts) If a memory access takes 200 nanoseconds, how long does a paged memory
reference take?
o (4 pts.) If we add associative registers (a TLB), and 75 percent of all page table
references are found in associative registers, what is the effective memory
reference time? Assume that finding a page-table entry in the TLB takes zero
time.
Yes: If the size of cache is larger than the total size of pages that have
translation entries in the TLB.
o Is there a combination of TLB (hit/miss) and cache access (hit/miss) that cannot
happen?
The case when a TLB miss and cache hit happens at the same time
would be one, but it is typically avoided.
https://inst.eecs.berkeley.edu/~cs162/sp03/hw/hw3-solutions.html
1. 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 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
3. Consider a logical address space of eight pages of 1024 words each, mapped
onto a physical memory of 32 frames.
a. How many bits are there in the logical address?
b. How many bits are there in the physical address?
4. 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.
PROS
o Simple and fast.
o No need for lookup tables b/c the hardware can automatically distinguish
between code and data references.
o Code can be shared between programs, while data and stack can be
separate.
o Allows more flexibility for heap and stack growth than simple base and
bounds.
CONS
https://gist.github.com/banderson623/5311804
Brian
Anderso
n
Assignment 9 - Com S 352
April 4, 2012
[NOTE --> PLEASE USED A FIXED WIDTH FONT TO READ THIS DOCUMENT]
1. (25pts) Given five memory partitions of 100 KB, 500 KB, 200 KB, 300 KB, and
600 KB (in order
from low-end to high-end of user memory space), how would the first-fit, best-
fit, and
worst-fit algorithms place processes of 212 KB, 417 KB, 112 KB, and 426 KB (in
the arriving order)?
Assumption:
- The five partitions are non-contiguous
- First & worst fit restarts at the beginning (top)
with each new allocation attempt
----------------------+---------------------------+--------------------
First fit: | Best Fit: | Worst Fit:
----------------------+---------------------------+--------------------
(Allocate the | Allocate the smallest |(Allocate the
first hole | hole that is big enough) | largest hole)
----------------------+---------------------------+--------------------
212KB -> b | 212KB -> d | 212KB -> e
417KB -> e | 417KB -> b | 417KB -> b
112KB -> b (remainder)| 112KB -> c | 112KB -> e (remainder)
426KB -> ?? no fit. | 426KB -> e | 426KB -> ?? no fit!
----------------------+---------------------------+--------------------
#################################################################################
########
2. (25pts) Assuming a 4-KB page size, what are the page numbers and offsets
for the following address references (provided as decimal numbers):
a. 2375,
b. 19366,
c. 30000,
d. 256,
e. 16385
Assumption:
- (max) Physical/logical Address Space = 32,768 because part c has the highest
address 30,000,
which would fit in an addressible space of this size. This would require a 15
bit address size.
- A Physical/logical address of 32,786 would have 'm' = 15 (2^15) => 32,768
Page size: 2^n = 4KB = 4,096 bytes
n = 12
#################################################################################
########
3. (20pts) Consider a logical address space of 8 pages with
2,048 bytes per page, mapped onto a physical memory of 16 frames.
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Physical-> | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|15|
(frames) +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
16 frames * 2048 bytes per frame = 32,768 bytes total physical memory
32,768 = 2^15 ==> 15 bits
(Assume that finding a page-table entry in the TLBs takes zero time,
if the entry is there.)
Explained: 80% of the time the page number is found in the TLB (hardware)
---------- and then requires just one more memory access time to read
the main memory.
... but 20% of the time, it the page to frame number reference
is not in the TLB, this requires 160ns to read the page to frame
reference from main memory, then another 160ns to read the contents
of the addressed value from memory.