Operating Systems 2019W: Assignment 4

From Soma-notes
Revision as of 19:15, 1 April 2019 by Soma (talk | contribs)
Jump to navigation Jump to search

For this assignment please work on the questions below. While you will be able to submit your answers, by defalt they will not be graded. Instead, an approximately 20 question multiple choice quiz (based on the questions below) will be made available by April 8 and will be due by 4 PM on April 10th. The grade for this quiz will substitute for Assignment 4.

In class on April 10th solutions for the assignment questions below and the Assignment 4 Quiz will be given and discussed.

If you feel your answers to the quiz do not demonstrate what you actually learned, you can make an appointment with Prof. Somayaji to grade your submitted Assignment 4 answers (assuming you submitted them by April 10th) before April 19th.

Questions

  1. [2] When you hit Ctrl-C while running the bc command, does the Ctrl-C generate a signal? How do you know?
  2. [2] Does bashreadline report commands given to bash via shell scripts? How do you know?
  3. [2] How can you modify 3000pc so the producer stops on the third time it fills its queue? Give your code as a diff -c versus the original 3000pc
  4. [2] Under what conditions would 3000pc never send a signal (from the producer to the consumer or vice versa)? How could you modify 3000pc so this occurance was more likely?
  5. [2] Implement and critique your own version of sem_wait() and sem_post() in pure C with no system calls. Do you think your version is free of race conditions? Explain.
  6. [2] Change 300pc so that uses a shared memory mapped file rather than simply shared memory to communicate between the producer and consumer. How big is the file? Does its size change?
  7. [2] How difficult is it for a userspace process to generate truly random numbers on its own, without the assistance of the kernel? Explain.
  8. [2] Does the ssh command use random numbers? How can you demonstrate this?
  9. [2] Can a setuid root process give up its privileges and run as a regular user? Is this change necessarily permanant?
  10. [2] What are the main factors that influence whether the attacker wins the race with 3000run-write? Explain what it means for the attacker to win.