Extra Lab (Sample for End Semester Exam)


I N S T R U C T I O N S
  • Activate the advanced operating systems environment on your computer.
  • Open a new Python 3 notebook.
  • Rename the notebook as <your roll number>_extralab
  • Do the tasks given below in the notebook.
  • Once you are done, email the notebook to
    chakravarthybhagvati@uohyd.ac.in
    with the subject line containing the phrase Extra Lab
  • Follow the instructions exactly as given.

Task AOS-I:

Read the man page for the mount command. Run the mount command in the first cell of your notebook. Use the cell magic to make the cell behave like a bash terminal. Explain any three lines of the output in a new Markdown cell named Explanation below the cell in which you ran the command.

Task AOS-II:

Open another cell in your notebook and turn into a bash terminal. Run the ls -l command in the cell and see the output. Now open another new cell in the notebook and run stat <filename> on any file listed in the ls -l output. What information about the file is output by stat command? What information is extra when compared to ls -l output? Now, run stat command on a device (any 'file' in the /dev directory). What are the differences in the output between running stat on a regular file and on a device? Write down all your answers in a Markdown cell.

Task AOS-III:

Write a function to calculate working sets from an address reference string. You function must have the prototype
int *calc_ws(int *addr_str, int time, int window)
where addr_str is an array of integers of length specified (see below), time is the time at which the working set is being calculated and window is the \(\Delta\) parameter from our textbook.

You may use the predefined python module workingsets for generating address strings of specified length. Download this module into your current working directory. You can invoke it as

import workingsets as ws
ws.gen_addr_refs(size)
The size parameter is passed to the calc_ws() function that you write.

You may verify if your code works by calling the functions in a program as below.
  1. Open a cell in your notebook.
  2. Import the workingsets module.
  3. Generate an address string of length 10000 by calling it appropriately.
  4. Calculate the working set for time = 1000, window = 128.