Q: 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 question comes in the exercise of the book Operating System concepts by Silberschatz|Galvin|Gagne.)
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 1μs) + (0.18 x (1μs + 2μs)) + (0.02 x (1μs + 2μs + 20ms)) = 401.4μs
Is this approach correct? This question had been posted in various forums and the answers written there were not matching this. Hence I posted here to check what exactly is the correct way to calculate the effective access time?
I also have some follow up questions. Here there is an associative memory used - is this not the same as TLB(Translation Lookaside Buffer)? Because I'm assuming if there was a TLB, it would still need to access the page from the memory after finding the address in the TLB. Please correct me if I'm wrong.