Following the "pause" engendered by the midterm exam, this assignment gets us back on track with OSTEP readings associated with memory management (e.g., paging, TLB) and performance...

1 answer below »




Following the "pause" engendered by the midterm exam, this assignment gets us back on track with OSTEP readings associated with memory management (e.g., paging, TLB) and performance measurement.


Specifically, your assignment is



  • Read OSTEP Ch 19-21 Paging, TLB and Swapping

  • Do analysis on paging performance on your laptop, referring to pages 212-213, and answer questions 1-7.













Questions





  1. For timing, you’ll need to use a timer (e.g.,
    gettimeofday()
    ). How precise is such a timer? How long does an operation have to take in order for you to time it precisely? (this will help deter- mine how many times, in a loop, you’ll have to repeat a page access in order to time it successfully)





  2. Writetheprogram,called
    tlb.c
    ,thatcanroughlymeasurethecost of accessing each page. Inputs to the program should be: the num- ber of pages to touch and the number of trials.





  3. Now write a script in your favorite scripting language (bash?) to run this program, while varying the number of pages accessed from 1 up to a few thousand, perhaps incrementing by a factor of two per iteration. Run the script on different machines and gather some data. How many trials are needed to get reliable measurements?





  4. Next, graph the results, making a graph that looks similar to the one above. Use a good tool like
    ploticus
    or even
    zplot
    . Visual- ization usually makes the data much easier to digest; why do you think that is?





  5. One thing to watch out for is compiler optimization. Compilers do all sorts of clever things, including removing loops which incre- ment values that no other part of the program subsequently uses. How can you ensure the compiler does not remove the main loop above from your TLB size estimator?





  6. Another thing to watch out for is the fact that most systems today ship with multiple CPUs, and each CPU, of course, has its own TLB hierarchy. To really get good measurements, you have to run your code on just one CPU, instead of letting the scheduler bounce it from one CPU to the next. How can you do that? (hint: look up “pinning a thread” on Google for some clues) What will happen if you don’t do this, and the code moves from one CPU to the other?





  7. Another issue that might arise relates to initialization. If you don’t initialize the array
    a
    above before accessing it, the first time you access it will be very expensive, due to initial access costs such as demand zeroing. Will this affect your code and its timing? What can you do to counterbalance these potential costs?






Answered Same DayNov 10, 2022

Answer To: Following the "pause" engendered by the midterm exam, this assignment gets us back on track with...

Nidhi answered on Nov 10 2022
55 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here