Sp99 midterm 1-solutions - University of California...

Info icon This preview shows pages 1–4. Sign up to view the full content.

Page 1/8 University of California, Berkeley College of Engineering Computer Science Division – EECS Spring 1999 Anthony D. Joseph Midterm Exam Solutions and Grading Guidelines March 3, 1999 CS162 Operating Systems Your Name: SID: TA: Discussion Section: General Information: This is a closed book examination. You have two hours to answer as many questions as possible. The number in parentheses at the beginning of each question indicates the number of points given to the question; there are 100 points in all. You should read all of the questions before starting the exam, as some of the questions are substantially more time consuming. Write all of your answers directly on this paper. Make your answers as concise as possible (you needn't cover every available nano-acre with writing). If there is something in a question that you believe is open to interpretation, then please go ahead and interpret, but state your assumptions in your answer. Good Luck!! Problem Possible Score 1 13 2 24 3 18 4 30 5 15 Total 100
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

CS 162 Spring 1999 Midterm Exam March 3, 1999 Page 2/8 1. Threads (13 points total): a. (6 points) What state does a thread share with other threads in a process and what state is private/specific to a thread? Be explicit in your answer. Shared state: (1) Contents of memory (global variables, heap) (2) I/O state (file system) Having both answers is worth 3 points. Having one answer is worth 2 points. Private state: (1) CPU registers (including, program counter and stack pointer) (2) Execution stack Having both answers is worth 3 points. Having one answer is worth 2 points. b. (7 points) Draw a picture of the three states of a thread and label the transitions between the states: Running Runnable Blocked I/O request, thread wait I/O complete, thread signal yield, timer int. scheduled Each state and each arc is worth 1 point. 2. Context switching and CPU scheduling (24 points total): a. (3 points) What state is saved on a context switch between threads? CPU registers, program counter, and stack pointer. Each answer is worth 1 point. b. (6 points) List two reasons why Nachos disables interrupts when a thread/process sleeps, yields, or switches to a new thread/process? Interrupts are disabled for two reasons: (1) To prevent context switching from occurring while registers are being saved/restored. (2) To enable a thread/process to add itself to a queue (e.g., a wait queue) without allowing another thread to interrupt the action. Each answer is worth 3 points. If the answer was not specific about the potential conflict that could occur, we deducted 1 point.
Image of page 2
CS 162 Spring 1999 Midterm Exam March 3, 1999 Page 3/8 c. (15 points) Consider the following processes, arrival times, and CPU processing requirements: Process Name Arrival Time Processing Time 1 0 3 2 1 5 3 3 2 4 9 2 For each of the following scheduling algorithms, fill in the table with the process that
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern