CS140 Operating Systems and Systems Programming Midterm Exam

Similar documents
CS140 Operating Systems and Systems Programming Midterm Exam

CS140 Operating Systems and Systems Programming Midterm Exam

CS 140: Operating Systems and Systems Programming Midterm Exam

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

CS140 Operating Systems and Systems Programming

University of Waterloo Midterm Examination Model Solution CS350 Operating Systems

CS 140 Midterm Examination Winter Quarter, 2012

Midterm Exam. October 20th, Thursday NSC

CS140 Operating Systems and Systems Programming Final Exam

CSE 153 Design of Operating Systems

Midterm Exam Amy Murphy 19 March 2003

CS140 Operating Systems and Systems Programming Final Exam

CS140 Operating Systems and Systems Programming Final Exam

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

CS140 Operating Systems and Systems Programming Final Exam

CS140 Operating Systems and Systems Programming Final Exam

MCS-378 Intraterm Exam 1 Serial #:

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

Suggested Solutions (Midterm Exam October 27, 2005)

CSCI-GA Operating Systems Lecture 3: Processes and Threads -Part 2 Scheduling Hubertus Franke

CS350: Final Exam Review

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

Lecture 9: Midterm Review

CS 318 Principles of Operating Systems

CSE 120 Principles of Operating Systems Spring 2017

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

CS 153 Design of Operating Systems Winter 2016

CPSC/ECE 3220 Summer 2017 Exam 2

Last Class: Deadlocks. Today

Computer Science 161

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

COMP 3361: Operating Systems 1 Midterm Winter 2009

CSE 120 Principles of Operating Systems

TDDB68 Processprogrammering och operativsystem / Concurrent programming and operating systems

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

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


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

a. A binary semaphore takes on numerical values 0 and 1 only. b. An atomic operation is a machine instruction or a sequence of instructions

CS-537: Midterm Exam (Spring 2001)

Two hours. Question ONE is COMPULSORY UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. Date: Friday 25th January 2013 Time: 14:00-16:00

CS4411 Intro. to Operating Systems Exam 2 Fall 2009

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

Midterm Exam Amy Murphy 6 March 2002

Operating Systems (1DT020 & 1TT802)

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

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

Lecture notes Lectures 1 through 5 (up through lecture 5 slide 63) Book Chapters 1-4

Scheduling. The Basics

Lecture Topics. Announcements. Today: Uniprocessor Scheduling (Stallings, chapter ) Next: Advanced Scheduling (Stallings, chapter

Today: Protection! Protection!

Uniprocessor Scheduling. Aim of Scheduling

Uniprocessor Scheduling. Aim of Scheduling. Types of Scheduling. Long-Term Scheduling. Chapter 9. Response time Throughput Processor efficiency

Chapter 5 Concurrency: Mutual Exclusion. and. Synchronization. Operating Systems: Internals. and. Design Principles

Uniprocessor Scheduling

IT 540 Operating Systems ECE519 Advanced Operating Systems

Advanced Operating Systems (CS 202) Scheduling (1)

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

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

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

CPS 110 Midterm. Spring 2011

Chapter 9 Uniprocessor Scheduling

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

CS140 Operating Systems and Systems Programming

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

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

Processes and Threads. Processes: Review

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

Last Class: CPU Scheduling! Adjusting Priorities in MLFQ!

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

CPSC/ECE 3220 Summer 2018 Exam 2 No Electronics.

Remaining Contemplation Questions

Today s class. Scheduling. Informationsteknologi. Tuesday, October 9, 2007 Computer Systems/Operating Systems - Class 14 1

MC7204 OPERATING SYSTEMS

CSI3131 Final Exam Review

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

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

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

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

Timers 1 / 46. Jiffies. Potent and Evil Magic

Chapter 5 Concurrency: Mutual Exclusion and Synchronization

8: Scheduling. Scheduling. Mark Handley

Scheduling of processes

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

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

1.1 CPU I/O Burst Cycle

Chapter 5: CPU Scheduling

CSC369 Lecture 5. Larry Zhang, October 19,2015

CS153: Midterm (Fall 16)

CSE 4/521 Introduction to Operating Systems

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

Chendu College of Engineering & Technology

Problems Kernel Scheduler User Level Scheduler Universität Karlsruhe (TU), System Architecture Group

Notes on the Exam. Question 1. Today. Comp 104:Operating Systems Concepts 11/05/2015. Revision Lectures (separate questions and answers)

Synchronization for Concurrent Tasks

Today: Protection. Sermons in Computer Science. Domain Structure. Protection

CS370 Operating Systems

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

Uniprocessor Scheduling. Chapter 9

Comp 204: Computer Systems and Their Implementation. Lecture 25a: Revision Lectures (separate questions and answers)

Transcription:

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 Honor Code, I certify that I will neither give nor receive unpermitted aid on this exam. Signature: This examination is close notes and close book. You may not collaborate in any manner on this exam. You have 50 minutes to complete the exam. Before starting, please check to make sure that you have all 10 pages. 1 2 3 Total Name:

1. CPU Scheduling (14 points total) (2 points) What advantages does a preemptive CPU scheduling algorithm have over a non-preemptive one? (3 points) Why do different levels of a multi-level feedback queue CPU scheduler have different time quantum? Page 2 of 10f

(3 points) Why do we say that round robin CPU scheduling does poorly when faced with jobs of equal length? (3 points) What is the difference between time-sharing and space-sharing a resource? Give examples. Page 3 of 10f

(3 points) Programs such as just-in-time compilers for Java increase performance by using runtime code generation to generate better code to run. Explain how runtime code generation can actually hurt performance. 2. Memory (17 points total) (4 points) At one time, virtual memory system designers were advised to bias page replacement algorithms against modified pages in favor of those that have not been modified. The result of this suggestion was the unfortunate behavior of program code pages (which tend to be some of the only pages that are not modified) being kicked out of memory before other pages. Describe the rationale for the original suggestion of paging unmodified pages first. Page 4 of 10f

(3 points) The N-bit clock page replacement algorithm described in the lecture notes computed the page use_count as: use_count = (use_bit << N-1) (use_count >> 2) where use_bit is the reference/use bit for the page. Describe the motivation for computing the use_count like this. (2 points) Explain how adding segmentation to a pure paging system can reduce the size of the page tables. Page 5 of 10f

(4 points) The Intel x86 architecture started using pure segmentation and was extended to use segmentation and paging. Given an architecture with a base-and-bound system, would there be any benefit to adding paging (i.e.. base-and-bound and paging)? Explain your answer. (2 points) Would it ever make sense for two processes to share the same page table? Page 6 of 10f

(2 points) Can a first fit memory allocator ever have less fragmentation than a best fit one? 3. Concurrency and synchronization (19 points) (3 points) Your partner says he knows how to recover from a deadlock condition in Nachos. He simply keeps track of the locks acquired by each process and when a deadlock is detected he kills the processes involved in the deadlock and releases the locks they are holding. Will this work? Why or why not? Page 7 of 10f

(4 points) (a) Explain how a compare-and-swap instruction can be used to increment a shared integer variable without using other synchronization operations such as locks or semaphores. (b) Will the scheme you describe work if an interrupt handler also updates the shared integer variable? (i.e. will it work if the variable is incremented both in normal code and in an interrupt handler). (2 points) Does a deadlock prevention algorithm necessarily prevent starvation as well? Justify your answer. Page 8 of 10f

(2 points) What is the optimal spin before-blocking time for a spin lock on a uniprocessor? How about a multiprocessor? (3 points) Most operating systems today use a scheme that supports multiple address spaces, each with multiple threads of control. Assume you are given two operating systems: OS-A which supports multiple addresses spaces each with one thread of control and OS-B which is a single address space OS with multiple threads of control. Which OS (OS-A or OS-B) would it be easier to modify to support multiple address spaces each with multiple threads of control? Justify your answer. Page 9 of 10f

(2 points) Can a system that uses only spin locks (i.e. no blocking locks or semaphores) deadlock? Justify your answer. (3 points) Although both procedure calls and thread switches effectively switch the execution context of the CPU, procedure calls are normally much faster than thread switches. Explain why this is the case. Page 10 of 10f