Você está na página 1de 2

Q1: Consider an OS using one level of paging with TLB registers.

If the page fault rate is


10% and dirty pages should be reloaded when needed, calculate the effective access time
if:

TLB Lookup = 20 ns
TLB Hit ratio = 80%
Memory access time = 75 ns
Swap page time = 500,000 ns
50% of pages are dirty.
Answer:
T = 0.8(TLB+MEM) + 0.2(0.9[TLB+MEM+MEM] + 0.1[TLB+MEM + 0.5(Disk) +
0.5(2Disk+MEM)]) = 15,110 ns

Q2: Consider a paging hardware with a TLB. Assume that the entire page table and all
the pages are in the physical memory. It takes 10 milliseconds to search the TLB and 80
milliseconds to access the physical memory. If the TLB hit ratio is 0.6, the effective
memory access time (in milliseconds) is _________.
(A) 120
(B) 122
(C) 124
(D) 118

Answer: (B)

Explanation: TLB stands for Translation Lookaside Buffer. In Virtual memory systems,
the cpu generates virtual memory addresses. But, the data is stored in actual physical
memory i.e. we need to place a physical memory address on the memory bus to fetch the
data from the memory circuitry. So, a special table is maintained by the operating system
called the Page table. This table contains a mapping between the virtual addresses and
physical addresses. So, every time a cpu generates a virtual address, the operating
system page table has to be looked up to find the corresponding physical address. To
speed this up, there is hardware support called the TLB. The TLB is a high speed cache
of the page table i.e. contains recently accessed virtual to physical translations. TLB hit
ratio- A TLB hit is the no of times a virtual-to-physical address translation was already
found in the TLB, instead of going all the way to the page table which is located in slower
physical memory. TLB hit ratio is nothing but the ratio of TLB hits/Total no of queries into
TLB. In the case that the page is found in the TLB (TLB hit) the total time would be the
time of search in the TLB plus the time to access memory, so
TLB_hit_time := TLB_search_time + memory_access_time
In the case that the page is not found in the TLB (TLB miss) the total time would be the
time to search the TLB (you dont find anything, but searched nontheless) plus the time
to access memory to get the page table and frame, plus the time to access memory to
get the data, so
TLB_miss_time := TLB_search_time + memory_access_time + memory_access_time
But this is in individual cases, when you want to know an average measure of the TLB
performance, you use the Effective Access Time, that is the weighted average of the
previous measures
EAT := TLB_miss_time * (1- hit_ratio) + TLB_hit_time * hit_ratio.
EAT := (TLB_search_time + 2*memory_access_time) * (1- hit_ratio) + (TLB_search_time
+ memory_access_time)* hit_ratio.
As both page table and page are in physical memory
T(eff) = hit ratio * (TLB access time + Main memory access time) +
(1 hit ratio) * (TLB access time + 2 * main memory time)
= 0.6*(10+80) + (1-0.6)*(10+2*80)
= 0.6 * (90) + 0.4 * (170)
= 122

Q3: Consider a demand-paging system with a paging disk that has an average access and
transfer time of 20 milliseconds. Addresses are translated through a page table in main
memory, with an access time of 1 microsecond per memory access. Thus, each memory
reference through the page table takes two accesses. To improve this time, we add an
associative memory that reduces access time to one memory reference, if the page-table entry is
in the associative memory.
Assume that 80 percent of the accesses are in the associative memory, and that, of the
remaining, 10 percent (or 2 percent of the total) cause page faults. What is the effective
memory access time?

This is my approach. The associative memory has the page in it (and not just the physical
address?), so just one access would do if found. Else, search in the page table. If found, it
would take two accesses (one for the page table and other for accessing the page in
memory). If not found, need to access it from disk. So,

effective access time EAT = (0.8 x 1s) + (0.18 x (1s + 2s)) + (0.02 x (1s + 2s + 20ms)) =
401.4s

Você também pode gostar