Do not start the test until instructed to do so!

Size: px
Start display at page:

Download "Do not start the test until instructed to do so!"

Transcription

1 CS 3204 Operating Systems Midterm (Abrams) Spring 2004 VIRG INIA POLYTECHNIC INSTITUTE AND STATE U T PRO SI M UNI VERSI TY Instructions: Do not start the test until instructed to do so! Print your name in the space provided below. This examination is closed book and closed notes. No calculators or other computing devices may be used. Answer each question in the space provided. If you need to continue an answer onto the back of a page, clearly indicate that and label the continuation with the question number. If you want partial credit, justify your answers, even when justification is not explicitly required. When you have completed the test, sign the pledge below and turn in the test. Note that either failing to return this test, or discussing its content with a student who has not taken it is a violation of the Honor Code. Print Your Name: Pledge: On my honor, I have neither given nor received unauthorized aid on this examination. Sign your name: Problem Long1 Long2 Long3 Long4 Short1 Short2 Short3 Short4 Short5 Short6 Total Grade /10 /20 /25 /24 /3 /5 /2 /1 /5 /5 /100 1 of 1

2 CS 3204 Operating Systems Midterm (Abrams) Spring 2004 Long Answer L1. [10 points] Consider the simple run/ready/block state transition scheme for process scheduling. Draw the state diagram, showing all the possible transitions. Label each transition with a brief, precise description of an event that might cause a process to make that transition. 2 of 2

3 CS 3204 Operating Systems Midterm (Abrams) Spring 2004 L2. [20 points] Consider executing the two threads below, with the shared global variables that are shown. //Shared variables 1 boolean t1 = ; 2 boolean t2 = ; //Thread T1 T1.4 void main() { T1.5 while ( true ) { T1.6 t1 = ; T1.7 while ( t2 ); T1.8 //critical section code T1.9 t1 = ; T1.10 //code outside critical section T1.11 } //end while loop T1.12 } //end thread T1 // Thread T2 T2.4 void main() { T2.5 while ( true ) { T2.6 t2 = ; T2.7 while ( t1 ); T2.8 //critical section code T2.9 t2 = ; T2.10 //code outside critical section T2.11 } //end while loop T2.12 } //end thread T2 (a) [10 points] Fill in the blanks in the code above (with TRUE or FALSE) to guarantee that mutual exclusion will be achieved. (b) [10 points] Does program with your modifications in (a) guarantee that the program is free from deadlock? YES NO If you answer YES, justify your answer. If you answer NO, clearly describe an execution sequence (using line numbers) that would lead to a deadlock of the two threads. 3 of 3

4 CS 3204 Operating Systems Midterm (Abrams) Spring 2004 L3. [25 points] Consider executing the two threads below, with the shared global variables that are shown. //Shared variables 1 Semaphore valueproduced = new Semaphore(1); 2 Semaphore valueconsumed = new Semaphore(1); 3 int sharedvalue=2; // variable shared by Producer and Consumer //Producer thread 4 void main() { 5 int v=0; 6 while ( true ) { 7 v++; 8 P(valueConsumed); 9 sharedvalue=v; 10 V(valueProduced); 11 } // end while 12 } // end producer thread //Consumer thread 13 void main() { 14 int v; 15 while ( true ) { 16 P(valueProduced); 17 v = sharedvalue; 18 V(valueConsumed); 19 printf( %d, v); 21 } // end consumer thread (a) [5 points] List all line numbers at which a thread can potentially block. (b) [10 points] If the code as shown above is executed, would either thread block forever? YES NO If your answer is YES clearly describe an execution sequence (using line numb ers) that would lead to a thread blocking forever. If your answer is NO, justify your answer by giving a logical argument why neither thread could block forever. 4 of 4

5 (c) [10 points] The specification for the program above says that all executions of this program must write to standard output the sequence of integers 1,2,3,4,5,. Does the program meet the specification? YES NO If your answer is YES, justify your answer by giving a logical argument as to why this is the only possible output for any execution order. If your answer is NO, clearly describe an execution sequence (using line numbers) that generates a different output, and state what the program would write to standard output. 5

6 L4. [24 points, 4 points per box] After graduation from Virginia Tech, you work at a software company that is writing a new operating system. The designers are trying to decide whether to use user-level threads, kernel-level threads, or a hybrid threading model. Because you are fresh out of CS3204, you are in a great position to advise them. In the boxes below, make a list of the pros and cons of each option. User level pros: User level cons: Kernel level pros: Kernel level cons: Hybrid pros: Hybrid cons: Short Answer S1. [3 points] If three threads want to achieve mutual exclusion, which of the following algorithms could be used? a. Peterson s YES NO b. Lamport s bakery YES NO c. Dekker s YES NO S2. [5 points] Why would an operating system that uses a microkernel run faster on a multiprocessor computer than on using a monolithic design? 6

7 S3. [2 points] What is the difference between a system call and a normal call of a function or method in an API? S4. [1 point] Give one reason why a DVD allows storage of more data than a CD. S5. [5 points] Which of the following is a true statement: a. RISC and CISC typically use the same number of registers b. CISC microprocessors generally contain more registers c. RISC microprocessors generally uses more registers Justify your answer: S6. [5 points] Why is a kernel call often implemented by a software interrupt? Have a good break! 7

8 8

9 Solution: L1: See Figure 3.1 L2: This is the algorithm in Figure 5.8 in the book. (a) Blanks are filled in as follows: boolean t1=false; boolean t2=false; t1=true t1=false t2=true t2=false (b) NO (In the following, a correct answer can omit the items in [] or <>.) There are several correct sequences. But ANY correct answer must have T1.6 AND T2.6 executed BEFORE either of T1.7 and T2.7, and NO statements executed after T1.7 and T2.7. Here are two correct answers: [T1.4,] T1.5, T1.6, [<context switch>,] [T2.4,] T2.5, T2.6, T2.7, <T2 stays in T2.7 forever>, T1.7 <T1 stays in T2.7 forever DEADLOCK> or [T2.4,] T2.5, T2.6, T2.7, [<context switch>,] [T1.4,] T1.5, T1.6, T1.7, <DEADLOCK> L3: Comment: A key difference of the code in problem L3 from Figure 5.16 in the book is listed in item 2 in Self Review on page 231 valueproduced is initialized to 1 and not zero. (a) 8 and 16. That is because only the P() operation blocks. The V() operation and all other statements used in the program never block.. NOTE: It is optional to list statement 19. The process blocks to execute 19, unless the compiler/os do programmed I/O (which an old computer and OS or an embedded OS would do). (b) NO This is the hardest problem in the exam. To be rigorous, the answer requires a proof (or a proof outline, similar to the arguments given in Chapter 5 for why the shared memory mutual exclusion algorithms do not block a thread forever). However, full credit will be given to an answer that has the seed of the ideas needed in a proof at least the fact that the value of the semaphore named in each P operation is always larger than 1 when the P is executed (either because the thread is in its first loop iteration, or, by inductive reasoning, the thread did not block at P in the last loop iteration, and the thread only got past the P in the last iteration if the semaphore value was incremented to a value larger than 0 (by the other thread)). For the record, here is a proof outline Proof by contradiction. Assume that one thread does block forever. Let s look at the 3 possible blocking statements from part (a). [It is OPTIONAL to discuss statement 19] Statement 19 cannot block forever, because I/O to standard out will eventually complete. Stdout is either the console so nothing would block display of letters on the console or a file 9

10 (if stdio is redirected to a file), but even if the file system becomes full an error message would be generated and printf() would return in error. Hence statement 19 cannot block forever. Exactly one of statement 8 or 16 (or both) are blocked forever. It is impossible for exactly one of the two statements to block forever, because the other thread would eventually execute a V() operation on the semaphore whose P operation is causing blocking forever. That V operation would unblock the blocked thread. Both statement 8 AND 16 are forever blocked. This can only happen if both semaphores are 0. However, it is impossible for this case to arise. The proof is by induction. o On first iteration or each thread s loop, the semaphore is 1, so the P decrements the semaphore to 0 and does not block. Furthermore, the thread does a V on the other semaphore, so that other semaphore now has value 1 or 2. o Now assume that a thread has not blocked on its first i-1 iterations (for i>0). On the ith iteration of a thread s loop, the semaphore has value of greater than 0 (or else the iteration i-1 would have blocked; since i-1 did not block we know that the thread completed execution of the P operation, which would only have happened if the semaphore value was incremented by a V operation. Therefore, there is no statement at which either thread could block forever. (c) NO. 1,2,13,14,15,16,17,18,19 would generate 2 as the first output number. 10

11 L4: User level pros: Doesn t require kernel changes Facilitates portability User level cons: All threads in a process are context switched as one unit by OS. Thus if one thread did I/O, all threads would block. A process containing many threads cannot use more than one processor of a a multiprocessor. Threads get shorter timeslices because all threads share timeslice of one process. Kernel level pros: Allows every thread to be scheduled separately by OS, yielding maximum potential for parallelism, and allowing one thread to block while others continue. Can utilize multiple processors. Harder to handle signals and terminating threads. Kernel level cons: Harder to implement than user-level threading. Also, hard to make programs portable. Can create more overhead in OS needs to be one scheduler activation for every thread, which means schedule is controlling more activations (and hence larger kernel data structures), which could reduce OS performance. Hybrid pros: Allows pros of kernel-level. Allows multiple user threads to be mapped to one kernel scheduler activation ( m-to-n thread mapping ) negating last con listed for kernel level. Hybrid cons: Can be harder to create a portable program that works on any thread model. Programmer must be careful about choosing which threads to map to a single kernel activation record. If the programmer makes a bad choice, they get the disadvantages of user or kernel level threads. (For example, if the programmer maps two threads that both do I/O to the same kernel scheduler activation, the if one thread blocks for I/O the other thread must wait also.) 11

12 S1: a. NO (only does 2-way) b. YES (does N-way) c. NO (only does 2-way) S2: All calls to the OS kernel are serialized. Hence the kernel can run on only one processor in a multiprocessor. Therefore, to allow maximum concurrency, the kernel should do as little work as possible to minimize its execution time. A microkernel moves as much OS functionality as possible outside the kernel, thereby minimizing the kernel s execution time. All the functionality that a microkernel OS puts outside the kernel can potentially be run concurrently on multiple processors, thereby improving OS performance. S3: System call invokes operation inside the OS and ultimately the kernel, whereas normal API call invokes user space code. S4: A correct answer is either of the following: DVDs use 2 layer. DVDs use thinner tracks. S5: Correct answer is c, for either of these reasons: With a simpler instruction set, RISC does not typically have ALU instructions that access memory [just load and store instructions to access memory]. Hence RISC requires more quantities to be in registers than CISC. RISC processors have multiple copies of processor registers to permit fast context switching among a limited number of processes without requiring registers to be copied to a process control block in main memory. S6: Either of these answers is correct: An interrupt is a safe way to enter the kernel when a software interrupt occurs, the PC is changed by the processor to an address in the interrupt vector table (set by the kernel during boot time), so that the next instruction executed is inside the kernel. The processor must switch from user to privileged mode when the program counter changes to an instruction inside the kernel code. For security, a means is needed for this to happen only when a kernel call occurs a user must not be able to switch to privileged mode without entering the kernel. A software interrupt permits the mode change in a safe way. (In the above answers, safe means that a nasty user cannot enter the kernel or change to privileged mode without raising a software interrupt.) 12

Solution printed. Do not start the test until instructed to do so! CS 2504 Intro Computer Organization Test 2 Spring 2006.

Solution printed. Do not start the test until instructed to do so! CS 2504 Intro Computer Organization Test 2 Spring 2006. VIRG INIA POLYTECHNIC INSTITUTE AND STATE U T PROSI M UNI VERSI TY Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted

More information

Solution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Spring Instructions:

Solution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Spring Instructions: VIRG INIA POLYTECHNIC INSTITUTE AND STATE U T PROSI M UNI VERSI TY Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted

More information

Solution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Summer I Instructions:

Solution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Summer I Instructions: VIRG INIA POLYTECHNIC INSTITUTE AND STATE U T PROSI M UNI VERSI TY Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted

More information

CS4411 Intro. to Operating Systems Exam 1 Fall points 10 pages

CS4411 Intro. to Operating Systems Exam 1 Fall points 10 pages CS4411 Intro. to Operating Systems Exam 1 Fall 2005 (October 6, 2005) 1 CS4411 Intro. to Operating Systems Exam 1 Fall 2005 150 points 10 pages Name: Most of the following questions only require very short

More information

Chapter 5 Asynchronous Concurrent Execution

Chapter 5 Asynchronous Concurrent Execution Chapter 5 Asynchronous Concurrent Execution Outline 5.1 Introduction 5.2 Mutual Exclusion 5.2.1 Java Multithreading Case Study 5.2.2 Critical Sections 5.2.3 Mutual Exclusion Primitives 5.3 Implementing

More information

CS 2604 Data Structures Midterm Summer 2000 U T. Do not start the test until instructed to do so!

CS 2604 Data Structures Midterm Summer 2000 U T. Do not start the test until instructed to do so! VIRG INIA POLYTECHNIC INSTITUTE AND STATE U T PROSI M UNI VERSI TY Instructions: Print your name in the space provided below. This examination is closed book and closed notes. No calculators or other computing

More information

CS140 Operating Systems and Systems Programming Midterm Exam

CS140 Operating Systems and Systems Programming Midterm Exam CS140 Operating Systems and Systems Programming Midterm Exam October 28 th, 2005 (Total time = 50 minutes, Total Points = 50) Name: (please print) In recognition of and in the spirit of the Stanford University

More information

Midterm on next week Tuesday May 4. CS 361 Concurrent programming Drexel University Fall 2004 Lecture 9

Midterm on next week Tuesday May 4. CS 361 Concurrent programming Drexel University Fall 2004 Lecture 9 CS 361 Concurrent programming Drexel University Fall 2004 Lecture 9 Bruce Char and Vera Zaychik. All rights reserved by the author. Permission is given to students enrolled in CS361 Fall 2004 to reproduce

More information

CS 361 Concurrent programming Drexel University Fall 2004 Lecture 8. Proof by contradiction. Proof of correctness. Proof of mutual exclusion property

CS 361 Concurrent programming Drexel University Fall 2004 Lecture 8. Proof by contradiction. Proof of correctness. Proof of mutual exclusion property CS 361 Concurrent programming Drexel University Fall 2004 Lecture 8 Bruce Char and Vera Zaychik. All rights reserved by the author. Permission is given to students enrolled in CS361 Fall 2004 to reproduce

More information

CS140 Operating Systems and Systems Programming Midterm Exam

CS140 Operating Systems and Systems Programming Midterm Exam CS140 Operating Systems and Systems Programming Midterm Exam October 31 st, 2003 (Total time = 50 minutes, Total Points = 50) Name: (please print) In recognition of and in the spirit of the Stanford University

More information

CROWDMARK. Examination Midterm. Spring 2017 CS 350. Closed Book. Page 1 of 30. University of Waterloo CS350 Midterm Examination.

CROWDMARK. Examination Midterm. Spring 2017 CS 350. Closed Book. Page 1 of 30. University of Waterloo CS350 Midterm Examination. Times: Thursday 2017-06-22 at 19:00 to 20:50 (7 to 8:50PM) Duration: 1 hour 50 minutes (110 minutes) Exam ID: 3520593 Please print in pen: Waterloo Student ID Number: WatIAM/Quest Login Userid: Sections:

More information

CS140 Operating Systems and Systems Programming Midterm Exam

CS140 Operating Systems and Systems Programming Midterm Exam CS140 Operating Systems and Systems Programming Midterm Exam October 28 th, 2002 (Total time = 50 minutes, Total Points = 50) Name: (please print) In recognition of and in the spirit of the Stanford University

More information

THE AUSTRALIAN NATIONAL UNIVERSITY Mid-semester Quiz, Second Semester COMP2310 (Concurrent and Distributed Systems)

THE AUSTRALIAN NATIONAL UNIVERSITY Mid-semester Quiz, Second Semester COMP2310 (Concurrent and Distributed Systems) THE AUSTRALIAN NATIONAL UNIVERSITY Mid-semester Quiz, Second Semester 2001 COMP2310 (Concurrent and Distributed Systems) Writing Period: 65 minutes duration Study Period: 0 minutes duration Permitted Materials:

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

CS 2505 Computer Organization I

CS 2505 Computer Organization I Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted one-page formula sheet. No calculators or other computing devices may

More information

CIS Operating Systems Synchronization based on Busy Waiting. Professor Qiang Zeng Spring 2018

CIS Operating Systems Synchronization based on Busy Waiting. Professor Qiang Zeng Spring 2018 CIS 3207 - Operating Systems Synchronization based on Busy Waiting Professor Qiang Zeng Spring 2018 Previous class IPC for passing data Pipe FIFO Message Queue Shared Memory Compare these IPCs for data

More information

Operating Systems. Lecture 4 - Concurrency and Synchronization. Master of Computer Science PUF - Hồ Chí Minh 2016/2017

Operating Systems. Lecture 4 - Concurrency and Synchronization. Master of Computer Science PUF - Hồ Chí Minh 2016/2017 Operating Systems Lecture 4 - Concurrency and Synchronization Adrien Krähenbühl Master of Computer Science PUF - Hồ Chí Minh 2016/2017 Mutual exclusion Hardware solutions Semaphores IPC: Message passing

More information

Chapter 5: Process Synchronization. Operating System Concepts 9 th Edition

Chapter 5: Process Synchronization. Operating System Concepts 9 th Edition Chapter 5: Process Synchronization Silberschatz, Galvin and Gagne 2013 Chapter 5: Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Mutex Locks

More information

Synchronization for Concurrent Tasks

Synchronization for Concurrent Tasks Synchronization for Concurrent Tasks Minsoo Ryu Department of Computer Science and Engineering 2 1 Race Condition and Critical Section Page X 2 Algorithmic Approaches Page X 3 Hardware Support Page X 4

More information

Pre- and post- CS protocols. CS 361 Concurrent programming Drexel University Fall 2004 Lecture 7. Other requirements for a mutual exclusion algorithm

Pre- and post- CS protocols. CS 361 Concurrent programming Drexel University Fall 2004 Lecture 7. Other requirements for a mutual exclusion algorithm CS 361 Concurrent programming Drexel University Fall 2004 Lecture 7 Bruce Char and Vera Zaychik. All rights reserved by the author. Permission is given to students enrolled in CS361 Fall 2004 to reproduce

More information

Synchronization. Before We Begin. Synchronization. Credit/Debit Problem: Race Condition. CSE 120: Principles of Operating Systems.

Synchronization. Before We Begin. Synchronization. Credit/Debit Problem: Race Condition. CSE 120: Principles of Operating Systems. CSE 120: Principles of Operating Systems Lecture 4 Synchronization January 23, 2006 Prof. Joe Pasquale Department of Computer Science and Engineering University of California, San Diego Before We Begin

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

CS153: Midterm (Winter 19)

CS153: Midterm (Winter 19) CS153: Midterm (Winter 19) Name: Student ID: Answer all questions. State any assumptions clearly. Problem 1: (24 points; 5 minutes) Indicate whether each of the following statements is true or false: (T)

More information

KEY CENG 334. Midterm. Question 1. Question 2. Question 3. Question 4. Question 5. Question 6. Total. Name, SURNAME and ID

KEY CENG 334. Midterm. Question 1. Question 2. Question 3. Question 4. Question 5. Question 6. Total. Name, SURNAME and ID 00 11 00 11 01 01 01 01 01 01 00 11 00 11 Name, SURNAME and ID Middle East Technical University Department of Computer Engineering KEY CENG 334 Section 2 and 3 Spring 2010-2011 Midterm Duration: 120 minutes.

More information

University of Illinois at Chicago Department of Computer Science. Final Examination. CS 151 Mathematical Foundations of Computer Science Fall 2012

University of Illinois at Chicago Department of Computer Science. Final Examination. CS 151 Mathematical Foundations of Computer Science Fall 2012 University of Illinois at Chicago Department of Computer Science Final Examination CS 151 Mathematical Foundations of Computer Science Fall 2012 Thursday, October 18, 2012 Name: Email: Print your name

More information

CS140 Operating Systems and Systems Programming

CS140 Operating Systems and Systems Programming CS140 Operating Systems and Systems Programming Midterm Exam July 25th, 2006 Total time = 60 minutes, Total Points = 100 Name: (please print) In recognition of and in the spirit of the Stanford University

More information

Fall 2004 CS414 Prelim 1

Fall 2004 CS414 Prelim 1 Fall 2004 CS414 Prelim 1 1. The Sim City Smoking Ban problem: In the Sim-City community Woobish most people smoke, but the laws of Sim City require that non-smokers be protected from passive smoke. So

More information

ECE 612: Embedded and Real-Time Systems

ECE 612: Embedded and Real-Time Systems ECE 612: Embedded and Real-Time Systems Instructor: A. Cyrus Sabzevari Last updated: 1/16/2013 Email: asabzeva@gmu.edu Spring 2013 Monday 7:20-10 PM Office Hours: Monday 6:10 7:10 in the adjunct faculty

More information

(b) External fragmentation can happen in a virtual memory paging system.

(b) External fragmentation can happen in a virtual memory paging system. Alexandria University Faculty of Engineering Electrical Engineering - Communications Spring 2015 Final Exam CS333: Operating Systems Wednesday, June 17, 2015 Allowed Time: 3 Hours Maximum: 75 points Note:

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

University of Waterloo Midterm Examination Model Solution CS350 Operating Systems

University of Waterloo Midterm Examination Model Solution CS350 Operating Systems University of Waterloo Midterm Examination Model Solution CS350 Operating Systems Fall, 2003 1. (10 total marks) Suppose that two processes, a and b, are running in a uniprocessor system. a has three threads.

More information

COS 126 General Computer Science Spring Written Exam 1

COS 126 General Computer Science Spring Written Exam 1 COS 126 General Computer Science Spring 2017 Written Exam 1 This exam has 9 questions (including question 0) worth a total of 70 points. You have 50 minutes. Write all answers inside the designated spaces.

More information

CS 2505 Computer Organization I Test 1. Do not start the test until instructed to do so! printed

CS 2505 Computer Organization I Test 1. Do not start the test until instructed to do so! printed Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted one-page formula sheet. This examination is closed book and closed

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 7: Synchronization Administrivia Homework 1 Due today by the end of day Hopefully you have started on project 1 by now? Kernel-level threads (preemptable

More information

CSE 451 Midterm 1. Name:

CSE 451 Midterm 1. Name: CSE 451 Midterm 1 Name: 1. [2 points] Imagine that a new CPU were built that contained multiple, complete sets of registers each set contains a PC plus all the other registers available to user programs.

More information

Synchronization. Before We Begin. Synchronization. Example of a Race Condition. CSE 120: Principles of Operating Systems. Lecture 4.

Synchronization. Before We Begin. Synchronization. Example of a Race Condition. CSE 120: Principles of Operating Systems. Lecture 4. CSE 120: Principles of Operating Systems Lecture 4 Synchronization October 7, 2003 Before We Begin Read Chapter 7 (Process Synchronization) Programming Assignment #1 Due Sunday, October 19, midnight Prof.

More information

CS 3114 Data Structures and Algorithms Test 1 READ THIS NOW!

CS 3114 Data Structures and Algorithms Test 1 READ THIS NOW! READ THIS NOW! Print your name in the space provided below. There are 7 short-answer questions, priced as marked. The maximum score is 100. This examination is closed book and closed notes, aside from

More information

CS4411 Intro. to Operating Systems Exam 2 Fall 2009

CS4411 Intro. to Operating Systems Exam 2 Fall 2009 CS4411 Intro. to Operating Systems Exam 2 { Fall 2009 1 CS4411 Intro. to Operating Systems Exam 2 Fall 2009 150 points { 8 pages Name: Most of the following questions only require short answers. Usually

More information

Locks. Dongkun Shin, SKKU

Locks. Dongkun Shin, SKKU Locks 1 Locks: The Basic Idea To implement a critical section A lock variable must be declared A lock variable holds the state of the lock Available (unlocked, free) Acquired (locked, held) Exactly one

More information

Operating Systems EDA092, DIT 400 Exam

Operating Systems EDA092, DIT 400 Exam Chalmers University of Technology and Gothenburg University Operating Systems EDA092, DIT 400 Exam 2015-04-14 Date, Time, Place: Tuesday 2015/04/14, 14:00 18:00, Väg och vatten -salar Course Responsible:

More information

CS 2504 Intro Computer Organization Test 1

CS 2504 Intro Computer Organization Test 1 Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted one-page formula sheet and the MIPS reference card. No calculators

More information

CSE 120: Principles of Operating Systems. Lecture 4. Synchronization. October 7, Prof. Joe Pasquale

CSE 120: Principles of Operating Systems. Lecture 4. Synchronization. October 7, Prof. Joe Pasquale CSE 120: Principles of Operating Systems Lecture 4 Synchronization October 7, 2003 Prof. Joe Pasquale Department of Computer Science and Engineering University of California, San Diego 2003 by Joseph Pasquale

More information

CS 2506 Computer Organization II Test 2

CS 2506 Computer Organization II Test 2 Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted one-page formula sheet. No calculators or other computing devices may

More information

Operating System Architecture. CS3026 Operating Systems Lecture 03

Operating System Architecture. CS3026 Operating Systems Lecture 03 Operating System Architecture CS3026 Operating Systems Lecture 03 The Role of an Operating System Service provider Provide a set of services to system users Resource allocator Exploit the hardware resources

More information

Eastern Mediterranean University School of Computing and Technology Department of Information Technology. ITEC202 Operating Systems

Eastern Mediterranean University School of Computing and Technology Department of Information Technology. ITEC202 Operating Systems Page 1 of 8 ITEC202 Operating Systems, Midterm Exam Eastern Mediterranean University School of Computing and Technology Department of Information Technology ITEC202 Operating Systems ITEC 202 Midterm Examination

More information

CPSC/ECE 3220 Fall 2017 Exam Give the definition (note: not the roles) for an operating system as stated in the textbook. (2 pts.

CPSC/ECE 3220 Fall 2017 Exam Give the definition (note: not the roles) for an operating system as stated in the textbook. (2 pts. CPSC/ECE 3220 Fall 2017 Exam 1 Name: 1. Give the definition (note: not the roles) for an operating system as stated in the textbook. (2 pts.) Referee / Illusionist / Glue. Circle only one of R, I, or G.

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

Semaphores. May 10, Mutual exclusion with shared variables is difficult (e.g. Dekker s solution).

Semaphores. May 10, Mutual exclusion with shared variables is difficult (e.g. Dekker s solution). Semaphores May 10, 2000 1 Introduction Mutual exclusion with shared variables is difficult (e.g. Dekker s solution). Generalising to an arbitrary number of processes is also nontrivial (e.g. Lamport s

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

CSE 131 Introduction to Computer Science Fall Exam I

CSE 131 Introduction to Computer Science Fall Exam I CSE 131 Introduction to Computer Science Fall 2015 Given: 24 September 2015 Exam I Due: End of session This exam is closed-book, closed-notes, no electronic devices allowed. The exception is the sage page

More information

Process Management And Synchronization

Process Management And Synchronization Process Management And Synchronization In a single processor multiprogramming system the processor switches between the various jobs until to finish the execution of all jobs. These jobs will share the

More information

Concurrent & Distributed Systems Supervision Exercises

Concurrent & Distributed Systems Supervision Exercises Concurrent & Distributed Systems Supervision Exercises Stephen Kell Stephen.Kell@cl.cam.ac.uk November 9, 2009 These exercises are intended to cover all the main points of understanding in the lecture

More information

CS 2505 Computer Organization I Test 1. Do not start the test until instructed to do so! printed

CS 2505 Computer Organization I Test 1. Do not start the test until instructed to do so! printed Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted one-page formula sheet. This examination is closed book and closed

More information

CHAPTER 6: PROCESS SYNCHRONIZATION

CHAPTER 6: PROCESS SYNCHRONIZATION CHAPTER 6: PROCESS SYNCHRONIZATION The slides do not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams. TOPICS Background

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

Subject: Operating System (BTCOC403) Class: S.Y.B.Tech. (Computer Engineering)

Subject: Operating System (BTCOC403) Class: S.Y.B.Tech. (Computer Engineering) A. Multiple Choice Questions (60 questions) Subject: Operating System (BTCOC403) Class: S.Y.B.Tech. (Computer Engineering) Unit-I 1. What is operating system? a) collection of programs that manages hardware

More information

Sistemi in tempo reale Anno accademico

Sistemi in tempo reale Anno accademico Sistemi in tempo reale Anno accademico 2006-2007 Concorrenza - II Giuseppe Lipari http://feanor.sssup.it/~lipari Scuola Superiore Sant Anna Outline 1 Introduction to concurrency 2 Models of concurrency:

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

CSC369 Lecture 2. Larry Zhang

CSC369 Lecture 2. Larry Zhang CSC369 Lecture 2 Larry Zhang 1 Announcements Lecture slides Midterm timing issue Assignment 1 will be out soon! Start early, and ask questions. We will have bonus for groups that finish early. 2 Assignment

More information

CS4411 Intro. to Operating Systems Exam 1 Fall points 9 pages

CS4411 Intro. to Operating Systems Exam 1 Fall points 9 pages CS4411 Intro. to Operating Systems Exam 1 Fall 2009 1 CS4411 Intro. to Operating Systems Exam 1 Fall 2009 150 points 9 pages Name: Most of the following questions only require very short answers. Usually

More information

CSE 131 Introduction to Computer Science Fall 2016 Exam I. Print clearly the following information:

CSE 131 Introduction to Computer Science Fall 2016 Exam I. Print clearly the following information: CSE 131 Introduction to Computer Science Fall 2016 Given: 29 September 2016 Exam I Due: End of Exam Session This exam is closed-book, closed-notes, no electronic devices allowed The exception is the "sage

More information

Mutual Exclusion. 1 Formal problem definitions. Time notion CSE /17/2015. Outline of this lecture:

Mutual Exclusion. 1 Formal problem definitions. Time notion CSE /17/2015. Outline of this lecture: CSE 539 03/17/2015 Mutual Exclusion Lecture 15 Scribe: Son Dinh Outline of this lecture: 1. Formal problem definitions 2. Solution for 2 threads 3. Solution for n threads 4. Inherent costs of mutual exclusion

More information

Lecture Topics. Announcements. Today: Concurrency: Mutual Exclusion (Stallings, chapter , 5.7)

Lecture Topics. Announcements. Today: Concurrency: Mutual Exclusion (Stallings, chapter , 5.7) Lecture Topics Today: Concurrency: Mutual Exclusion (Stallings, chapter 5.1-5.4, 5.7) Next: Concurrency: Deadlock and Starvation (Stallings, chapter 6.1, 6.6-6.8) 1 Announcements Self-Study Exercise #5

More information

CSE 247 Data Structures and Algorithms Fall Exam I

CSE 247 Data Structures and Algorithms Fall Exam I CSE 247 Data Structures and Algorithms Fall 2016 Given: 29 February 2016 Exam I Due: End of session This exam is closed-book, closed-notes. No electronic devices or resources of any kind are allowed. The

More information

Do not start the test until instructed to do so!

Do not start the test until instructed to do so! Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted one-page formula sheet and the MIPS reference card. No calculators

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

CS143 Final Fall 2009

CS143 Final Fall 2009 CS143 Final Fall 2009 Please read all instructions (including these) carefully. There are 4 questions on the exam, all with multiple parts. You have 2 hours to work on the exam. The exam is closed book,

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

Chapter 6: Process [& Thread] Synchronization. CSCI [4 6] 730 Operating Systems. Why does cooperation require synchronization?

Chapter 6: Process [& Thread] Synchronization. CSCI [4 6] 730 Operating Systems. Why does cooperation require synchronization? Chapter 6: Process [& Thread] Synchronization CSCI [4 6] 730 Operating Systems Synchronization Part 1 : The Basics Why is synchronization needed? Synchronization Language/Definitions:» What are race conditions?»

More information

CS420: Operating Systems. Process Synchronization

CS420: Operating Systems. Process Synchronization Process Synchronization James Moscola Department of Engineering & Computer Science York College of Pennsylvania Based on Operating System Concepts, 9th Edition by Silberschatz, Galvin, Gagne Background

More information

Q1. State True/false with jusification if the answer is false:

Q1. State True/false with jusification if the answer is false: Paper Title: Operating System (IOPS332C) Quiz 1 Time : 1 hr Q1. State True/false with jusification if the answer is false: a. Multiprogramming (having more programs in RAM simultaneously) decreases total

More information

Spring 2017 CS 1110/1111 Exam 1

Spring 2017 CS 1110/1111 Exam 1 CS 1110/1111 Spring 2017 Exam 1 page 1 of 6 Spring 2017 CS 1110/1111 Exam 1 Bubble in your computing ID in the footer of this page. We use an optical scanner to read it, so fill in the bubbles darkly.

More information

Chapters 5 and 6 Concurrency

Chapters 5 and 6 Concurrency Operating Systems: Internals and Design Principles, 6/E William Stallings Chapters 5 and 6 Concurrency Patricia Roy Manatee Community College, Venice, FL 2008, Prentice Hall Concurrency When several processes/threads

More information

CS 2505 Computer Organization I

CS 2505 Computer Organization I Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted one-page formula sheet. No calculators or other computing devices may

More information

COS 126 Written Exam 2 (Spring 2015)

COS 126 Written Exam 2 (Spring 2015) COS 126 Written Exam 2 (Spring 2015) There are 8 questions on this exam, weighted as indicated below. This exam is closed book. You may use a single-page two-sided hand-written cheatsheet. There is a blank

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

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

CS3331 Concurrent Computing Exam 1 Solutions Fall 2018

CS3331 Concurrent Computing Exam 1 Solutions Fall 2018 CS3331 Concurrent Computing Exam 1 Solutions Fall 2018 1 CS3331 Concurrent Computing Exam 1 Solutions Fall 2018 1. Basic Concepts (a) [10 points] Explain interrupts and traps, and provide a detailed account

More information

THE UNIVERSITY OF WESTERN AUSTRALIA SAMPLE EXAM QUESTIONS 2007 WITH SOLUTIONS SCHOOL OF COMPUTER SCIENCE CITS3213 CONCURRENT PROGRAMMING (PART II)

THE UNIVERSITY OF WESTERN AUSTRALIA SAMPLE EXAM QUESTIONS 2007 WITH SOLUTIONS SCHOOL OF COMPUTER SCIENCE CITS3213 CONCURRENT PROGRAMMING (PART II) THE UNIVERSITY OF WESTERN AUSTRALIA SAMPLE EXAM QUESTIONS 2007 WITH SOLUTIONS SCHOOL OF COMPUTER SCIENCE CITS3213 CONCURRENT PROGRAMMING (PART II) The exam will contain: 6 questions (3 for each part) Time

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

CS 2506 Computer Organization II Test 1

CS 2506 Computer Organization II Test 1 Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted one-page formula sheet. No calculators or other computing devices may

More information

CS 111X - Fall Test 1

CS 111X - Fall Test 1 CS 111X - Fall 2016 - Test 1 1/9 Computing ID: CS 111X - Fall 2016 - Test 1 Name: Computing ID: On my honor as a student, I have neither given nor received unauthorized assistance on this exam. Signature:

More information

Synchronization. CSE 2431: Introduction to Operating Systems Reading: Chapter 5, [OSC] (except Section 5.10)

Synchronization. CSE 2431: Introduction to Operating Systems Reading: Chapter 5, [OSC] (except Section 5.10) Synchronization CSE 2431: Introduction to Operating Systems Reading: Chapter 5, [OSC] (except Section 5.10) 1 Outline Critical region and mutual exclusion Mutual exclusion using busy waiting Sleep and

More information

Problem Score Max Score 1 Syntax directed translation & type

Problem Score Max Score 1 Syntax directed translation & type CMSC430 Spring 2014 Midterm 2 Name Instructions You have 75 minutes for to take this exam. This exam has a total of 100 points. An average of 45 seconds per point. This is a closed book exam. No notes

More information

Dr. D. M. Akbar Hussain DE5 Department of Electronic Systems

Dr. D. M. Akbar Hussain DE5 Department of Electronic Systems Concurrency 1 Concurrency Execution of multiple processes. Multi-programming: Management of multiple processes within a uni- processor system, every system has this support, whether big, small or complex.

More information

CS162, Spring/1992 Midterm #2 Professor Thomas Anderson

CS162, Spring/1992 Midterm #2 Professor Thomas Anderson CS162, Spring/1992 Midterm #2 Professor Thomas Anderson General Information: This is a closed book examination. You have 60 minutes to answer as many question as possible. The number in parentheses at

More information

CS 2506 Computer Organization II Test 1. Do not start the test until instructed to do so! printed

CS 2506 Computer Organization II Test 1. Do not start the test until instructed to do so! printed Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted one-page formula sheet. No calculators or other computing devices may

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 1018 L14 Deadlocks Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Mutex vs Semaphore 2 2 FAQ Does

More information

Dept. of CSE, York Univ. 1

Dept. of CSE, York Univ. 1 EECS 3221.3 Operating System Fundamentals No.5 Process Synchronization(1) Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University Background: cooperating processes with shared

More information

EECS 452 Midterm Closed book part Fall 2010

EECS 452 Midterm Closed book part Fall 2010 EECS 452 Midterm Closed book part Fall 2010 Name: unique name: Sign the honor code: I have neither given nor received aid on this exam nor observed anyone else doing so. Scores: # Points Closed book Page

More information

! Why is synchronization needed? ! Synchronization Language/Definitions: ! How are locks implemented? Maria Hybinette, UGA

! Why is synchronization needed? ! Synchronization Language/Definitions: ! How are locks implemented? Maria Hybinette, UGA Chapter 6: Process [& Thread] Synchronization CSCI [4 6] 730 Operating Systems Synchronization Part 1 : The Basics! Why is synchronization needed?! Synchronization Language/Definitions:» What are race

More information

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy Operating Systems Designed and Presented by Dr. Ayman Elshenawy Elsefy Dept. of Systems & Computer Eng.. AL-AZHAR University Website : eaymanelshenawy.wordpress.com Email : eaymanelshenawy@yahoo.com Reference

More information

COS 126 General Computer Science Fall Written Exam 1

COS 126 General Computer Science Fall Written Exam 1 COS 26 General Computer Science Fall 27 Written Exam This exam has 7 questions (including question ) worth a total of 7 points. You have 5 minutes. Write all answers inside the designated spaces. Policies.

More information

Introduction to OS Synchronization MOS 2.3

Introduction to OS Synchronization MOS 2.3 Introduction to OS Synchronization MOS 2.3 Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg Mahmoud El-Gayyar / Introduction to OS 1 Challenge How can we help processes synchronize with each other? E.g., how

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

CSE 131S Introduction to Computer Science Summer SON Exam I

CSE 131S Introduction to Computer Science Summer SON Exam I CSE 131S Introduction to Computer Science Summer SON 2014 Exam I Given: 1 July 2014 Due: End of live session This exam is closed-book, closed-notes, no electronic devices allowed except for downloading

More information

Do not start the test until instructed to do so!

Do not start the test until instructed to do so! Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted one-page formula sheet. No calculators or other electronic devices

More information

Introduction to Operating Systems

Introduction to Operating Systems Introduction to Operating Systems Lecture 4: Process Synchronization MING GAO SE@ecnu (for course related communications) mgao@sei.ecnu.edu.cn Mar. 18, 2015 Outline 1 The synchronization problem 2 A roadmap

More information

Computer Science CS221 Test 2 Name. 1. Give a definition of the following terms, and include a brief example. a) Big Oh

Computer Science CS221 Test 2 Name. 1. Give a definition of the following terms, and include a brief example. a) Big Oh Computer Science CS221 Test 2 Name 1. Give a definition of the following terms, and include a brief example. a) Big Oh b) abstract class c) overriding d) implementing an interface 10/21/1999 Page 1 of

More information

R13 SET - 1 2. Answering the question in Part-A is compulsory 1 a) Define Operating System. List out the objectives of an operating system. [3M] b) Describe different attributes of the process. [4M] c)

More information