Sarah P.

asked • 12/03/21

Opt System Support and Virtual Memory

Consider now a machine with 16-bit virtual addresses and 16-bit physical addresses. The memory is byte-addressable. This machine has a linear (i.e., single-level) page table with a page size of 4 Kbytes.


Consider the following C code to be executed on this machine:

int A[1024*512]; // A 2 Mbytes array

int sum = 0;
for (int i = 0; i < 512; i++) {
sum = sum + A[i*1024];
}

Here, array A starts at virtual address 0, and each integer element of array A occupies 4 bytes. The size of array A is 2 Mbytes (because (1024 X 512) elements X 4 bytes per element = 1024 X 2048bytes = 2 Mbytes).


  1. How many bits in a virtual memory address should be used for the page offset? Give your answer in a base 10 number (and only write down the number)
  2. Assume the machine does not have a translation lookaside buffer (TLB). To execute the code, how many accesses to the page table are required? Give your answer in a base 10 number (and only write down the number)
  3. We now want to add a TLB to speed up virtual memory address translation. What is the minimum number of TLB entries required to ensure no TLB misses for the above code when accessing array A?Give your answer in a base 10 number (and only write down the number).



1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.