CS 370 Operating Systems

Similar documents
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/16/2006

CHAPTER 2: PROCESS MANAGEMENT

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

Processes The Process Model. Chapter 2. Processes and Threads. Process Termination. Process Creation

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

SAMPLE MIDTERM QUESTIONS

CS370 Operating Systems Midterm Review

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

CS370 Operating Systems Midterm Review. Yashwant K Malaiya Spring 2019

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

Process a program in execution; process execution must progress in sequential fashion. Operating Systems

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

Lecture 2 Process Management

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

Processes The Process Model. Chapter 2 Processes and Threads. Process Termination. Process States (1) Process Hierarchies

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

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

Techno India Batanagar Department of Computer Science & Engineering. Model Questions. Multiple Choice Questions:

Processes-Process Concept:

1.1 CPU I/O Burst Cycle

Chapter 5: CPU Scheduling

Computer Systems II. First Two Major Computer System Evolution Steps

CPU Scheduling. Basic Concepts. Histogram of CPU-burst Times. Dispatcher. CPU Scheduler. Alternating Sequence of CPU and I/O Bursts

TDIU25: Operating Systems II. Processes, Threads and Scheduling

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

OPERATING SYSTEMS: Lesson 4: Process Scheduling

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

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

Midterm Exam. October 20th, Thursday NSC

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

CS 322 Operating Systems Practice Midterm Questions

Properties of Processes

Process Concept Process in Memory Process State new running waiting ready terminated Diagram of Process State

University of Ottawa School of Information Technology and Engineering

Operating Systems and Networks Assignment 9

Chapter 2 Processes and Threads. Interprocess Communication Race Conditions

Chapter 5: CPU Scheduling

Chapter 5 CPU scheduling

CS 5523: Operating Systems

Processes and Threads

UNIT:2. Process Management

CS307: Operating Systems

CS370 Operating Systems

CS Operating system Summer Midterm I -- July 11, 2017 You have 115 min (10:00am-11:55pm). Good Luck!

What are they? How do we represent them? Scheduling Something smaller than a process? Threads Synchronizing and Communicating Classic IPC problems

Chapter 2 Processes and Threads

Processes. Operating System CS 217. Supports virtual machines. Provides services: User Process. User Process. OS Kernel. Hardware

CS370 Operating Systems

UNIX Input/Output Buffering

CS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University

Getting to know you. Anatomy of a Process. Processes. Of Programs and Processes

Scheduling. Today. Next Time Process interaction & communication

Killing Zombies, Working, Sleeping, and Spawning Children

Threads. Threads The Thread Model (1) CSCE 351: Operating System Kernels Witawas Srisa-an Chapter 4-5

Operating Systems Design Fall 2010 Exam 1 Review. Paul Krzyzanowski

Chapter 3: Processes. Operating System Concepts 8th Edition,

CS370 Operating Systems

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

Processes. Operating System Concepts with Java. 4.1 Sana a University, Dr aimen

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

Chapter 5: CPU Scheduling

Uniprocessor Scheduling

Chap 4, 5: Process. Dongkun Shin, SKKU

OPERATING SYSTEMS. COMS W1001 Introduction to Information Science. Boyi Xie

COMP 3361: Operating Systems 1 Midterm Winter 2009

Chapter 5: CPU Scheduling. Operating System Concepts Essentials 8 th Edition

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

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

CS450 OPERATING SYSTEMS FINAL EXAM ANSWER KEY

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

CPU Scheduling. Operating Systems (Fall/Winter 2018) Yajin Zhou ( Zhejiang University

Part Two - Process Management. Chapter 3: Processes

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

CS510 Operating System Foundations. Jonathan Walpole

CS153: Midterm (Fall 16)

CMPT 300: Operating Systems I Assignment 1

Reminder. Exam QuesVon 1a. 1 st Midterm Exam Thursday February 18, 9.30am, in class Keep seat open between you and neighbor!

Chapter 3: Process-Concept. Operating System Concepts 8 th Edition,

Class average is Undergraduates are performing better. Working with low-level microcontroller timers

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition

Chapter 4: Processes. Process Concept

(MCQZ-CS604 Operating Systems)

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition

Chapter 4: Processes

CPU Scheduling. Daniel Mosse. (Most slides are from Sherif Khattab and Silberschatz, Galvin and Gagne 2013)

Job Scheduling. CS170 Fall 2018

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

What Is A Process? Process States. Process Concept. Process Control Block (PCB) Process State Transition Diagram 9/6/2013. Process Fundamentals

FCM 710: Architecture of Secure Operating Systems

LECTURE 3:CPU SCHEDULING

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

Processes. Rafael Ramirez Dep Tecnologia Universitat Pompeu Fabra

Chapter 6: Synchronization. Chapter 6: Synchronization. 6.1 Background. Part Three - Process Coordination. Consumer. Producer. 6.

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

Question 1. Notes on the Exam. Today. Comp 104: Operating Systems Concepts 11/05/2015. Revision Lectures

Chapter 6: CPU Scheduling

B. V. Patel Institute of Business Management, Computer &Information Technology, UTU

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

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

Transcription:

NAME S.ID. # CS 370 Operating Systems Mid-term Example Instructions: The exam time is 50 minutes. CLOSED BOOK. 1. [24 pts] Multiple choice. Check one. a. Multiprogramming is: An executable program that is composed of modules built using different programming languages. Keeping several programs in memory at once and switching between them. Having multiple processors execute different programs at the same time. When a program has multiple threads that run concurrently. b. A process exists in the zombie (also known as defunct) state because: It is running but making no progress. The parent may need to read its exit status. The user may need to restart it without reloading the program. The process may still have children that have not exited. c. Which state transition is not valid?: Ready Blocked Ready Running Running Ready Running Blocked d. Threads within the same process do not share the same: Text segment (instructions). Stack. Data segment. Open files. e. Preemption is when an operating system moves a process between these states:: Running Ready Ready Blocked Running Blocked Blocked Running 10/05/16

f. All processes in UNIX are created using the fork() system call (except the initial one). True False g. Process creation using fork() results in a copy of the parent s memory image. Assume that a new program is not loaded into the child using the exec() command. After the fork() operation, when a variable is changed in the parent process, this change is reflected in the child process. True False h. Consider a Thread T1 that invoked method x, which resulted in the invocation of method y, which resulted in the invocation of method z. How many frames exist on thread T1 s stack? Do all stack frames on thread T1 s stack must be of the same size? 2, no 3, no 3, yes 2, yes 2. [9 pts] Consider the code below. main(int argc, char **argv) { int i; for (i=0; i < 3; i++) { fork(); printf("hello\n ); } } a. What will be the total number of processes? Answer: (Hint complete the diagram below. Label each process with a number (just for counting. It is not necessarily the PID). 0 parent 1 child b. How many times hello message will be printed? Answer: PAGE 2 OF 6

3. [12 pts] Multiple choice. Check one. a. A time-decayed exponential average of previous CPU bursts allows a scheduler to: Estimate when each process will complete execution and exit. Pick the process that will be most likely block on I/O the soonest. Compute the optimum number of processes to have in the run queue. Determine the overall load on the processor. b. Process aging is when: A long-running process gets pushed to a lower priority level. A long-running process gets pushed to a higher priority level. A process that did not get to run for a long time gets a higher priority level. Memory and other resources are taken away from a process that has run for a long time. c. With soft affinity on a multiprocessor system, the scheduler will: Try to use the same processor for the same process but move it if another processor has no work. Use a single run queue so that there is no ongoing association between processors and processes. Associate a process with a specific processor and ensure it always runs on that processor. Periodically reset the association between all processes and processors. d. Answer if the following scheduling algorithms could result in starvation? Shortest job first True False First-come, first-served True False Round robin True False Priority ( when priorities do not change over time.) True False PAGE 3 OF 6

4. [16 points] The following processes are submitted to an operating system. They are calculation processes which require no input/output (i.e. they are always ready to utilize the CPU). For Shortest Remaining Time First and Round Robin (time quantum 3) give the Gantt charts and calculate average waiting time. Mark and label the instants when a process starts running and is switched out. Process Arrival time Burst time 1 0 7 2 1 5 3 2 2 4 4 1 Shortest Remaining Time First Average waiting time = ( )/ = and Round Robin (time quantum 3) Average waiting time = ( )/ = 5. [12 points] True or false select one. A process cannot be context-switched when it is executing an atomic operation supported by the CPU s ISA (Instruction Set Architecture). True False In solutions to the critical section problem, processes that are executing in their remainder section next make decisions about who gets to enter the critical section next. True False A process may have multiple, unrelated critical sections. True False Processes {P0, P1,, Pn-1} are coordinating their accesses to a critical section where they make changes to common variables. It is OK for one of the processes to disregard the protocol for accessing critical sections and just directly access the critical section. True False PAGE 4 OF 6

6. [12 points] The code segment below show how a set of processes accesses their critical section using a binary semaphore mutex that is initialized to 1. do { wait(mutex) critical section signal (mutex) remainder section } while (TRUE); a. A process P1 has entered the critical section and it currently in the critical section. A process P2 is now trying to enter the critical section. What value of mutex it will find? Answer: b. A process P1 is currently executing the remainder section. A process P2 is now trying to enter the critical section. What value of mutex P2 will find, assuming there are no other processes? Answer: c. Assume that the statement wait(mutex) is omitted. What will happen? Ans: is violated. d. What would happen if we were to omit the signal(mutex) statement? Ans: This would result in a since enter the critical section. PAGE 5 OF 6

7. [10 points] Let s consider the producer-consumer problem with a bounded buffer (below). The size of the buffer is N. There are 3 semaphores: A binary semaphore mutex. Counting semaphore X Counting semaphore.y Producer process do { /* produce item p */ wait(x); wait(mutex); /* add p to buffer */ signal(mutex); signal(y); } while (true); Consumer process do { wait( ); (mutex); /* remove item c from buffer*/ signal( ); signal(x); /* consume c */ } while (true); a. The initial value of X is N. Other initial values are mutex and Y (specify both). b. Fill in the blanks in the code for the Consumer process. PAGE 6 OF 6