Difference between revisions of "Operating Systems 2018F: Assignment 2"

From Soma-notes
Jump to navigation Jump to search
Line 14: Line 14:
# [2] If you change line 68 of 3000test.c to be <tt>data[i] = 'A';</tt>  (from <tt>count++;</tt>), what will the program do?  Explain briefly.
# [2] If you change line 68 of 3000test.c to be <tt>data[i] = 'A';</tt>  (from <tt>count++;</tt>), what will the program do?  Explain briefly.
# [2] What does setup_comm_fn() do in 3000shell?
# [2] What does setup_comm_fn() do in 3000shell?
# [2] How can you modify 3000pc so the consumer stops consuming once it finds an empty queue?
# [2] How can you modify 3000pc so the consumer permanently stops consuming once it finds an empty queue?
# [2] What would happen to 3000pc if we replaced lines 341-347 with <tt>s = (shared *) malloc(sizeof(shared));</tt>?  Why?
# [2] What would happen to 3000pc if we replaced lines 341-347 with <tt>s = (shared *) malloc(sizeof(shared));</tt>?  Why?
# [2] In 3000pc, what happens if you remove the calls to kill()?  What does this tell you about the roles of signals in this program?
# [2] In 3000pc, what happens if you remove the calls to kill()?  What does this tell you about the roles of signals in this program?
# [2] Is it possible to predict the output of /dev/random?  Explain briefly.
# [2] Is it possible to predict the output of /dev/random?  Explain briefly.
# [2] Do sem_wait() and sem_post() generate system calls?  (Be sure to check!)  Why?
# [2] Do sem_wait() and sem_post() generate system calls?  (Be sure to check!)  Why?

Revision as of 15:27, 5 October 2018

Please submit the answers to the following questions via CULearn by 2:30 PM on Wednesday, October 10, 2018. There are 20 points in 10 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. [2] Assume you have a file A. You type ln A B in order to create file B. What is the relationship between the return of lstat() on A versus B? Explain briefly.
  2. [2] Assume you have a file A. You type ln -s A B in order to create file B. What is the relationship between the return of lstat() on A versus B? Explain briefly.
  3. [2] How could you modify 3000test.c so it can report on what a file's user ID and group ID are and the corresponding username and group name? Specify the changes you make rather than writing all the code out. (In other words, code a solution and explain the changes you made here.)
  4. [2] If you change line 68 of 3000test.c to be data[i] = 'A'; (from count++;), what will the program do? Explain briefly.
  5. [2] What does setup_comm_fn() do in 3000shell?
  6. [2] How can you modify 3000pc so the consumer permanently stops consuming once it finds an empty queue?
  7. [2] What would happen to 3000pc if we replaced lines 341-347 with s = (shared *) malloc(sizeof(shared));? Why?
  8. [2] In 3000pc, what happens if you remove the calls to kill()? What does this tell you about the roles of signals in this program?
  9. [2] Is it possible to predict the output of /dev/random? Explain briefly.
  10. [2] Do sem_wait() and sem_post() generate system calls? (Be sure to check!) Why?