CPS 310 first midterm exam, 2/26/2014

Similar documents
(In columns, of course.)

CPS 310 midterm exam #2, 4/10/2017

Midterm Exam CPS 210: Operating Systems Spring 2013

CPS 310 first midterm exam, 10/6/2014

Qualifying exam: operating systems, 1/6/2014

KINGS COLLEGE OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING ACADEMIC YEAR / ODD SEMESTER

Operating Systems. Review ENCE 360

SHRI ANGALAMMAN COLLEGE OF ENGINEERING AND TECHNOLOGY (An ISO 9001:2008 Certified Institution) SIRUGANOOR, TIRUCHIRAPPALLI

ENGR 3950U / CSCI 3020U Midterm Exam SOLUTIONS, Fall 2012 SOLUTIONS

The Classical OS Model in Unix

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

Process Management! Goals of this Lecture!

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

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

Solutions to the first midterm. COSC 4330/6310 Summer 2013

Pipes and FIFOs. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University

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

Process Management 1

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

Processes. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Midterm Exam #2 December 4, 2013 CS162 Operating Systems

UNIX Memory Management Interview Questions and Answers

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

Processes. Sanzheng Qiao. December, Department of Computing and Software

CSC 4320 Test 1 Spring 2017

Question: Total Points: Score: CSE421 Midterm Exam. 09 Mar 2012

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

3. Process Management in xv6

Operating Systems CS 571

University of Ottawa School of Information Technology and Engineering

UNIT I Linux Utilities

IC221: Systems Programming 12-Week Written Exam [SOLUTIONS]

CS2028 -UNIX INTERNALS

Windows architecture. user. mode. Env. subsystems. Executive. Device drivers Kernel. kernel. mode HAL. Hardware. Process B. Process C.

The Process Abstraction. CMPU 334 Operating Systems Jason Waterman

ADVANCED OPERATING SYSTEMS

CS 3214 Midterm. Here is the distribution of midterm scores for both sections (combined). Midterm Scores 20. # Problem Points Score

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

PROCESS STATES AND TRANSITIONS:

Problem Set: Processes

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

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

CS Operating system Fall Midterm I -- Oct 5, 2017 You have 75 min. Good Luck!

Midterm I March 11 th, 2015 CS162: Operating Systems and Systems Programming

PROCESSES. Jo, Heeseung

Processes. Jo, Heeseung

Processes. Dr. Yingwu Zhu

EECS 482 Introduction to Operating Systems

CSC209 Review. Yeah! We made it!

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Templates what and why? Beware copying classes! Templates. A simple example:

Design Overview of the FreeBSD Kernel CIS 657

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files. Compiler vs.

Design Overview of the FreeBSD Kernel. Organization of the Kernel. What Code is Machine Independent?

CPS 310 midterm exam #2, 4/9/2018

Process Time. Steven M. Bellovin January 25,

SAMPLE MIDTERM QUESTIONS

Processes. Process Management Chapter 3. When does a process gets created? When does a process gets terminated?

Processes COMPSCI 386

Lecture 4: Memory Management & The Programming Interface

System Programming. Introduction to Unix

Exam Guide COMPSCI 386

Introduction to OS Processes in Unix, Linux, and Windows MOS 2.1 Mahmoud El-Gayyar

True/False: In Signal and Wait, the signaller finishes execution while the signalled process waits for its turn

Processes and Threads. Processes and Threads. Processes (2) Processes (1)

Problem Set: Processes

CS 322 Operating Systems Practice Midterm Questions

THE PROCESS ABSTRACTION. CS124 Operating Systems Winter , Lecture 7

Unix Processes. What is a Process?

OS Assignment I. The result is a smaller kernel. Microkernels provide minimal process and memory management, in addition to a communication facility.

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

Operating Systems Design Fall 2010 Exam 1 Review. Paul Krzyzanowski

Midterm Exam: ECSE 427/COMP 310 Operating Systems Thursday, March 1, 2012 Place: ENGMC 304 & ENGTR 0070; Time: 10:30am 11:30am

6.097 Operating System Engineering: Fall Quiz II THIS IS AN OPEN BOOK, OPEN NOTES QUIZ.

CS 370 Operating Systems

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

Background: Operating Systems

Computer Systems II. First Two Major Computer System Evolution Steps

CS 350 : COMPUTER SYSTEM CONCEPTS SAMPLE TEST 2 (OPERATING SYSTEMS PART) Student s Name: MAXIMUM MARK: 100 Time allowed: 70 minutes

CS450/550 Operating Systems

Universidad Carlos III de Madrid Computer Science and Engineering Department Operating Systems Course

Your name please: NetID:

PROCESS CONTROL BLOCK TWO-STATE MODEL (CONT D)

CPS 310 final exam, 5/1/2014

Notes to Instructors Concerning the BLITZ Projects

Processes. What s s a process? process? A dynamically executing instance of a program. David Morgan

CS 33. Architecture and the OS. CS33 Intro to Computer Systems XIX 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.

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

Processes. CS439: Principles of Computer Systems January 30, 2019

Logical disks. Bach 2.2.1

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo

CSCE Operating Systems Interrupts, Exceptions, and Signals. Qiang Zeng, Ph.D. Fall 2018

SE350: Operating Systems

Process Scheduling Queues

First Midterm Exam September 28, 2017 CS162 Operating Systems

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

Process management. What s in a process? What is a process? The OS s process namespace. A process s address space (idealized)

CSE 451: Operating Systems Winter Module 4 Processes. Mark Zbikowski Allen Center 476

Operating Systems (1DT020 & 1TT802)

Transcription:

CPS 310 first midterm exam, 2/26/2014 Your name please: Part 1. More fun with forks (a) What is the output generated by this program? In fact the output is not uniquely defined, i.e., it is not necessarily the same in each execution. What are the possible outputs? (Assume that there are no errors or failures.) [20 pts] /40 /40 /40 /20 /60 /200 int main() { int i = 0; if (fork()!= 0) { i = i + 1; if (fork()!= 0) exit(0); } fork(); printf("%d\n", i); } (b) Briefly justify/explain your answer for (a). Try to characterize the set of all possible outputs. [20 pts]

CPS 310 first midterm exam, 2/26/2014, page 2 of 6 Part 2. True/False The following true/false questions pertain to the classic C/Unix (or Android) environment as discussed in class. For each statement, indicate (in the space on the left) whether it is true (T) or false (F). Please add a brief comment to explain your answer in the space provided. [40 points] (a) The first user-mode instruction that executes in any Unix process is in a system call stub. (b) Every thread context switch results from a timer interrupt or a sleep operation. (c) A successful exec* system call trap never returns to the process that invoked it. (d) A successful exec* system call reads data from a file (among other things that it does). (e) A machine fault always indicates some kind of error in the software. (f) Interrupt handlers execute entirely in kernel mode. (g) A child process runs with the user ID of its parent. (h) A pipe can be used to communicate only among siblings of a common parent. (i) A running program may read its standard input (stdin) from a network socket. (j) Multiple processes in a single pipeline can execute at the same time.

CPS 310 first midterm exam, 2/26/2014, page 3 of 6 Part 3. Reference counts The following questions pertain to the classic C/Unix (or Android) environment as discussed in class. Answer each question with a few phrases or maybe a sentence or two. [40 points] (a) The Unix kernel uses reference counting to manage the lifetimes of various objects. The reference counts are incremented and decremented during the execution of various system calls. List five system calls that increment reference counts on objects in the kernel. (b) List five system calls that decrement reference counts on objects in the kernel. (c) Are there any cases in which a fault handler might increment or decrement reference counts on objects in the kernel? Cite example(s) and/or explain. (d) Are there any cases in which the kernel might store a reference count on disk? Cite example(s) and/or explain. (e) True or false: dangling references cannot occur when reference counting is used (correctly). Explain. (f) List two operations in Android that increment reference counts maintained by Android system software. What does Android do when these reference counts go to zero?

CPS 310 first midterm exam, 2/26/2014, page 4 of 6 Part 4. Cats As you know, cat is a simple standard Unix program that invokes read/write system calls in a loop to transfer bytes from its standard input (stdin) to its standard output (stdout). These questions ask you to explain various interactions of cats (processes running the cat program) with one another and with the kernel. (a) Consider this command line to a standard shell: cat <in cat. How does the second cat know when it is done, i.e., what causes it to exit? [10 points] (b) Suppose that the program called empty is the null C program: int main() {}. Consider this command line to a standard shell: cat empty. What does it do? How does the cat know when it is done, i.e., what causes it to exit? [10 points] (c) Consider this command line to a standard shell: cat <in >out. You may assume that the current directory resides on a disk, and that in is a file with some substantial amount of data in it. This question asks you to explain how this cat consumes memory and CPU time. Please answer on the following page. [60 points] First, how much memory does it consume? Draw a picture of the page table and the segments of the virtual address space, with your best guess of the total size. I am looking for a rough sketch of these data structures as they would reside in the memory of the machine. Details vary, so you may make any reasonable simplifying assumptions about the machine or the cat program, but please note them in your answer. Second, how much CPU time does it consume? How does the CPU time vary with the size of the file in? How much of the time is spent in kernel mode vs. user mode? Draw a rough sketch of how the cat transitions between user mode, kernel mode, and sleep states as it executes through time. What events cause the transitions?

CPS 310 first midterm exam, 2/26/2014, page 5 of 6 This page intentionally left blank

CPS 310 first midterm exam, 2/26/2014, page 6 of 6 This page intentionally left blank