Principles of Operating Systems

CMSC 421-04 - Spring 2016


Homework 3

Chapters 7-8

50 points total

Due by 11:59PM EDT on Thursday, April 14, 2016

Changelog

Sunday, April 3 @ 16:13 EDT — clarified that scripts are non-interactive, and that anything (logging, .421sh_profile) pertaining only to interactive mode does not apply when running a script from the command line.


Part I

20 points

Please provide written responses to the following questions. Each response should be about 5-7 sentences in length. Each question is worth 5 points.

  1. There are four conditions necessary for a deadlock to occur, name and describe each.
  2. [*] Consider the following snapshot of a system:
        Allocation      Max       Available
         A B C D      A B C D      A B C D
    P0   0 0 1 2      0 0 1 2      1 5 2 0
    P1   1 0 0 0      1 7 5 0
    P2   1 3 5 4      2 3 5 6
    P3   0 6 3 2      0 6 5 2
    P4   0 0 1 4      0 6 5 6
  3. In the context of memory management, describe what an ASID is and what it is used for.
  4. Describe what a Translation Lookaside Buffer is. What is it's use in memory management? Why is it advantageous to use a TLB versus pure paging? Can a TLB be used with multilevel page tables? Why or why not?

You must submit a PDF file of the answers to these questions on the Homework 3 assignment on Blackboard. You may prepare your responses in any word processing application of your choosing, but you must submit a PDF file. Do not submit Microsoft Word/Apple Pages/LibreOffice/OpenOffice.org documents with your responses. You must convert to a PDF file before submitting or you will lose points.

[*] - Adapted from OSC 9e.

Part II

30 points

Complete the following programming assigment and submit your code using the GitHub repository that you will have created for this assignment. This assignment must be completed in the C programming language (you can choose to use C89/C90/ANSI-C, C99, or C11 as you see fit).

In this assignment, you will be augmenting your shell from Homeworks 1 and 2 with a few new features:

As with homework 2, you are welcome to use the utility files that were provided in that assignment (here and the header file here). These files are unchanged from homework 2, so if you still have those versions in your repository, you should continue to use them.

The first_unquoted_space() function in the utils.c file can be used to aid in parsing commands without using functions like strtok_r() (which won't work for parsing because of requirements 1 and 2 of this assignment). Remember that C strings are just arrays, and you can easily overwrite characters at will. If you want to end a string at a given position, overwrite that character with a \0 character.

Remember, the first_unquoted_space() function returns -1 if there are no spaces left in the input string that are unquoted.

Your shell program is not allowed to use any external libraries other than the system's C library and the files provided in this assignment. Do not try to use libraries like Readline. You will lose points for using external libraries to implement shell functionality!

When submitting your shell program, please be sure to include the source code of the shell program (in one or more C source code files), as well as a Makefile that can be used to build the shell. Your shell must be able to be built and run on a VM as has been set up for this course in your projects. If you use my utility functions, make sure to include those files as well.

As this should be an extension of your earlier homework 1/2 shell, you should be using the same directory and git repository for it. To submit your code, you should do the following:

git add your_updated_and_added_files_go_here
git commit
git push -u origin master

git tag hw3
git push origin --tags

Last modified Tuesday, 01-Sep-2020 18:43:36 EDT