Operating Systems 2017F: Assignment 1

From Soma-notes
Revision as of 17:11, 5 October 2017 by Soma (talk | contribs)

Please submit the answers to the following questions via CULearn by midnight on Monday, October 9, 2017. There are 20 points in 13 questions.

Submit your answers as a single text file named "<username>-comp3000-assign1.txt" (where username is your MyCarletonOne username). The first four lines of this file should be "COMP 3000 Assignment 1", your name, student number, and the date of submission. You may wish to format your answers in Markdown to improve their appearance.

No other formats will be accepted. Submitting in another format will likely result in your assignment not being graded and you receiving no marks for this assignment. In particular do not submit an MS Word or OpenOffice file as your answers document!

Don't forget to include what outside resources you used to complete each of your answers, including other students, man pages, and web resources. You do not need to list help from the instructor, TA, or information found in the textbook.

Questions

  1. [1] What system call is used to send signals?
  2. [1] Why are both fork and execve necessary for 3000shell to run programs?
  3. [1] Dynamically-linked programs are smaller on disk than statically linked programs. Which would you expect to use more memory (RAM) when running? Why?
  4. [1] If you changed the kernel so it didn't generate SIGCHLD signals, how would the behavior of userspace programs change?
  5. [2] In what format are environment variables stored? What about command line arguments?
  6. [2] Does a program make a system call to get the value of an environment variable? Why?
  7. [2] When we call a system call such as fork in C, we do so with what looks like a C function call. Are we really making a function call? Explain.
  8. [2] What does parse_args() do? Specifically, what is its input, and what is its output and side effects?
  9. [1] Why does interaction with 3000shell often gets "messed up" when running programs in the background with &?
  10. [2] What system calls are used to list all the files in a directory? What are the library calls that are normally used to make those system calls?
  11. [1] What happens when you delete line 293 (the call to wait())? Why?
  12. [2] What happens to an in-progress system call when a process receives a signal? (An example is a program waiting for input from a terminal with a blocking read call.) What does "restarting" a system call have to do with this?
  13. [2] Describe how you could add input redirection for external programs to 3000shell.