SAMPLE MIDTERM QUESTIONS

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

Homework Assignment #5

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

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

Midterm Exam. October 20th, Thursday NSC

Announcements. Office hours. Reading. W office hour will be not starting next week. Chapter 7 (this whole week) CMSC 412 S02 (lect 7)

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

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

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

(MCQZ-CS604 Operating Systems)

CS 370 Operating Systems

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

Mid Term from Feb-2005 to Nov 2012 CS604- Operating System

Process Coordination

OPERATING SYSTEMS. UNIT II Sections A, B & D. An operating system executes a variety of programs:

Process Synchronization

CMPSCI 377: Operating Systems Exam 1: Processes, Threads, CPU Scheduling and Synchronization. October 9, 2002

Suggested Solutions (Midterm Exam October 27, 2005)

Lecture 2 Process Management

CS630 Operating System Design, First Exam, Spring 2017,

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

CS3733: Operating Systems

CS370 Operating Systems Midterm Review

Comp 310 Computer Systems and Organization

CS370 Operating Systems Midterm Review. Yashwant K Malaiya Spring 2019

1.1 CPU I/O Burst Cycle

Last class: Today: CPU Scheduling. CPU Scheduling Algorithms and Systems

CS370 Operating Systems

CS Mid term Exam Maximum points 100; Maximum time allowed: 75 minutes

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

Concurrency: Mutual Exclusion and Synchronization

Operating Systems (1DT020 & 1TT802)

Chap 7, 8: Scheduling. Dongkun Shin, SKKU

CHAPTER 2: PROCESS MANAGEMENT

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

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

ALL the assignments (A1, A2, A3) and Projects (P0, P1, P2) we have done so far.

* What are the different states for a task in an OS?

CSE 153 Design of Operating Systems

CS604 - Operating System Solved Subjective Midterm Papers For Midterm Exam Preparation

CSC 716 Advanced Operating System Fall 2007 Exam 1. Answer all the questions. The maximum credit for each question is as shown.

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

Assignment 3 (Due date: Thursday, 10/15/2009, in class) Part One: Provide brief answers to the following Chapter Exercises questions:

UNIT 2 Basic Concepts of CPU Scheduling. UNIT -02/Lecture 01

Process Synchronization

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

( D ) 4. Which is not able to solve the race condition? (A) Test and Set Lock (B) Semaphore (C) Monitor (D) Shared memory

Chapter 7: Process Synchronization. Background

Operating Systems. Scheduling

Chapter 7: Process Synchronization. Background. Illustration

Properties of Processes

Operating Systems. Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) alphapeeler.sf.net/pubkeys/pkey.htm

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

COMP SCI 3SH3: Operating System Concepts (Term 2 Winter 2006) Test 2 February 27, 2006; Time: 50 Minutes ;. Questions Instructor: Dr.

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

MARUTHI SCHOOL OF BANKING (MSB)

CMPT 300: Operating Systems I Assignment 1

QUESTION BANK UNIT I

CS 3733 Operating Systems

COSC243 Part 2: Operating Systems

CPU Scheduling Algorithms

Unit 3 : Process Management

Background. Module 6: Process Synchronization. Bounded-Buffer (Cont.) Bounded-Buffer. Background

Q 1. (10 Points) Assume that a process executes the following pseudo codes:

CS586: Distributed Computing Tutorial 3

EECE.4810/EECE.5730: Operating Systems Spring 2017 Homework 3 Solution

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

CS 318 Principles of Operating Systems

UNIT:2. Process Management

Lecture 5 / Chapter 6 (CPU Scheduling) Basic Concepts. Scheduling Criteria Scheduling Algorithms

OPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5

Unit 1: Introduction

Dept. of CSE, York Univ. 1

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

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT I

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

( B ) 4. Which is not able to solve the race condition? (A) Test and Set Lock (B) Shared memory (C) Semaphore (D) Monitor

Concurrency: Mutual Exclusion and

Processes-Process Concept:

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

Chapter 5: CPU Scheduling

Problem Set: Processes

CS 5523: Operating Systems

Operating System Review Part

Process Scheduling. Copyright : University of Illinois CS 241 Staff

CSE 120 Principles of Operating Systems

EECE.4810/EECE.5730: Operating Systems Spring 2017

COMP 3361: Operating Systems 1 Final Exam Winter 2009

CS4411 Intro. to Operating Systems Exam 2 Fall 2009

Starting the Threads

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

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

CS630 Operating System Design Second Exam, Spring 2015,

CPU Scheduling. Rab Nawaz Jadoon. Assistant Professor DCS. Pakistan. COMSATS, Lahore. Department of Computer Science

Course Syllabus. Operating Systems

CS370 Operating Systems

King Saud University. College of Computer & Information Sciences. Information Technology Department. IT425: Operating Systems.

Chapter 6: CPU Scheduling

CSE473/Spring st Midterm Exam Tuesday, February 19, 2007 Professor Trent Jaeger

Scheduling. Scheduling. Scheduling. Scheduling Criteria. Priorities. Scheduling

Transcription:

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 the actual questions in the midterm. Part A: Mark the following statements as either (T)rue or (F)alse by checking the corresponding box on the right. Each correct answer: T F 1. With preemptive scheduling, the only time the scheduler considers running a different process is when the current one runs to completion. 2. A trap is a hardware-generated interrupt. 3. When working with semaphores in a synchronization algorithm, the placement of signal (i.e. V ) statements is important and could result in deadlock if done incorrectly. 4. When a process blocks on I/O, it is placed in the ready queue. 5. The best scheduling algorithm to minimize average waiting time is Shortest Remaining Time First. 6. In UNIX, the exec() system call creates a new child process, and the fork system call replaces the current process s program with a new program and executes it. 7. The top-most level of the pyramid-shaped memory hierarchy consists of the cache. 8. The progress condition for process synchronization implies that if no process is executing in its critical section and there exists some processes that wish to enter their critical section, then the selection of the processes that will enter the critical section next cannot be postponed indefinitely. 9. A scheduler using the Round Robin algorithm is susceptible to the convoy effect. 1

Part B: [Processes / Threads] Question B.1: Processes vs. Threads vs. Programs Explain (in no more than 1-2 sentences each) the similarities and differences between the following: processes, threads, and programs. Question B.2: Inter-process Communication a) What is the key distinction between named and ordinary pipes? b) Consider the following scenario: a web server process listens for incoming connections, spawns a new process when a client connects, and communicates with the new process to notify it about additional client connections to facilitate a chat room feature. Which style of pipe would you use for this communication? Why? 2

Question B.3: Concurrent Execution of Processes. Consider the concurrent execution of process X and process Y (see Listing 1). Initialization int a=0; int b=0; Process X while (a==0) {do-nothing}; printf( 4 ); b=1; b=0; printf( A ); Process Y printf( 1 ); a=1; while (b==0) {do-nothing}; printf( 3 ); Listing 1 What could the output of the concurrent execution of process X and process Y be, assuming output is not buffered (it is flushed immediately)? State all possible outputs. 3

Part C: [CPU Scheduling] Question C.1: Waiting / Turnaround Time Consider the following set of processes: Process ID Arrival Time Burst Time Priority* P1 0 60 3 P2 20 40 4 P3 50 30 1 P4 110 10 2 *Assume that the highest priority is Priority=1. Now complete the GANTT charts, average waiting time, and average turnaround time for the 3 algorithms in the following table: Scheduling algorithm Average waiting time Average turnaround time First Come First Served (FCFS) Priority (preemptive) Show your work for partial credit. 4

This page intentionally left blank for you to show your calculations / GANTT charts. 5

Question C.2: Round Robin and the Time Quantum Q Consider N processes sharing the CPU in a round-robin fashion (N>=2). Assume that each context switch takes S ms and that each time quantum is Q ms. For simplicity, assume that processes never block on any event and simply switch between the CPU and the ready queue. Also, assume that a process is still in the ready queue while a context switch is happening. a) How does the behavior of the system change with varying Q? That is, what happens if Q is much smaller than S? What happens when Q, i.e. is much larger than the maximum turnaround time of all the processes? b) Which of the 3 scheduling algorithm performance metrics (waiting, response, turnaround time) would you use RR scheduling for in an attempt to improve? Why (1-2 sentences max)? 6

Part D: [Process Synchronization] Question D.1: Bakery Algorithm Consider the following implementation of the Bakery Algorithm that protects the critical sections of n processes, guaranteeing mutual exclusion, progress, and bounded waiting (Listing 2). 1 repeat 2 choosing[i] := true; 3 number[i] := max(number[0], number[1],,number[n-1]) + 1; 4 choosing[i] := false; 5 for j := 0 to n-1 6 do begin 7 while choosing[j] do no-op; 8 while number[j]!= 0 and (number[j],j) < (number[i],i) do no-op; 9 end; 10 critical section 11 number[i]:= 0; 12 remainder section 13 until false; Listing 2 a) Explain (in 1-3 sentences) how bounded waiting is realized in this algorithm. 7

b) What happens if we delete line 11? Does the algorithm still satisfy mutual exclusion, progress, and bounded waiting? Explain in a maximum of 2-3 sentences. 8

Question D.2: Semaphores Consider the following process execution diagram (Figure 1): Figure 1 Using semaphore notation ( wait, signal, and body ), show how to enforce the execution order (don t forget to declare/initialize your semaphores): 9