Operating Systems 2014F: Tutorial 5

From Soma-notes
Revision as of 12:23, 3 October 2014 by Soma (talk | contribs)
Jump to navigation Jump to search

In this tutorial you will be going through homework exercises from the textbook. Be sure to look at the associated chapter if you have questions.

Note there are a lot of material here. Do not expect to do all of it in detail in tutorial; instead, try to do some of everything so you can see where have significant conceptual gaps. On your own you should do these exercises in more detail to make sure you understand the associated concepts.

Relocation

Use the program relocation.py to answer the following questions from the Address Translation chapter. There is also a video available.

  • Run with seeds 1, 2, and 3, and compute whether each virtual address generated by the process is in or out of bounds. If in bounds,

compute the translation.

  • Run with these flags:
-s 0 -n 10

What value do you have set -l (the bounds register) to in order to ensure that all the generated virtual addresses are within bounds?

  • Run with these flags:
-s 1 -n 10 -l 100

What is the maximum value that bounds can be set to, such that the address space still fits into physical memory in its entirety?

  • Run some of the same problems above, but with larger address spaces (-a) and physical memories (-p).
  • What fraction of randomly-generated virtual addresses are valid, as a function of the value of the bounds register? Make a graph from running with different random seeds, with limit values ranging from 0 up to the maximum size of the address space.

Segmentation

Use the program segmentation.py to answer the following questions from the Segmentation chapter.

  • First let’s use a tiny address space to translate some addresses. Here’s a simple set of parameters with a few different random seeds; can you translate the addresses?
segmentation.py -a 128 -p 512 -b 0 -l 20 -B 512 -L 20 -s 0
segmentation.py -a 128 -p 512 -b 0 -l 20 -B 512 -L 20 -s 1
segmentation.py -a 128 -p 512 -b 0 -l 20 -B 512 -L 20 -s 2
  • Now, let’s see if we understand this tiny address space we’ve constructed (using the parameters from the question above). What is

the highest legal virtual address in segment 0? What about the lowest legal virtual address in segment 1? What are the lowest and highest illegal addresses in this entire address space? Finally, how would you run segmentation.py with the -A flag to test if you are right?

  • Let’s say we have a tiny 16-byte address space in a 128-byte physical memory. What base and bounds would you set up so as to get the simulator to generate the following translation results for the specified address stream: valid, valid, violation, ..., violation, valid, valid? Assume the following parameters:
segmentation.py -a 16 -p 128 -A 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 --b0 ? --l0 ? --b1 ? --l1 ?
  • Assuming we want to generate a problem where roughly 90% of the

randomly-generated virtual addresses are valid (i.e., not segmentation violations). How should you configure the simulator to do so? Which parameters are important?

  • Can you run the simulator such that no virtual addresses are valid? How?


Free Space

Use the program freespace.py to answer the following questions from the Free-Space Management chapter.


Paging

Use the program paging-linear-translate.py to answer the following questions from the Paging: Introduction chapter.


Threads (Intro)

Use the program x86.py (v1) to answer the following questions from the Concurrency: An Introduction chapter.


Locks

Use the program (v2) to answer the following questions from the Locks chapter.