Name: ________________________________ Login: _____________

Comp111 Final Exam
Monday Dec 21, 2015 - open books and notes

Any and all printed and written materials are allowed, including books, course notes, and handwritten notes.

No electronic devices of any kind are allowed, including cellphones, calculators, pagers, laptops, etc. Please turn these off before beginning the exam.

Please show all work on these pages. Feel free to use the back of each page as needed. Make sure that your work for each problem is clearly marked, especially on the backs of pages. These pages will be graded and returned electronically, like exercises, and the results will be made available online.

Please note that point values have no correspondence with difficulty. We suggest that you solve the problems that you best understand first.

Please also note that the space I gave you to answer is the space I would need, and not necessarily the space you will need. There is no deduction for more verbose answers (though succinct and comprehensive answers are very much appreciated by your instructor!).


ProblemScoreofMaximum
1       of 10
2       of 10
3       of 10
4       of 10
5       of 10
6       of 10
7a       of 10
7b       of 10
8       of 10
9       of 10
10       of 10
Total       of 100

    Name: ________________________________ Login: _____________

  1. What behaviors outside the disk paging system are dependent upon what the paging system does? Why?


















  2. What are the disadvantages of building a filesystem without knowledge boundaries between the paging system and the filesystem driver?

    Name: ________________________________ Login: _____________

  3. What bad things can happen if a heavily used service lacks admission control (long term scheduling)?















  4. A few years ago, I overheard an interesting conversation in the lounge, in which a student claimed to have hacked Provide and was able to change grades. At the time, the protections for all directories in Provide were group grade111, drwxrws--x and the actual grading files, two directories down, were owned by the student and in group grade111, with protection -rw-rw----.

    How was it possible to change grading files? What did the student need to know in order to accomplish this?

    (This has been fixed!)

    Name: ________________________________ Login: _____________

  5. Consider the code:
     
    main() { printf("hi"); fork(); write(fileno(stdout), "ho", 2); } 
    
    What does this print on stdout? Why?
















  6. There are actually many forms of operating system virtualization. One of the newer forms that is quite useful for software development is the "Docker" system for application virtualization. A linux user can run several autonomous copies of the same linux OS in "Docker containers" that are owned by that user and share many of their resources with the linux "Host OS" that runs the containers as ordinary linux processes. Thus, one can easily and efficiently simulate a multi-host linux system on a single host.

    (I am a very enthusiastic user of this tool.)

    Each container can use a filesystem that is actually a directory owned by the user on the Host OS. How can a Container OS use a directory on the disk of the host OS as its filesystem? What modifications to the Container OS are necessary compared to the Host OS? Hint: the Host OS is not modified; this is one of the reasons Docker is so useful!

    Name: ________________________________ Login: _____________

  7. A web application receives requests from the outside world, requests and reads answers from a database, and sends results back out to requesters.
    1. Suppose that the web application is in balance. If the web application receives an average of 100 requests/minute, and takes an an average of 2 seconds to answer each request, what is the average number of requests in system?













    2. Supposing the same balance situation as the above, and that a database request takes an average of 1/2 second, how many database requests are pending at a time, on average? Why? Hint: you might want to draw a picture of the chain of processing, including receipt of query, database query, and post-processing after the query. Use this picture to reason about the answer.

    Name: ________________________________ Login: _____________

  8. Many web services run on linux instances (e.g., in Docker!) with a different process scheduler than the default. How is the scheduler different, and why? Hint: there are no regular users who log into the system; just the web services.















  9. I had a programming problem last Friday (for real!) concerning the following code:
     
    void record_request(char *request) { 
        if (! request_added(request)) { 
    	add_request(request); 
        } 
    } 
    
    When executed in multiple threads, often duplicate requests were created even though the code obviously seems to "prevent" that. Exactly what went wrong, and how would you fix this?

    (This was inside a user library, and not in my code!:)

    Name: ________________________________ Login: _____________

  10. (10 points EXTRA CREDIT) There are two different concepts in database systems: atomicity and serialization. Atomicity is just what we learned about here; requests are atomic with respect to one another. Serialization refers to the fact that when multiple requests arrive, they are never done in parallel; they are always done one by one. Are these equivalent or different concepts, and why?