Operating Systems 2014F: Assignment 2

From Soma-notes
Revision as of 18:42, 12 September 2014 by Soma (talk | contribs) (→‎Questions)

This assignment is not yet finalized.

Please submit the answers to the following questions via CULearn by midnight on Wednesday, September 17, 2014. There 10 points in 6 questions.

Submit your answers as a single text file named "<username>-comp3000-assign2.txt" (where username is your MyCarletonOne username). The first four lines of this file should be "COMP 3000 Assignment 2", 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 is the relationship between function calls and system calls?
  2. [1] How would you send a signal to a process to have it pause execution? Resume?
  3. [2] Where are environment variables stored? Specifically, if a process changes its environment variables, are the variables of any other processes changed? Be sure to consider currently running and processes created in the future.
  4. [2] Precisely describe the data structure used to store environment variables when they are passed to execve().
  5. [2] What happens when a program attempts to access memory location 0? Give a simple program that attempts to do this and explain what happens when it runs. Be sure to explain what program produces the output seen at the command line. (You may want to run the program using strace to get a better idea what is happening.)
  6. [2] Give the code for a limited "fork bomb" that creates the number of processes listed on the command line. Each process should print out which process it is, e.g. "I am bomb process 17!" (where the count is the count of the number of processes created, not the PID). After printing the count each should then sleep for 30 seconds (using sleep()) and then terminate.