CPS 110 Midterm. Out: Wednesday, October 8, 14:50 Due via Hardcopy: 16:05

Similar documents
CPS 110 Midterm. Spring 2011

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

CPS 110 Final Exam. Spring 2011

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

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

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

CSE 120 Principles of Computer Operating Systems Fall Quarter, 2002 Halloween Midterm Exam. Instructor: Geoffrey M. Voelker

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

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

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

Operating Systems (1DT020 & 1TT802)

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

Midterm Exam Amy Murphy 6 March 2002

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

Midterm Exam. October 20th, Thursday NSC

CPS 310 second midterm exam, 11/14/2014

MCS-378 Intraterm Exam 1 Serial #:

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

King Fahd University of Petroleum and Minerals. Write clearly, precisely, and briefly!!

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

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

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

Lecture 9: Midterm Review

CS153: Midterm (Fall 16)

Midterm Exam Solutions and Grading Guidelines March 3, 1999 CS162 Operating Systems

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

Suggested Solutions (Midterm Exam October 27, 2005)

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

Problem Set 2. CS347: Operating Systems

University of California College of Engineering Computer Science Division- EECS. Midterm Exam March 13, 2003 CS162 Operating Systems

Student Name:.. Student ID... Course Code: CSC 227 Course Title: Semester: Fall Exercises Cover Sheet:

Midterm Exam Solutions Amy Murphy 28 February 2001

CSE 153 Design of Operating Systems

CSC369 Lecture 5. Larry Zhang, October 19,2015

CS140 Operating Systems and Systems Programming Midterm Exam

CS140 Operating Systems and Systems Programming Midterm Exam

CS-537: Midterm Exam (Spring 2001)

CSE 120 Principles of Computer Operating Systems Fall Quarter, 2001 Midterm Exam. Instructor: Geoffrey M. Voelker

TDDB68 Processprogrammering och operativsystem / Concurrent programming and operating systems

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

FCM 710: Architecture of Secure Operating Systems

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

Operating Systems 2013/14 Assignment 3. Submission Deadline: Tuesday, December 17th, :30 a.m.

Cs703 Current Midterm papers solved by Naina_Mailk. Q: 1 what are the Characteristics of Real-Time Operating system?

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

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

CPS 310 midterm exam #1, 2/19/2018

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

CS 450 Exam 2 Mon. 4/11/2016

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

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

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

CPSC/ECE 3220 Summer 2018 Exam 2 No Electronics.

CS 318 Principles of Operating Systems

Operating Systems Comprehensive Exam. There are five questions on this exam. Please answer any four questions total

Midterm Exam #1 September 28, 2016 CS162 Operating Systems

Course Syllabus. Operating Systems

CSC369H1 S2016 Midterm Test Instructor: Bogdan Simion. Duration 50 minutes Aids allowed: none. Student number:

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

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

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

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

CPSC 457 OPERATING SYSTEMS MIDTERM EXAM SOLUTION

ECE469 - Operating Systems Engineering Exam # March 25

Midterm Exam October 15, 2012 CS162 Operating Systems

SAMPLE MIDTERM QUESTIONS

EECS 482 Introduction to Operating Systems

EECE.4810/EECE.5730: Operating Systems Spring 2018 Programming Project 3 Due 11:59 PM, Wednesday, 4/18/18 Monday, 4/30/18

Midterm I October 11 th, 2006 CS162: Operating Systems and Systems Programming

Midterm Exam March 3, 1999 CS162 Operating Systems

CSE 120 Principles of Operating Systems

CS 140: Operating Systems and Systems Programming Midterm Exam

CS-537: Midterm Exam (Fall 2013) Professor McFlub

Stanford University Computer Science Department CS 140 Midterm Exam Dawson Engler Winter 1999

CPSC 457 OPERATING SYSTEMS MIDTERM EXAM

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

First Midterm Exam September 28, 2017 CS162 Operating Systems

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

Qualifying exam: operating systems, 1/6/2014

So far. Next: scheduling next process from Wait to Run. 1/31/08 CSE 30341: Operating Systems Principles

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

Process Scheduling Part 2

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

Tasks. Task Implementation and management

COMP 3361: Operating Systems 1 Final Exam Winter 2009

Semaphore. Originally called P() and V() wait (S) { while S <= 0 ; // no-op S--; } signal (S) { S++; }

University of Waterloo Midterm Examination Model Solution CS350 Operating Systems

To Everyone... iii To Educators... v To Students... vi Acknowledgments... vii Final Words... ix References... x. 1 ADialogueontheBook 1

CSE 120 Principles of Operating Systems Spring 2017

Properties of Processes

Operating Systems EDA092, DIT 400 Exam

CS370 Operating Systems

CS 450 Exam 2 Mon. 11/7/2016

CPS 310 midterm exam #1, 2/19/2016

Operating Systems ECE344. Ding Yuan

CS4411 Intro. to Operating Systems Exam 2 Fall 2009

EE 472 Embedded Systems. Name solutions. Instructions:

Last Class: CPU Scheduling! Adjusting Priorities in MLFQ!

IT 540 Operating Systems ECE519 Advanced Operating Systems

CS140 Operating Systems and Systems Programming

Transcription:

CPS 110 Midterm Out: Wednesday, October 8, 14:50 Due via Hardcopy: 16:05 This is an in-class exam. Read the entire exam through before you begin working. Read each question carefully, and note all that is required of you. Keep your answers clear and concise. Often when you write more than you need you end up saying things that are incorrect. I don t expect you to need more than a page for any sub-question. If you need to make any assumptions that are not clear from the question, then please state them explicitly. For code, any kind of pseudocode is fine as long as its meaning is clear. You may assume standard routines like lists, queues, hash tables, etc. You are allowed one sheet of notes; any non-printed sources such as other students, laptops, PDAs, and phones are prohibited. Do not discuss the exam with anyone until the exam period is over. Please sign this page to indicate that you have completed your exam within these rules. Good luck! Name: Signature: Problem Score 1 2 3 4 5 total

1 Scheduling (40 pts) Consider the following jobs, with arrivals times and times to completion: A: arrives at time 0, takes 6 time units to run B: arrives at time 0, takes 2 time units to run C: arrives at time 3, takes 2 time units to run D: arrives at time 8, takes 5 time units to run Trace through the resulting schedules under the FCFS and STCF (also called SJF) scheduling policies, and their preemptive variants: FCFS-P (also called RR) and STCF-P. Compute the average response times. Note: the run times refer to time that the job requires on the CPU. The jobs use CPU time only with no I/O. The system has one CPU (core).

2 Semaphores (40 points) Your Project 1 thread library provides a monitor abstraction (mutex locks and condition variables) for user threads to synchronize. Semaphores offer an alternative abstraction. Outline how to extend your thread library to implement semaphores. In particular, show how to implement the semaphore Up/V()and Down/P() operations. You may rely on your thread library s internal data structures and routines for thread contexts, thread queues, context switch, and internal synchronization (disable/enable interrupts).

3 Mailboxes (40 pts) Show to extend your Project 1 thread library with a mailbox abstraction to enable threads to send and receive messages. Here s how it works. Each mailbox is identified by a number, like locks in Project 1. Each mailbox has a message queue. There are two operations on a mailbox: Send()and Receive(). Send()takes a pointer to a message object and posts it on the message queue. Receive()takes the next message off the queue and returns a pointer to the message object. Each mailbox can hold at most N messages. Send()blocks until there is room on the queue to post a message. Receive()blocks until there is a message on the queue to deliver. Messages are delivered in order, and no message is delivered more than once. Synchronize with monitors (mutex/condition variable) or semaphores if you prefer. Send(Message_t *m) { } Message_t *Receive() { (on back) }

4 Deadlocked (40 pts) Is it possible for a program to use these mailboxes (from Problem 3) in a way that results in deadlock? If no, explain why deadlock cannot occur: which of the preconditions for deadlock is/are not met, and why? If yes, construct an example, and briefly discuss how the system should deal with deadlock. Note: an example is defined as a program for which some schedules lead to deadlock and others do not, together with a legal schedule that leads to deadlock.

5 Coroutines (40 pts) Various elders trace the origin of threads to a 1963 paper by Melvin Conway introducing a programming construct called coroutines. Like a subroutine/procedure/method, a coroutine is a block of code with a named entry point and a sequence of statements in some programming language, which may include calls to subroutines. What s new is that coroutines introduce a Yield()primitive: Yield(target) passes control to another coroutine by name (given by the string argument target. A coroutine begins execution at its entry point when it first receives control. Each subsequent yield to a coroutine resumes its execution at the point of its last yield. Wikipedia provides the following example: var q := new queue coroutine produce loop while q is not full create some new items add the items to q yield to consume coroutine consume loop while q is not empty remove some items from q use the items yield to produce Compare/contrast the implementation of coroutines to threads with respect to stacks, scheduling, and synchronization.