Operating Systems 2017F: Assignment 2: Difference between revisions
No edit summary |
|||
Line 14: | Line 14: | ||
# [1] How can you modify 3000pc so the producer stops producing once it fills the buffer? | # [1] How can you modify 3000pc so the producer stops producing once it fills the buffer? | ||
# [1] Under what circumstances is fill_rand_buffer() called in 3000random? | # [1] Under what circumstances is fill_rand_buffer() called in 3000random? | ||
# [1] If the two signal handling functions in 3000pc were replaced by one function, would there be any significant loss of functionality? Briefly | # [1] If the two signal handling functions in 3000pc were replaced by one function, would there be any significant loss of functionality? Briefly explain. | ||
explain. | |||
# [2] How could you modify 3000test.c so it can report on whether two device files are equal without actually accessing the underlying devices? Specify the changes you would make to 3000test.c rather than doing this from scratch. | # [2] How could you modify 3000test.c so it can report on whether two device files are equal without actually accessing the underlying devices? Specify the changes you would make to 3000test.c rather than doing this from scratch. | ||
# [2] Does the MAP_SHARED flag on line 60 of 3000test.c (inside the call to mmap) make a significant difference in its execution? Specifically, what happens when you remove it or changed it to MAP_PRIVATE? Why? | # [2] Does the MAP_SHARED flag on line 60 of 3000test.c (inside the call to mmap) make a significant difference in its execution? Specifically, what happens when you remove it or changed it to MAP_PRIVATE? Why? |
Revision as of 02:50, 19 October 2017
This assignment is not yet finalized.
Please submit the answers to the following questions via CULearn by 11:55 PM on Thursday, October 26, 2017. There are ?? points in ?? 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] Why does a different version of stat(), lstat(), exist that treats symbolic links differently? Why isn't a different version needed for hard links?
- [1] How can you modify 3000pc so the producer stops producing once it fills the buffer?
- [1] Under what circumstances is fill_rand_buffer() called in 3000random?
- [1] If the two signal handling functions in 3000pc were replaced by one function, would there be any significant loss of functionality? Briefly explain.
- [2] How could you modify 3000test.c so it can report on whether two device files are equal without actually accessing the underlying devices? Specify the changes you would make to 3000test.c rather than doing this from scratch.
- [2] Does the MAP_SHARED flag on line 60 of 3000test.c (inside the call to mmap) make a significant difference in its execution? Specifically, what happens when you remove it or changed it to MAP_PRIVATE? Why?
- [2] When a file is mmap'd into memory, when is its contents loaded from disk? How can you verify this using 3000test?
- [2] What is one way you can modify 3000pc so the consumer consumes exactly as fast as the producer produces (i.e., the producer and the consumer move in lock step?) Your modification should not involve sleeping (by either the producer or the consumer).
- [2] Which is faster, /dev/urandom or /dev/random? What evidence do you have for this difference based on code that you ran (3000random or other programs)?
- [2] How does the behavior of 3000pc change if you delete lines 149 and 152 (the if statement in wakeup_consumer())? Why?
- [2] What happens if you delete line 231 (the call to wakeup_producer()) in 3000pc? Why?
- [2] How does the behavior of the program change if you change QUEUESIZE to 8? What about 128?