0
$\begingroup$

This is a book question:

Suppose that a machine has 48-bit virtual addresses and 32-bit physical addresses.

Suppose this same system has a TLB (Translation Lookaside Buffer) with 32 entries. Furthermore, suppose that a program contains instructions that fit into one page and it sequentially reads long integer elements from an array that spans thousands of pages. How effective will the TLB be for this case?

Answer: I think that we cannot know the effectiveness of the TLB because we do not know the number of instructions the program has. I hope I make sense.

source: Modern Operating Systems Question 15, chapter 3 ISBN-13: 978-0-13-359162-0

$\endgroup$
  • $\begingroup$ What's your question? We discourage "please check whether my answer is correct" questions, as only "yes/no" answers are possible, which won't help you or future visitors. See here and here. Can you edit your post to ask about a specific conceptual issue you're uncertain about? If you're not sure whether your answer is correct, there must be some concept you're not 100% certain about. Try asking a question about that concept. $\endgroup$ – D.W. Nov 26 '17 at 23:45
-1
$\begingroup$

Assuming size of long is $32$ bits, each page frame in physical memory exactly contain $1$ long number, therefore in $TLB$ at particular instance of time $31$ long integers would be present. Hence, $1$ page fault in every $32$ memory accesses. Now, I am not sure what is criteria of effectiveness here. But $1$ per $32$ memory access seems pretty good.

$\endgroup$
  • $\begingroup$ It is extremely unlikely that a page will only hold one long element (a 64-bit machine, implied by 48-bit VA, might use I32LP64, pages are likely at least 4 KiB), so since the array accesses as sequential (no reuse) every page_size/long_size data accesses will generate a TLB miss. If the TLB uses pseudo-random or FIFO replacement, the entry for instructions will be victimized occasionally. $\endgroup$ – Paul A. Clayton Nov 27 '17 at 11:57
  • $\begingroup$ This calculation doesn't work at all. Under the unrealistic assumption of 1 array element per page, that would rather mean that every single access would miss the TLB. 1/32 just comes out of absolutely nowhere. $\endgroup$ – harold Dec 27 '17 at 14:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.