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

Similar documents
System Call. Preview. System Call. System Call. System Call 9/7/2018

Processes. OS Structure. OS Structure. Modes of Execution. Typical Functions of an OS Kernel. Non-Kernel OS. COMP755 Advanced Operating Systems

Process Description and Control

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

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

Operating Systems. Computer Science & Information Technology (CS) Rank under AIR 100

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

TDDB68 Processprogrammering och operativsystem / Concurrent programming and operating systems

Process Time. Steven M. Bellovin January 25,

CS153: Midterm (Winter 19)

CSC 539: Operating Systems Structure and Design. Spring 2006

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

Dr. D. M. Akbar Hussain DE5 Department of Electronic Systems

Processes and Non-Preemptive Scheduling. Otto J. Anshus

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

Lecture 2 Process Management

3.1 Introduction. Computers perform operations concurrently

Processes and Threads

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

CSCE 313: Intro to Computer Systems

518 Lecture Notes Week 3

Chapter 5: Processes & Process Concept. Objectives. Process Concept Process Scheduling Operations on Processes. Communication in Client-Server Systems

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

CS153: Midterm (Fall 16)

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

CHAPTER 2: PROCESS MANAGEMENT

Lecture Topics. Announcements. Today: Threads (Stallings, chapter , 4.6) Next: Concurrency (Stallings, chapter , 5.

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

Processes and More. CSCI 315 Operating Systems Design Department of Computer Science

There are 10 total numbered pages, 5 Questions. You have 60 minutes. Budget your time carefully!

Processes. Process Concept

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

Announcement. Exercise #2 will be out today. Due date is next Monday

Roadmap. Tevfik Ko!ar. CSC Operating Systems Fall Lecture - III Processes. Louisiana State University. Processes. September 1 st, 2009

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

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

Concurrent Processing in Client-Server Software

Process Description and Control

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

CSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song

Chapter 3 Processes. Process Concept. Process Concept. Process Concept (Cont.) Process Concept (Cont.) Process Concept (Cont.)

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

Processes and Threads

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

Operating Systems: Internals and Design Principles. Chapter 2 Operating System Overview Seventh Edition By William Stallings

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

CSC 4320 Test 1 Spring 2017

University of Waterloo Midterm Examination Model Solution CS350 Operating Systems

CSE325 Principles of Operating Systems. Processes. David P. Duggan February 1, 2011

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

Processes. CS3026 Operating Systems Lecture 05

Roadmap. Tevfik Ko!ar. CSC Operating Systems Spring Lecture - III Processes. Louisiana State University. Virtual Machines Processes

Process Description and Control. Chapter 3

2 Processes. 2 Processes. 2 Processes. 2.1 The Process Model. 2.1 The Process Model PROCESSES OPERATING SYSTEMS

Operating Systems Overview. Chapter 2

CSE 153 Design of Operating Systems

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

Fundamentals of Operating Systems (COMP355/L) A Student's Manual for Practice Exercises

Major Requirements of an OS

CPS 310 first midterm exam, 2/26/2014

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

Chapter 3 Process Description and Control

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

Process Description and Control. Chapter 3

IT 540 Operating Systems ECE519 Advanced Operating Systems

csci3411: Operating Systems

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

TENTAMEN / EXAM. TDDB68 / TDDB72 Processprogrammering och operativsystem / Concurrent programming and operating systems 14 jan 2009, 08:00 12:00 TER2

Module 4: Processes. Process Concept Process Scheduling Operation on Processes Cooperating Processes Interprocess Communication

Module 4: Processes. Process Concept Process Scheduling Operation on Processes Cooperating Processes Interprocess Communication

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

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

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

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

W4118 Operating Systems. Junfeng Yang

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

Threads, SMP, and Microkernels. Chapter 4

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

Operating Systems. Figure: Process States. 1 P a g e

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

EECS 482 Midterm (Fall 1998)

Process Description and Control. Chapter 3

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

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

Preview. The Thread Model Motivation of Threads Benefits of Threads Implementation of Thread

Threads, SMP, and Microkernels

Lecture 9: Midterm Review

CS 370 Operating Systems

Lecture 17: Threads and Scheduling. Thursday, 05 Nov 2009

CS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017

SMD149 - Operating Systems

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

Reading Assignment 4. n Chapter 4 Threads, due 2/7. 1/31/13 CSE325 - Processes 1


Learning Outcomes. Processes and Threads. Major Requirements of an Operating System. Processes and Threads

Chapter 4: Processes. Process Concept

Processes and Threads

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

Chapter 4: Processes

QUESTION BANK UNIT I

Transcription:

Page 1 of 8 ITEC202 Operating Systems, Midterm Exam Eastern Mediterranean University School of Computing and Technology Department of Information Technology ITEC202 Operating Systems ITEC 202 Midterm Examination 31 January 2013, Thursday Duration: 85 Minutes Lecturer: Dr. Ahmet Rizaner Name Surname Student No Group General Remarks: 1. This is a closed book exam. 2. Attempt ALL questions. 3. Make sure you have 8 different pages including this page. 4. All work to be done in the spaces provided on the exam paper. 5. No books, notes and dictionaries are allowed. 6. You can use a calculator but mobile phones are not allowed to be used as calculators. 7. All mobile phones should be switched off during the exam. 8. If you think a question is not clear, then write the assumptions you made for your solution. Marks Question 1 (30 pts.) Question 2 (12 pts.) Question 3 (20 pts.) Question 4 (12 pts.) Question 5 (16 pts.) Question 6 (10 pts.) Total (100pts.) Good Luck

Page 2 of 8 ITEC202 Operating Systems, Midterm Exam Question 1. Multiple Choices (30 pts.) Choose only one best answer from the choices below for each question and write your answers to the space provided at the end of this section. (2 points each) 1. Which of the following transitions is likely to occur when an I/O operation for a process completes? a) Ready to Running b) Blocked to Ready c) Blocked to Running d) Running to Blocked 2. The Process Image element that contains the modifiable part of the user space is called the: a) Process Control Block b) System Stack c) User Data d) User Program 3. Which of the following can not be said about a process? a) Only one process can be running on any processor at any instant. c) A newly generated process will be in waiting state. b) Each process is represented in the OS by a PCB. d) A process is a program in execution. 4. Multiprogramming allows: a) Multiple processes to execute at exactly the same time. b) The OS to use the hardware more efficiently. c) Processes to run faster. d) Computer hardware to be more user friendly. 5. Process creation in a typical UNIX system is made by means of a kernel system call named. a) fork() b) run() c) CreateProcess() d) process() 6. The manages the processor s time by determining which application program is executed next. a) thread b) loader c) interrupt d) dispatcher 7. A Memory Table is an OS control structure that is used by the OS to: a) Manage I/O devices b) Manage processes c) Provide information about system files d) None of them 8. Which of the following is not an element of a process image? a) User data b) PCB c) User Program d) Thread state

Page 3 of 8 ITEC202 Operating Systems, Midterm Exam 9. is a 32-bit operating system with the ability to support older DOS and Windows applications. a) Windows 3.1 b) Unix c) Windows NT 3.1 d) MS-DOS 10. In MS-DOS, the DOS stands for. a) Direct Operating System b) Disk Operating System c) Dynamic Operating System d) Distributed Operating System 11. A architecture assigns only a few essential functions to the kernel, including address spaces, interprocess communication and basic scheduling. a) Monolithic kernel b) Microkernel c) Minikernel d) None of them 12. When one process spawns another, the spawning process is referred to as the process and the spawned process is referred to as the process. a) child - parent b) old - new c) parent child d) main - thread 13. consists of the most used and most fundamental components of the operating system. a) Processor b) Server c) Kernel d) Memory 14. Which of the following operating system does not support multithreading? a) Windows XP b) DOS c) Linux d) OS/2 15. Which of the following is not an advantage of symmetric multiprocessing architecture over uniprocessor architecture? a) Ability to evolve b) Performance c) Availability d) Incremental growth Answers of Question 1 Write your answers (A, B, C or D) for Question 1 into the spaces provided below. Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 b c c d a d d d Q9 Q10 Q11 Q12 Q13 Q14 Q15 c b b c c b a

Page 4 of 8 ITEC202 Operating Systems, Midterm Exam Question 2. Unix process creation (12 pts.) Consider the following section of the code and assume that all fork system calls are successful. main() { int j = 2; int pid; while (j >= 1) { pid = fork(); j=j-1; if (pid > 0) { } } printf("in parent %d. \n", j); } else { printf("in child %d. \n", j); } a. What value is returned if fork system call is not successful? (2 pts.) -1 b. What will be printed? (5 pts.) In parent 1. In parent 0. In child 1. In parent 0. In child 0. In child 0. (different outputs are possible) c. Draw a process tree for the above program. (5 pts.) A Parent B Child 1 C Child 2 D Child 3

Page 5 of 8 ITEC202 Operating Systems, Midterm Exam Question 3. Utilization (20 pts.) Assume there are three processes A, B and C. All processes are submitted for execution at the same time. The process A executes for 2 milliseconds then does I/O for 4 milliseconds then executes 3 millisecond then does I/O for 5 milliseconds more and then exists. The process B executes for 2 milliseconds then does I/O for 4 milliseconds then executes for 2 milliseconds more and then exits. The process C executes for 5 milliseconds then does I/O for 6 milliseconds and then exists. Assume no contention for the resources and the order of execution (priority) is A, B and C. a. Calculate the processor utilization with multiprogramming. (10 pts.) A I/O I/O I/O I/O I/O I/O I/O I/O I/O B I/O I/O I/O I/O C I/O I/O I/O I/O I/O I/O Overall I/O I/O I/O I/O I/O I/O Total Job Duration : 20 Utilization (%) Total Execution Duration : 14 b. Assume that the computer system has 1024 Mbytes of available memory. What is the memory utilization with multiprogramming if Process A requires 256 Mbytes, Process B requires 512 Mbytes and Process C requires 128 Mbytes of memory. Note that: all processes are submitted for execution at the same time. (6 pts.) Between 0-11ms A, B & C are in memory so total memory requirement is ( ) for 8ms. Between 11ms-14ms A & C are in memory so total memory requirement is ( ) for 3ms. Between 14ms-20ms only C is in memory so total memory requirement is ( ) for 6ms. The total memory utilization is : ( ) c. What would be the total job duration, if these processes were executed on a multi-processor system with two processors? (4 pts.) I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O 15 ms Total Job Duration : 15

Page 6 of 8 ITEC202 Operating Systems, Midterm Exam Question 4. Deadlock Research Allocation Graph (12 pts.) The current allocation, maximum needs (claims) and available resources are as shown below. A system is composed of four processes, {P1, P2, P3, P4}, and three types of consumable resources, {R1, R2, R3}. There are 2 units each of R1 and R3 and 1 unit of R2. P1 requests a unit of R1 and a unit of R3. P2 uses a unit of R1 and R3 and requests 1 unit of R2. P3 requests 1 unit each of R1 and R3. P4 uses a unit of R2 and requests a unit of R3. (a) Draw the resource-allocation graph. (6 pts.) (b) Is there any deadlock in this situation? Briefly Explain. Which if any of the processes are deadlocked in this state? What is a possible order of completion if no deadlock exists? (6 pts.) (a) the resource allocation grap is: R1 P1 P3 R2 P2 P4 R3 (b) NO! Although one cycle exist in the system P2 R2 P4 R3, There is a free resource of type R1 and R3. P1 and P3 can acquire one unit each of R1 and R3 and can finish. P4 can acquire one unit of R3 and can finish. P4 releases a unit of R2. Then P2 can acquire one unit of R2 and can finish. And so on. Hence there is no deadlock. Same possible safe orders are: P1 P3 P4 P2, P4 P2 P3 R1 etc.

Page 7 of 8 ITEC202 Operating Systems, Midterm Exam Question 5. Deadlock - Banker s Algorithm (16 pts.) A system that uses the Banker's Algorithm has six processes and four types of reusable resources (R1, R2, R3 and R4). The current allocation, maximum needs (claims) and available resources are as shown below. Allocation Matrix (A) Claim Matrix (C) Available Vector (V) Process R1 R2 R3 R4 R1 R2 R3 R4 R1 R2 R3 R4 P1 1 0 0 0 3 2 1 4 0 2 3 3 P2 1 2 2 0 1 4 5 2 P3 2 1 3 0 4 2 4 5 P4 1 4 1 0 6 6 1 0 P5 1 2 0 1 2 3 1 3 P6 1 4 3 1 2 4 4 1 Calculate the Needs matrix (Q) and then determine if this is a safe state? If so, give a sequence in which the processes can be serviced. If it is not a safe state then list the processes which are deadlocked. Show all your work and the content of available vector in each step clearly! First, P2 runs to completion then, V=[0 2 3 3] + [1 2 2 0] =[1 4 5 3] Next, P5 runs to completion then, V=[ 1 4 5 3]+ [1 2 0 1] =[2 6 5 4] Next, P1 runs to completion then, V=[ 2 6 5 4]+ [1 0 0 0] =[3 6 5 4] Next, P6 runs to completion then, Needs Matrix (Q) R1 R2 R3 R4 P1 2 2 1 4 P2 0 2 3 2 P3 2 1 1 5 P4 5 2 0 0 P5 1 1 1 2 P6 1 0 1 0 V=[ 3 6 5 4]+ [1 4 3 1] =[4 10 8 5] Next, P3 runs to completion then, V=[ 4 10 8 5]+ [2 1 3 0] =[6 11 11 5] Next, P4 runs to completion then, V=[ 6 11 11 5]+ [1 4 1 0] =[7 15 12 5] All processes can run to completion with these available recourses. The processes can be serviced as P2 P5 P1 P6 P3 P4; hence this is a safe state.

Page 8 of 8 ITEC202 Operating Systems, Midterm Exam Question 6. Process Synchronization Message Passing (10 pts.) Use message passing to synchronize processes A, B, C, D, and E so that process A must finish before B or C starts, process B must finish before D starts, process C and D must finish before E starts. Draw a diagram to represent the relations among processes. Use the notation send(mbox,msg) and receive(mbox,msg) to write your solution. The relations among processes can be represented in the following diagrams. A mbox 1 B mbox 2 D C mbox 3 E The program can be as follows: Process A: - do work of A send(mbox1, msga) /* Let B/C start */ send(mbox1, msga) /* Let B/C start */ Process B: read(mbox1, msga); /* Block until A is finished */ - do work of B send(mbox2, msgb); /* Let D start */ Process C: read(mbox1, msga); /* Block until A is finished */ - do work of C send(mbox3, msgc); /* Let C start */ Process D: read(mbox2, msgb) /* Block until B is finished */ - do work of D send(mbox3, msgd); /* Let E start */ Process E: read(mbox3, msgc); /* Block until C is finished */ read(mbox3, msgd); /* Block until D is finished */ - do work of E