COMP 300E Operating Systems Fall Semester 2011 Midterm Examination SAMPLE. Name: Student ID:

Size: px
Start display at page:

Download "COMP 300E Operating Systems Fall Semester 2011 Midterm Examination SAMPLE. Name: Student ID:"

Transcription

1 COMP 300E Operating Systems Fall Semester 2011 Midterm Examination SAMPLE Time/Date: 5:30 6:30 pm Oct 19, 2011 (Wed) Name: Student ID: 1. Short Q&A 1.1 Explain the convoy effect with FCFS scheduling algorithm. Short jobs queue up behind long job and suffer long delays. 1.2 What is the effect of too-large or too-small time quantum for Round-Robin scheduling? Too large: Performance of short jobs suffers Too small: Performance of long jobs suffers due to excessive context-switch overhead 1.3 Can any of the three scheduling schemes (FCFS, SRTF, or RR) result in starvation? If so, how might you fix this? Yes. SRTF continuously places short jobs in front of long jobs. Consequently, it is possible for long jobs to never get a chance to run. You can fix this by utilizing an algorithm that guarantees that no thread is prevented from making forward progress. Example: use a lottery scheduler or a multi-level scheduler that gives a guaranteed minimum amount of compute time to the lowest-priority (background) tasks. 1.4 Explain the problem with the following approach of implementing locks: LockAcquire { disable Interrupts; LockRelease { enable Interrupts; Interrupts can be disabled for a long time, causing the system to be unresponsive or hang up. 1.5 List the four necessary conditions for deadlocks. Mutual exclusion, Hold and wait, No preemption, Circular wait

2 2. Processor Scheduling. If the time quantum in a time-sharing system using Round-Robin scheduling is Tq and the average overhead due to context switching and swapping is Ts, discuss the problem of setting the value of Tq in each of the following cases: Tq approaching infinity (What is this scheduling algorithm commonly called?) Answer: FCFS (or FIFO) Tq less than or equal to Ts Answer: The system spends >= 50% time in context switch and swapping and not enough time is spent executing user processes => inefficient. Tq = 1.1 * Ts Answer: Similar problem as (ii). Quantum time is too small, only 10% higher than the overhead. Tq = 30 seconds Answer: Quantum time is too long relative to context switch. System is unresponsive (not good for interactive system). A short job requiring 1 second of CPU time may have to wait for ½ minute behind a long job. 3. Processor Scheduling. Here is a table of processes and their associated running times. All of the processes arrive in numerical order at time 0, i.e., Process 1 arrives first, process 2 arrives second, etc. Process ID Running Time

3 a. Show the scheduling order for these processes under First-In-First-Out (FIFO), Shortest-Job First (SJF), and Round-Robin (RR) scheduling with a timeslice quantum = 1 time unit, by filling in the table with process ID currently running in each time quantum. (Each entry in the time column denotes start time of each time quantum, i.e., entry 0 denotes time quantum [0,1].) Time FIFO SJF RR b. Indicate the response time for each process in each schedule above. Scheduler Process 1 Process 2 Process 3 Process 4 Process 5 FIFO SJF RR Synchronization Please finish the below program for Bounded-Buffer problem, fill each blank one sentence, suppose buffer s upper bound is N, and the buffer is initially empty. Semaphore fullbuffer = ; Semaphore emptybuffers = ; Semaphore mutex = 1; // No one using machine Producer(item) {

4 Enqueue(item); Consumer() { item = Dequeue(); return item; Answer: Semaphore fullbuffer = 0; Semaphore emptybuffers = N; Semaphore mutex = 1; Producer(item) { emptybuffers.p(); mutex.p(); Enqueue(item); mutex.v(); fullbuffers.v(); Consumer() { fullbuffers.p(); mutex.p(); item = Dequeue(); mutex.v(); emptybuffers.v(); return item; 5. Synchronization We want to use semaphores to implement a shared critical section (CS) among three threads T1, T2, and T3. We want to enforce the execution in the CS in this order: First T2 must execute in the CS. When it finishes, T1 will then be allowed to enter the and when it finishes T3 will then be allowed to enter the when T3 finishes then T2 will be allowed to enter the CS, and so on, (T2, T1, T3, T2, T1, T3, )

5 a) What is the minimal number of semaphores we need in order to implement this ordering and mutual exclusion; and what are their initial values 3 semaphores, with initial values S1=1, S2=0, S3=0; b) Insert the appropriate instructions and the P() and V() operations in the appropriate places in the pseudo-code below to fulfill this ordered execution. T1 T2 T3 Answer: (Initially, S1=1, S2=0, S3=0;) T1 T2 T3 P(S2); V(S3); P(S1); V(S2); P(S3); V(S1); 6. Synchronization A particular river crossing is shared by both Linux Hackers and Microsoft employees. A boat is used to cross the river, but it only seats four people, and must always carry a full load. In order to guarantee the safety of the hackers, you cannot put three employees and one hacker in the same boat (because the employees would gang up and convert the hacker). Similarly, you cannot put three hackers in the same boat as an employee (because the hackers would gang up and convert the employee). All other combinations are safe. Two procedures are needed: HackerArrives and EmployeeArrives, called by a hacker or employee when he/she arrives at the river bank. The procedures arrange the arriving hackers and employees into safe boatloads; once the boat is full, one thread

6 calls Rowboat and only after the call to Rowboat, the four threads representing the people in the boat can return. Any order is acceptable and there should be no busy-waiting and no undue waiting hackers and employees should not wait if there are enough of them for a safe boatload. Answer the question by filling in the blanks: int WH = 0, WE = 0; // shared variables tracking waiting people Lock mutex = FREE; // Lock to enforce correctness property Condition Hacker; // Used to wait for enough people to cross river Condition Employee // Same as Hacker void HackerArrives() { mutex->acquire(); // Enter the critical section so we can check state vars if (WH == 3) { // We ve already got three waiting hackers. Lets go! else if ((WH >= 1) && (WE >= 2) { // 1 other hacker, 2 employees else { mutex->release(); // Done with critical section Answer: int WH = 0, WE = 0; // shared variables tracking waiting people Lock mutex = FREE; // Lock to enforce correctness property Condition Hacker; // Used to wait for enough people to cross river Condition Employee; // Same as Hacker void HackerArrives() { mutex->acquire(); // Enter the critical section so we can check state vars if (WH == 3) { // We ve already got three waiting hackers. Lets go! Hacker->signal(); // Wake three hackers (any three)

7 Hacker->signal(); Hacker->signal(); WH = 3; // Decrement state vars (this must be done here, not later) Rowboat(); // Cross the river else if ((WH >= 1) && (WE >= 2) { // 1 other hacker, 2 employees Hacker->signal(); // Wake up one hacker, two employees Employee->signal(); Employee->signal(); WH ; // Decrement state vars WE = 2; Rowboat(); else { WH++; // Wait for more Hackers to arrive Hacker->wait(mutex); // No need to check state vars mutex->release(); // Done with critical section The solution for EmployeeArrives is symmetric. 7. Deadlocks Is there a deadlock in the system depicted by the following resource allocation graph? Why? Answer: No, there is no deadlock in this system. When P4 finishes it will release its instance of R2 and R3. Then both, P3 and P2 can proceed with their execution and finish, releasing their instances of R2, R1 and R3. Then P1 can proceed and finish execution.

8 8. Deadlocks Consider the following snapshot of a system: C (Current allocation matrix) R (Request matrix) A (Available resource vector) A B C D A B C D A B C D P P P P Answer the following questions using Banker s algorithm: a. Determine if the system is currently in a safe state using Banker s algorithm. (Hint: first determine the matrix of additional resources needed by each process, then find a sequence of process executions that can complete successfully. We have provided the tables below, so you only need to fill in the blanks.) (This question is straight out of the lecture notes, but the actual exam question may be a new problem with different parameters.) Answer: R C = Still Needed (maxtrix) Still Needed A B C D P P P P The allocation should be safe right now, with a sequence of process executions. Answer: Yes, with <P0, P3, P4, P1, P2>. Resources available after each process finished A B C D P P P P b. If a request from process P1 arrives for (0, 0, 1, 0), can the requested be granted

9 immediately? (Hint: run Banker s algorithm after the request has been granted to determine if the system state is still safe. If yes, then show the sequence of successful process executions; if no, then you do not need to show any further details. ) Answer: No, this ca not be allocated. If this is allocated, the resulting Available() is (0, 3, 0, 4), there is no sequence of the process execution order that lead to the completion of all processes. This is an unsafe state.

Last Class: Deadlocks. Today

Last Class: Deadlocks. Today Last Class: Deadlocks Necessary conditions for deadlock: Mutual exclusion Hold and wait No preemption Circular wait Ways of handling deadlock Deadlock detection and recovery Deadlock prevention Deadlock

More information

CS 162 Midterm Exam. October 18, This is a closed book examination. You have 60 minutes to answer as many questions

CS 162 Midterm Exam. October 18, This is a closed book examination. You have 60 minutes to answer as many questions CS 162 Midterm Exam October 18, 1993 Your Name: Lecture (A.M. or P.M.): General Information: This is a closed book examination. You have 60 minutes to answer as many questions as possible. The number in

More information

Sample Questions. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic)

Sample Questions. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic) Sample Questions Amir H. Payberah amir@sics.se Amirkabir University of Technology (Tehran Polytechnic) Amir H. Payberah (Tehran Polytechnic) Sample Questions 1393/8/10 1 / 29 Question 1 Suppose a thread

More information

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 8: Semaphores, Monitors, & Condition Variables

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 8: Semaphores, Monitors, & Condition Variables CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring 2004 Lecture 8: Semaphores, Monitors, & Condition Variables 8.0 Main Points: Definition of semaphores Example of use

More information

Operating Systems: Quiz2 December 15, Class: No. Name:

Operating Systems: Quiz2 December 15, Class: No. Name: Operating Systems: Quiz2 December 15, 2006 Class: No. Name: Part I (30%) Multiple Choice Each of the following questions has only one correct answer. Fill the correct one in the blank in front of each

More information

Homework Assignment #5

Homework Assignment #5 Homework Assignment #5 Question 1: Scheduling a) Which of the following scheduling algorithms could result in starvation? For those algorithms that could result in starvation, describe a situation in which

More information

CS 318 Principles of Operating Systems

CS 318 Principles of Operating Systems CS 318 Principles of Operating Systems Fall 2017 Midterm Review Ryan Huang 10/12/17 CS 318 Midterm Review 2 Midterm October 17 th Tuesday 9:00-10:20 am at classroom Covers material before virtual memory

More information

Midterm Exam. October 20th, Thursday NSC

Midterm Exam. October 20th, Thursday NSC CSE 421/521 - Operating Systems Fall 2011 Lecture - XIV Midterm Review Tevfik Koşar University at Buffalo October 18 th, 2011 1 Midterm Exam October 20th, Thursday 9:30am-10:50am @215 NSC Chapters included

More information

February 23 rd, 2015 Prof. John Kubiatowicz

February 23 rd, 2015 Prof. John Kubiatowicz CS162 Operating Systems and Systems Programming Lecture 9 Synchronization Continued, Readers/Writers example, Scheduling February 23 rd, 2015 Prof. John Kubiatowicz http://cs162.eecs.berkeley.edu Acknowledgments:

More information

September 23 rd, 2015 Prof. John Kubiatowicz

September 23 rd, 2015 Prof. John Kubiatowicz CS162 Operating Systems and Systems Programming Lecture 8 Locks, Semaphores, Monitors, and Quick Intro to Scheduling September 23 rd, 2015 Prof. John Kubiatowicz http://cs162.eecs.berkeley.edu Acknowledgments:

More information

Midterm Exam March 13, 2013 CS162 Operating Systems

Midterm Exam March 13, 2013 CS162 Operating Systems University of California, Berkeley College of Engineering Computer Science Division EECS Spring 2013 Anthony D. Joseph Midterm Exam March 13, 2013 CS162 Operating Systems Your Name: SID AND 162 Login:

More information

OS Structure. User mode/ kernel mode (Dual-Mode) Memory protection, privileged instructions. Definition, examples, how it works?

OS Structure. User mode/ kernel mode (Dual-Mode) Memory protection, privileged instructions. Definition, examples, how it works? Midterm Review OS Structure User mode/ kernel mode (Dual-Mode) Memory protection, privileged instructions System call Definition, examples, how it works? Other concepts to know Monolithic kernel vs. Micro

More information

OS Structure. User mode/ kernel mode. System call. Other concepts to know. Memory protection, privileged instructions

OS Structure. User mode/ kernel mode. System call. Other concepts to know. Memory protection, privileged instructions Midterm Review OS Structure User mode/ kernel mode Memory protection, privileged instructions System call Definition, examples, how it works? Other concepts to know Monolithic kernel vs. Micro kernel 2

More information

CS450 OPERATING SYSTEMS FINAL EXAM ANSWER KEY

CS450 OPERATING SYSTEMS FINAL EXAM ANSWER KEY CS450 OPERATING SYSTEMS FINAL EXAM KEY 1. Provide Java class definitions for each of the components of a monitor. Include specifications for local data and methods (names and arguments, not implementation);

More information

CPSC/ECE 3220 Summer 2018 Exam 2 No Electronics.

CPSC/ECE 3220 Summer 2018 Exam 2 No Electronics. CPSC/ECE 3220 Summer 2018 Exam 2 No Electronics. Name: Write one of the words or terms from the following list into the blank appearing to the left of the appropriate definition. Note that there are more

More information

OPERATING SYSTEMS FINAL EXAMINATION APRIL 30, 2006 ANSWER ALL OF THE QUESTIONS BELOW.

OPERATING SYSTEMS FINAL EXAMINATION APRIL 30, 2006 ANSWER ALL OF THE QUESTIONS BELOW. OPERATING SYSTEMS FINAL EXAMINATION APRIL 30, 2006 Name ANSWER ALL OF THE QUESTIONS BELOW. 1. Indicate which of the statements below are true or false and EXPLAIN your answer in ONE SENTENCE. a) A multi-level

More information

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008.

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008. CSC 4103 - Operating Systems Spring 2008 Lecture - XII Midterm Review Tevfik Ko!ar Louisiana State University March 4 th, 2008 1 I/O Structure After I/O starts, control returns to user program only upon

More information

OS 1 st Exam Name Solution St # (Q1) (19 points) True/False. Circle the appropriate choice (there are no trick questions).

OS 1 st Exam Name Solution St # (Q1) (19 points) True/False. Circle the appropriate choice (there are no trick questions). OS 1 st Exam Name Solution St # (Q1) (19 points) True/False. Circle the appropriate choice (there are no trick questions). (a) (b) (c) (d) (e) (f) (g) (h) (i) T_ The two primary purposes of an operating

More information

Midterm Exam #1 September 29, 1999 CS162 Operating Systems

Midterm Exam #1 September 29, 1999 CS162 Operating Systems University of California, Berkeley College of Engineering Computer Science Division EECS Fall 1999 Anthony D. Joseph Midterm Exam #1 September 29, 1999 CS162 Operating Systems Your Name: SID and 162 Login:

More information

Last Class: CPU Scheduling! Adjusting Priorities in MLFQ!

Last Class: CPU Scheduling! Adjusting Priorities in MLFQ! Last Class: CPU Scheduling! Scheduling Algorithms: FCFS Round Robin SJF Multilevel Feedback Queues Lottery Scheduling Review questions: How does each work? Advantages? Disadvantages? Lecture 7, page 1

More information

CSE 120 Principles of Operating Systems

CSE 120 Principles of Operating Systems CSE 120 Principles of Operating Systems Fall 2016 Lecture 8: Scheduling and Deadlock Geoffrey M. Voelker Administrivia Thursday Friday Monday Homework #2 due at start of class Review material for midterm

More information

Lecture 9: Midterm Review

Lecture 9: Midterm Review Project 1 Due at Midnight Lecture 9: Midterm Review CSE 120: Principles of Operating Systems Alex C. Snoeren Midterm Everything we ve covered is fair game Readings, lectures, homework, and Nachos Yes,

More information

CPU Scheduling. CSE 2431: Introduction to Operating Systems Reading: Chapter 6, [OSC] (except Sections )

CPU Scheduling. CSE 2431: Introduction to Operating Systems Reading: Chapter 6, [OSC] (except Sections ) CPU Scheduling CSE 2431: Introduction to Operating Systems Reading: Chapter 6, [OSC] (except Sections 6.7.2 6.8) 1 Contents Why Scheduling? Basic Concepts of Scheduling Scheduling Criteria A Basic Scheduling

More information

Maximum CPU utilization obtained with multiprogramming. CPU I/O Burst Cycle Process execution consists of a cycle of CPU execution and I/O wait

Maximum CPU utilization obtained with multiprogramming. CPU I/O Burst Cycle Process execution consists of a cycle of CPU execution and I/O wait Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Thread Scheduling Operating Systems Examples Java Thread Scheduling Algorithm Evaluation CPU

More information

CSE 120. Fall Lecture 8: Scheduling and Deadlock. Keith Marzullo

CSE 120. Fall Lecture 8: Scheduling and Deadlock. Keith Marzullo CSE 120 Principles of Operating Systems Fall 2007 Lecture 8: Scheduling and Deadlock Keith Marzullo Aministrivia Homework 2 due now Next lecture: midterm review Next Tuesday: midterm 2 Scheduling Overview

More information

CSE 153 Design of Operating Systems

CSE 153 Design of Operating Systems CSE 153 Design of Operating Systems Winter 2018 Midterm Review Midterm in class on Monday Covers material through scheduling and deadlock Based upon lecture material and modules of the book indicated on

More information

STUDENT NAME: STUDENT ID: Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Total

STUDENT NAME: STUDENT ID: Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Total University of Minnesota Department of Computer Science & Engineering CSci 5103 - Fall 2018 (Instructor: Tripathi) Midterm Exam 1 Date: October 18, 2018 (1:00 2:15 pm) (Time: 75 minutes) Total Points 100

More information

Department of Computer applications. [Part I: Medium Answer Type Questions]

Department of Computer applications. [Part I: Medium Answer Type Questions] Department of Computer applications BBDNITM, Lucknow MCA 311: OPERATING SYSTEM [Part I: Medium Answer Type Questions] UNIT 1 Q1. What do you mean by an Operating System? What are the main functions of

More information

Page 1. CS162 Operating Systems and Systems Programming Lecture 8. Readers-Writers Language Support for Synchronization

Page 1. CS162 Operating Systems and Systems Programming Lecture 8. Readers-Writers Language Support for Synchronization Review: Implementation of Locks by Disabling Interrupts CS162 Operating Systems and Systems Programming Lecture 8 Readers-Writers Language Support for Synchronization Friday 11, 2010 Ion Stoica http://insteecsberkeleyedu/~cs162

More information

Student Name: University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Science

Student Name: University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Science University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Science CS 162 Spring 2011 I. Stoica FIRST MIDTERM EXAMINATION Wednesday, March 9, 2011 INSTRUCTIONS

More information

Remaining Contemplation Questions

Remaining Contemplation Questions Process Synchronisation Remaining Contemplation Questions 1. The first known correct software solution to the critical-section problem for two processes was developed by Dekker. The two processes, P0 and

More information

Preview. Process Scheduler. Process Scheduling Algorithms for Batch System. Process Scheduling Algorithms for Interactive System

Preview. Process Scheduler. Process Scheduling Algorithms for Batch System. Process Scheduling Algorithms for Interactive System Preview Process Scheduler Short Term Scheduler Long Term Scheduler Process Scheduling Algorithms for Batch System First Come First Serve Shortest Job First Shortest Remaining Job First Process Scheduling

More information

STUDENT NAME: STUDENT ID: Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Total

STUDENT NAME: STUDENT ID: Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Total University of Minnesota Department of Computer Science CSci 5103 - Fall 2016 (Instructor: Tripathi) Midterm Exam 1 Date: October 17, 2016 (4:00 5:15 pm) (Time: 75 minutes) Total Points 100 This exam contains

More information

CS 4410 Operating Systems. Review 1. Summer 2016 Cornell University

CS 4410 Operating Systems. Review 1. Summer 2016 Cornell University CS 4410 Operating Systems Review 1 Summer 2016 Cornell University 1 A modern computer system keyboard disks mouse printer monitor CPU Disk controller USB controller Graphics adapter memory OS device driver

More information

CPSC/ECE 3220 Summer 2017 Exam 2

CPSC/ECE 3220 Summer 2017 Exam 2 CPSC/ECE 3220 Summer 2017 Exam 2 Name: Part 1: Word Bank Write one of the words or terms from the following list into the blank appearing to the left of the appropriate definition. Note that there are

More information

Midterm I October 12 th, 2005 CS162: Operating Systems and Systems Programming

Midterm I October 12 th, 2005 CS162: Operating Systems and Systems Programming University of California, Berkeley College of Engineering Computer Science Division EECS Fall 2005 John Kubiatowicz Midterm I October 12 th, 2005 CS162: Operating Systems and Systems Programming Your Name:

More information

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University CS 571 Operating Systems Midterm Review Angelos Stavrou, George Mason University Class Midterm: Grading 2 Grading Midterm: 25% Theory Part 60% (1h 30m) Programming Part 40% (1h) Theory Part (Closed Books):

More information

Review. Preview. Three Level Scheduler. Scheduler. Process behavior. Effective CPU Scheduler is essential. Process Scheduling

Review. Preview. Three Level Scheduler. Scheduler. Process behavior. Effective CPU Scheduler is essential. Process Scheduling Review Preview Mutual Exclusion Solutions with Busy Waiting Test and Set Lock Priority Inversion problem with busy waiting Mutual Exclusion with Sleep and Wakeup The Producer-Consumer Problem Race Condition

More information

CS-537: Midterm Exam (Spring 2001)

CS-537: Midterm Exam (Spring 2001) CS-537: Midterm Exam (Spring 2001) Please Read All Questions Carefully! There are seven (7) total numbered pages Name: 1 Grading Page Points Total Possible Part I: Short Answers (12 5) 60 Part II: Long

More information

Last Class: Synchronization Problems. Need to hold multiple resources to perform task. CS377: Operating Systems. Real-world Examples

Last Class: Synchronization Problems. Need to hold multiple resources to perform task. CS377: Operating Systems. Real-world Examples Last Class: Synchronization Problems Reader Writer Multiple readers, single writer In practice, use read-write locks Dining Philosophers Need to hold multiple resources to perform task Lecture 10, page

More information

Operating Systems (1DT020 & 1TT802)

Operating Systems (1DT020 & 1TT802) Uppsala University Department of Information Technology Name: Perso. no: Operating Systems (1DT020 & 1TT802) 2009-05-27 This is a closed book exam. Calculators are not allowed. Answers should be written

More information

Midterm Exam Amy Murphy 6 March 2002

Midterm Exam Amy Murphy 6 March 2002 University of Rochester Midterm Exam Amy Murphy 6 March 2002 Computer Systems (CSC2/456) Read before beginning: Please write clearly. Illegible answers cannot be graded. Be sure to identify all of your

More information

Operating Systems Comprehensive Exam. Spring Student ID # 2/17/2011

Operating Systems Comprehensive Exam. Spring Student ID # 2/17/2011 Operating Systems Comprehensive Exam Spring 2011 Student ID # 2/17/2011 You must complete all of Section I You must complete two of the problems in Section II If you need more space to answer a question,

More information

Spring 2001 Midterm Exam, Anthony D. Joseph

Spring 2001 Midterm Exam, Anthony D. Joseph Midterm Exam March 7, 2001 Anthony D. Joseph CS162 Operating Systems Spring 2001 Midterm Exam, Anthony D. Joseph General Information: This is a closed book and note examination. You have ninety minutes

More information

CS162 Operating Systems and Systems Programming Lecture 7. Mutual Exclusion, Semaphores, Monitors, and Condition Variables

CS162 Operating Systems and Systems Programming Lecture 7. Mutual Exclusion, Semaphores, Monitors, and Condition Variables CS162 Operating Systems and Systems Programming Lecture 7 Mutual Exclusion, Semaphores, Monitors, and Condition Variables September 22, 2010 Prof John Kubiatowicz http://insteecsberkeleyedu/~cs162 Review:

More information

CSE 120. Summer, Inter-Process Communication (IPC) Day 3. Inter-Process Communication (IPC) Scheduling Deadlock. Instructor: Neil Rhodes

CSE 120. Summer, Inter-Process Communication (IPC) Day 3. Inter-Process Communication (IPC) Scheduling Deadlock. Instructor: Neil Rhodes CSE 120 Summer, 2005 Inter-Process Communication (IPC) Day 3 Inter-Process Communication (IPC) Scheduling Deadlock Instructor: Neil Rhodes Inter-Process Communication Cooperating processes must communicate

More information

UNIT:2. Process Management

UNIT:2. Process Management 1 UNIT:2 Process Management SYLLABUS 2.1 Process and Process management i. Process model overview ii. Programmers view of process iii. Process states 2.2 Process and Processor Scheduling i Scheduling Criteria

More information

CS 3204 Operating Systems Programming Project #2 Job / CPU Scheduling Dr. Sallie Henry Spring 2001 Due on February 27, 2001.

CS 3204 Operating Systems Programming Project #2 Job / CPU Scheduling Dr. Sallie Henry Spring 2001 Due on February 27, 2001. CS 3204 Operating Systems Programming Project #2 Job / CPU Scheduling Dr. Sallie Henry Spring 2001 Due on February 27, 2001. 23:59:59 PM Design and implement a program that simulates some of the job scheduling,

More information

COMP 3361: Operating Systems 1 Final Exam Winter 2009

COMP 3361: Operating Systems 1 Final Exam Winter 2009 COMP 3361: Operating Systems 1 Final Exam Winter 2009 Name: Instructions This is an open book exam. The exam is worth 100 points, and each question indicates how many points it is worth. Read the exam

More information

Midterm Exam Amy Murphy 19 March 2003

Midterm Exam Amy Murphy 19 March 2003 University of Rochester Midterm Exam Amy Murphy 19 March 2003 Computer Systems (CSC2/456) Read before beginning: Please write clearly. Illegible answers cannot be graded. Be sure to identify all of your

More information

CS162 Operating Systems and Systems Programming Lecture 8. Readers-Writers Language Support for Synchronization

CS162 Operating Systems and Systems Programming Lecture 8. Readers-Writers Language Support for Synchronization Review: Implementation of Locks by Disabling Interrupts CS162 Operating Systems and Systems Programming Lecture 8 Readers-Writers Language Support for Synchronization September 27, 2010 Prof John Kubiatowicz

More information

OPERATING SYSTEMS ECSE 427/COMP SECTION 01 WEDNESDAY, DECEMBER 7, 2016, 9:00 AM

OPERATING SYSTEMS ECSE 427/COMP SECTION 01 WEDNESDAY, DECEMBER 7, 2016, 9:00 AM December 2016 Final Examination OPERATING SYSTEMS ECSE 427/COMP 310 - SECTION 01 WEDNESDAY DECEMBER 7 2016 9:00 AM Examiner: Assoc Examiner: Student Name: Answers McGill ID: INSTRUCTIONS: This is a CLOSED

More information

COMP 3361: Operating Systems 1 Midterm Winter 2009

COMP 3361: Operating Systems 1 Midterm Winter 2009 COMP 3361: Operating Systems 1 Midterm Winter 2009 Name: Instructions This is an open book exam. The exam is worth 100 points, and each question indicates how many points it is worth. Read the exam from

More information

Midterm I October 18 th, 2010 CS162: Operating Systems and Systems Programming

Midterm I October 18 th, 2010 CS162: Operating Systems and Systems Programming Fall 2010 University of California, Berkeley College of Engineering Computer Science Division EECS John Kubiatowicz Midterm I October 18 th, 2010 CS162: Operating Systems and Systems Programming Your Name:

More information

Midterm Exam Solutions March 7, 2001 CS162 Operating Systems

Midterm Exam Solutions March 7, 2001 CS162 Operating Systems University of California, Berkeley College of Engineering Computer Science Division EECS Spring 2001 Anthony D. Joseph Midterm Exam March 7, 2001 CS162 Operating Systems Your Name: SID AND 162 Login: TA:

More information

CMPS 111 Spring 2013 Prof. Scott A. Brandt Midterm Examination May 6, Name: ID:

CMPS 111 Spring 2013 Prof. Scott A. Brandt Midterm Examination May 6, Name: ID: CMPS 111 Spring 2013 Prof. Scott A. Brandt Midterm Examination May 6, 2013 Name: ID: This is a closed note, closed book exam. There are 23 multiple choice questions, 6 short answer questions. Plan your

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2017 Lecture 9 Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 CPU Scheduling: Objectives CPU scheduling,

More information

SAMPLE MIDTERM QUESTIONS

SAMPLE MIDTERM QUESTIONS SAMPLE MIDTERM QUESTIONS CS 143A Notes: 1. These questions are just for you to have some questions to practice. 2. There is no guarantee that there will be any similarities between these questions and

More information

Scheduling. The Basics

Scheduling. The Basics The Basics refers to a set of policies and mechanisms to control the order of work to be performed by a computer system. Of all the resources in a computer system that are scheduled before use, the CPU

More information

Midterm Exam #2 Solutions October 25, 2016 CS162 Operating Systems

Midterm Exam #2 Solutions October 25, 2016 CS162 Operating Systems University of California, Berkeley College of Engineering Computer Science Division EECS all 2016 Anthony D. Joseph Midterm Exam #2 Solutions October 25, 2016 CS162 Operating Systems Your Name: SID AND

More information

CS162 Operating Systems and Systems Programming Midterm Review"

CS162 Operating Systems and Systems Programming Midterm Review CS162 Operating Systems and Systems Programming Midterm Review" March 5, 2012! http://inst.eecs.berkeley.edu/~cs162! Synchronization, Critical section" Midterm Review.2! Definitions" Synchronization: using

More information

CS Advanced Operating Systems Structures and Implementation Lecture 8. Synchronization Continued. Goals for Today. Synchronization Scheduling

CS Advanced Operating Systems Structures and Implementation Lecture 8. Synchronization Continued. Goals for Today. Synchronization Scheduling Goals for Today CS194-24 Advanced Operating Systems Structures and Implementation Lecture 8 Synchronization Continued Synchronization Scheduling Interactive is important! Ask Questions! February 25 th,

More information

Midterm Exam March 7, 2001 CS162 Operating Systems

Midterm Exam March 7, 2001 CS162 Operating Systems University of California, Berkeley College of Engineering Computer Science Division EECS Spring 2001 Anthony D. Joseph Midterm Exam March 7, 2001 CS162 Operating Systems Your Name: SID AND 162 Login: TA:

More information

MC7204 OPERATING SYSTEMS

MC7204 OPERATING SYSTEMS MC7204 OPERATING SYSTEMS QUESTION BANK UNIT I INTRODUCTION 9 Introduction Types of operating systems operating systems structures Systems components operating systems services System calls Systems programs

More information

Midterm I October 19 th, 2009 CS162: Operating Systems and Systems Programming

Midterm I October 19 th, 2009 CS162: Operating Systems and Systems Programming Fall 2009 University of California, Berkeley College of Engineering Computer Science Division EECS John Kubiatowicz Midterm I October 19 th, 2009 CS162: Operating Systems and Systems Programming Your Name:

More information

Fall 2015 COMP Operating Systems. Lab 06

Fall 2015 COMP Operating Systems. Lab 06 Fall 2015 COMP 3511 Operating Systems Lab 06 Outline Monitor Deadlocks Logical vs. Physical Address Space Segmentation Example of segmentation scheme Paging Example of paging scheme Paging-Segmentation

More information

CS 153 Design of Operating Systems Winter 2016

CS 153 Design of Operating Systems Winter 2016 CS 153 Design of Operating Systems Winter 2016 Lecture 12: Scheduling & Deadlock Priority Scheduling Priority Scheduling Choose next job based on priority» Airline checkin for first class passengers Can

More information

Operating Systems Comprehensive Exam. Spring Student ID # 3/20/2013

Operating Systems Comprehensive Exam. Spring Student ID # 3/20/2013 Operating Systems Comprehensive Exam Spring 2013 Student ID # 3/20/2013 You must complete all of Section I You must complete two of the problems in Section II If you need more space to answer a question,

More information

Operating Systems (Classroom Practice Booklet Solutions)

Operating Systems (Classroom Practice Booklet Solutions) Operating Systems (Classroom Practice Booklet Solutions) 1. Process Management I 1. Ans: (c) 2. Ans: (c) 3. Ans: (a) Sol: Software Interrupt is generated as a result of execution of a privileged instruction.

More information

General Objectives: To understand the process management in operating system. Specific Objectives: At the end of the unit you should be able to:

General Objectives: To understand the process management in operating system. Specific Objectives: At the end of the unit you should be able to: F2007/Unit5/1 UNIT 5 OBJECTIVES General Objectives: To understand the process management in operating system Specific Objectives: At the end of the unit you should be able to: define program, process and

More information

Lecture 7: CVs & Scheduling

Lecture 7: CVs & Scheduling Lecture 7: CVs & Scheduling CSE 120: Principles of Operating Systems Alex C. Snoeren HW 2 Due 10/17 Monitors A monitor is a programming language construct that controls access to shared data Synchronization

More information

CSE120 Principles of Operating Systems. Prof Yuanyuan (YY) Zhou Scheduling

CSE120 Principles of Operating Systems. Prof Yuanyuan (YY) Zhou Scheduling CSE120 Principles of Operating Systems Prof Yuanyuan (YY) Zhou Scheduling Announcement l Homework 2 due on October 26th l Project 1 due on October 27th 2 Scheduling Overview l In discussing process management

More information

Operating Systems Comprehensive Exam. Fall Student ID # 10/31/2013

Operating Systems Comprehensive Exam. Fall Student ID # 10/31/2013 Operating Systems Comprehensive Exam Fall 2013 Student ID # 10/31/2013 You must complete all of Section I You must complete two of the problems in Section II If you need more space to answer a question,

More information

Topic 4 Scheduling. The objective of multi-programming is to have some process running at all times, to maximize CPU utilization.

Topic 4 Scheduling. The objective of multi-programming is to have some process running at all times, to maximize CPU utilization. Topic 4 Scheduling The objective of multiprogramming is to have some process running at all times, to maximize CPU utilization. The objective of time sharing is to switch the CPU among processes so frequently.

More information

Deadlock. Concurrency: Deadlock and Starvation. Reusable Resources

Deadlock. Concurrency: Deadlock and Starvation. Reusable Resources Concurrency: Deadlock and Starvation Chapter 6 Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate with each other No efficient solution Involve conflicting

More information

CS162, Spring 2004 Discussion #6 Amir Kamil UC Berkeley 2/26/04

CS162, Spring 2004 Discussion #6 Amir Kamil UC Berkeley 2/26/04 CS162, Spring 2004 Discussion #6 Amir Kamil UC Berkeley 2/26/04 Topics: Deadlock, Scheduling 1 Announcements Office hours today 3:30-4:30 in 611 Soda (6th floor alcove) Project 1 code due Thursday, March

More information

PROCESSES & THREADS. Charles Abzug, Ph.D. Department of Computer Science James Madison University Harrisonburg, VA Charles Abzug

PROCESSES & THREADS. Charles Abzug, Ph.D. Department of Computer Science James Madison University Harrisonburg, VA Charles Abzug PROCESSES & THREADS Charles Abzug, Ph.D. Department of Computer Science James Madison University Harrisonburg, VA 22807 Voice Phone: 540-568-8746; Cell Phone: 443-956-9424 E-mail: abzugcx@jmu.edu OR CharlesAbzug@ACM.org

More information

CSE 120 Principles of Operating Systems Spring 2017

CSE 120 Principles of Operating Systems Spring 2017 CSE 120 Principles of Operating Systems Spring 2017 Lecture 5: Scheduling Administrivia Homework #1 due tomorrow Homework #2 out tomorrow October 20, 2015 CSE 120 Lecture 8 Scheduling and Deadlock 2 Scheduling

More information

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Science

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Science University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Science CS 162 Spring 2010 I. Stoica FIRST MIDTERM EXAMINATION Tuesday, March 9, 2010 INSTRUCTIONS

More information

Operating Systems Comprehensive Exam. Spring Student ID # 3/16/2006

Operating Systems Comprehensive Exam. Spring Student ID # 3/16/2006 Operating Systems Comprehensive Exam Spring 2006 Student ID # 3/16/2006 You must complete all of part I (60%) You must complete two of the three sections in part II (20% each) In Part I, circle or select

More information

1.1 CPU I/O Burst Cycle

1.1 CPU I/O Burst Cycle PROCESS SCHEDULING ALGORITHMS As discussed earlier, in multiprogramming systems, there are many processes in the memory simultaneously. In these systems there may be one or more processors (CPUs) but the

More information

1. Consider the following page reference string: 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6.

1. Consider the following page reference string: 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6. 1. Consider the following page reference string: 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6. What will be the ratio of page faults for the following replacement algorithms - FIFO replacement

More information

Page 1. Goals for Today" Atomic Read-Modify-Write instructions" Examples of Read-Modify-Write "

Page 1. Goals for Today Atomic Read-Modify-Write instructions Examples of Read-Modify-Write Goals for Today" CS162 Operating Systems and Systems Programming Lecture 5 Semaphores, Conditional Variables" Atomic instruction sequence Continue with Synchronization Abstractions Semaphores, Monitors

More information

Concurrency: Deadlock and Starvation

Concurrency: Deadlock and Starvation Concurrency: Deadlock and Starvation Chapter 6 E&CE 354: Processes 1 Deadlock Deadlock = situation in which every process from a set is permanently blocked, i.e. cannot proceed with execution Common cause:

More information

QUESTION BANK UNIT I

QUESTION BANK UNIT I QUESTION BANK Subject Name: Operating Systems UNIT I 1) Differentiate between tightly coupled systems and loosely coupled systems. 2) Define OS 3) What are the differences between Batch OS and Multiprogramming?

More information

Suggested Solutions (Midterm Exam October 27, 2005)

Suggested Solutions (Midterm Exam October 27, 2005) Suggested Solutions (Midterm Exam October 27, 2005) 1 Short Questions (4 points) Answer the following questions (True or False). Use exactly one sentence to describe why you choose your answer. Without

More information

Operating Systems (1DT020 & 1TT802) Lecture 6 Process synchronisation : Hardware support, Semaphores, Monitors, and Condition Variables

Operating Systems (1DT020 & 1TT802) Lecture 6 Process synchronisation : Hardware support, Semaphores, Monitors, and Condition Variables Operating Systems (1DT020 & 1TT802) Lecture 6 Process synchronisation : Hardware support, Semaphores, Monitors, and Condition Variables April 22, 2008 Léon Mugwaneza http://www.it.uu.se/edu/course/homepage/os/vt08

More information

Page 1. Goals for Today" Atomic Read-Modify-Write instructions" Examples of Read-Modify-Write "

Page 1. Goals for Today Atomic Read-Modify-Write instructions Examples of Read-Modify-Write Goals for Today" CS162 Operating Systems and Systems Programming Lecture 5 Semaphores, Conditional Variables" Atomic instruction sequence Continue with Synchronization Abstractions Semaphores, Monitors

More information

Operating Systems Structure

Operating Systems Structure Operating Systems Structure Monolithic systems basic structure: A main program that invokes the requested service procedure. A set of service procedures that carry out the system calls. A set of utility

More information

CMPS 111 Spring 2003 Midterm Exam May 8, Name: ID:

CMPS 111 Spring 2003 Midterm Exam May 8, Name: ID: CMPS 111 Spring 2003 Midterm Exam May 8, 2003 Name: ID: This is a closed note, closed book exam. There are 20 multiple choice questions and 5 short answer questions. Plan your time accordingly. Part I:

More information

Page 1. Goals for Today. Atomic Read-Modify-Write instructions. Examples of Read-Modify-Write

Page 1. Goals for Today. Atomic Read-Modify-Write instructions. Examples of Read-Modify-Write Goals for Today CS162 Operating Systems and Systems Programming Lecture 5 Atomic instruction sequence Continue with Synchronization Abstractions Semaphores, Monitors and condition variables Semaphores,

More information

Operating Systems. Process scheduling. Thomas Ropars.

Operating Systems. Process scheduling. Thomas Ropars. 1 Operating Systems Process scheduling Thomas Ropars thomas.ropars@univ-grenoble-alpes.fr 2018 References The content of these lectures is inspired by: The lecture notes of Renaud Lachaize. The lecture

More information

EECE.4810/EECE.5730: Operating Systems Spring Midterm Exam March 8, Name: Section: EECE.4810 (undergraduate) EECE.

EECE.4810/EECE.5730: Operating Systems Spring Midterm Exam March 8, Name: Section: EECE.4810 (undergraduate) EECE. EECE.4810/EECE.5730: Operating Systems Spring 2017 Midterm Exam March 8, 2017 Name: Section: EECE.4810 (undergraduate) EECE.5730 (graduate) For this exam, you may use two 8.5 x 11 double-sided page of

More information

CS 326: Operating Systems. CPU Scheduling. Lecture 6

CS 326: Operating Systems. CPU Scheduling. Lecture 6 CS 326: Operating Systems CPU Scheduling Lecture 6 Today s Schedule Agenda? Context Switches and Interrupts Basic Scheduling Algorithms Scheduling with I/O Symmetric multiprocessing 2/7/18 CS 326: Operating

More information

QUESTION BANK. UNIT II: PROCESS SCHEDULING AND SYNCHRONIZATION PART A (2 Marks)

QUESTION BANK. UNIT II: PROCESS SCHEDULING AND SYNCHRONIZATION PART A (2 Marks) QUESTION BANK DEPARTMENT: EEE SEMESTER VII SUBJECT CODE: CS2411 SUBJECT NAME: OS UNIT II: PROCESS SCHEDULING AND SYNCHRONIZATION PART A (2 Marks) 1. What is deadlock? (AUC NOV2010) A deadlock is a situation

More information

COS 318: Midterm Exam (October 23, 2012) (80 Minutes)

COS 318: Midterm Exam (October 23, 2012) (80 Minutes) COS 318: Midterm Exam (October 23, 2012) (80 Minutes) Name: This exam is closed-book, closed-notes. 1 single-sided 8.5x11 sheet of notes is permitted. No calculators, laptop, palmtop computers are allowed

More information

Last Class: Processes

Last Class: Processes Last Class: Processes A process is the unit of execution. Processes are represented as Process Control Blocks in the OS PCBs contain process state, scheduling and memory management information, etc A process

More information

3. CPU Scheduling. Operating System Concepts with Java 8th Edition Silberschatz, Galvin and Gagn

3. CPU Scheduling. Operating System Concepts with Java 8th Edition Silberschatz, Galvin and Gagn 3. CPU Scheduling Operating System Concepts with Java 8th Edition Silberschatz, Galvin and Gagn S P O I L E R operating system CPU Scheduling 3 operating system CPU Scheduling 4 Long-short-medium Scheduler

More information

CPU Scheduling. Schedulers. CPSC 313: Intro to Computer Systems. Intro to Scheduling. Schedulers in the OS

CPU Scheduling. Schedulers. CPSC 313: Intro to Computer Systems. Intro to Scheduling. Schedulers in the OS Schedulers in the OS Scheduling Structure of a Scheduler Scheduling = Selection + Dispatching Criteria for scheduling Scheduling Algorithms FIFO/FCFS SPF / SRTF Priority - Based Schedulers start long-term

More information

AC59/AT59/AC110/AT110 OPERATING SYSTEMS & SYSTEMS SOFTWARE DEC 2015

AC59/AT59/AC110/AT110 OPERATING SYSTEMS & SYSTEMS SOFTWARE DEC 2015 Q.2 a. Explain the following systems: (9) i. Batch processing systems ii. Time sharing systems iii. Real-time operating systems b. Draw the process state diagram. (3) c. What resources are used when a

More information