time are in milliseconds. Compute the average turnaround time for the system taking pre-emptive shortest job first (SJF) algorithm.

Similar documents
King Saud University. College of Computer & Information Sciences. Information Technology Department. IT425: Operating Systems.

CPU Scheduling Algorithms

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

Properties of Processes

Chapter 5: CPU Scheduling

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

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

Chapter 6: CPU Scheduling

OS Assignment II. The process of executing multiple threads simultaneously is known as multithreading.

CPU scheduling. Alternating sequence of CPU and I/O bursts. P a g e 31

MC7204 OPERATING SYSTEMS

CPU Scheduling: Part I ( 5, SGG) Operating Systems. Autumn CS4023

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

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

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

1.1 CPU I/O Burst Cycle

Ch 4 : CPU scheduling

CSE 120 Principles of Operating Systems Spring 2017

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

8: Scheduling. Scheduling. Mark Handley

CPU Scheduling. CSE 2431: Introduction to Operating Systems Reading: Chapter 6, [OSC] (except Sections )

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

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

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

Operating System Concepts Ch. 5: Scheduling

INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad COMPUTER SCIENCE AND ENGINEERING QUESTION BANK OPERATING SYSTEMS

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

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

LECTURE 3:CPU SCHEDULING

Last Class: Processes

CHAPTER 2: PROCESS MANAGEMENT

COMP 3361: Operating Systems 1 Midterm Winter 2009

INSTITUTE OF AERONAUTICAL ENGINEERING

COMP 3361: Operating Systems 1 Final Exam Winter 2009

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

CPU THREAD PRIORITIZATION USING A DYNAMIC QUANTUM TIME ROUND-ROBIN ALGORITHM

Scheduling. The Basics

Course Syllabus. Operating Systems

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

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


Unit 3 : Process Management

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

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

Chap 7, 8: Scheduling. Dongkun Shin, SKKU

CPU Scheduling. Rab Nawaz Jadoon. Assistant Professor DCS. Pakistan. COMSATS, Lahore. Department of Computer Science

CSE 421/521 - Operating Systems Fall Lecture - VII CPU Scheduling - II. University at Buffalo

International Journal of Advanced Research in Computer Science and Software Engineering

CSE 4/521 Introduction to Operating Systems

Chapter 5 CPU scheduling

Scheduling of processes

CLASS: II YEAR / IV SEMESTER CSE SUBJECT CODE AND NAME: CS6401 OPERATING SYSTEMS UNIT I OPERATING SYSTEMS OVERVIEW

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

Process Scheduling. Copyright : University of Illinois CS 241 Staff

Topic 4 Scheduling. The objective of multi-programming is to have some process running at all times, to maximize CPU utilization.

SNS COLLEGE OF ENGINEERING

An Improved Priority Dynamic Quantum Time Round-Robin Scheduling Algorithm

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

Midterm Exam Solutions March 7, 2001 CS162 Operating Systems

Operating Systems Unit 3

FCM 710: Architecture of Secure Operating Systems

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

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

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

Chapter 5: CPU Scheduling

Example: CPU-bound process that would run for 100 quanta continuously 1, 2, 4, 8, 16, 32, 64 (only 37 required for last run) Needs only 7 swaps

COSC243 Part 2: Operating Systems

Lecture 2 Process Management

1. CPU utilization: it is the percentage of time the CPU is used for a specific time period ones want to keep the CPU as busy as possible (Max.

CSL373: Lecture 6 CPU Scheduling

Job Scheduling. CS170 Fall 2018

T.Y. Diploma : Sem. V [CO/CM/IF] Operating System

Last class: Today: CPU Scheduling. CPU Scheduling Algorithms and Systems

CS3733: Operating Systems

CS370 Operating Systems

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

Start of Lecture: February 10, Chapter 6: Scheduling

Midterm Exam. October 20th, Thursday NSC

QUESTION BANK UNIT I

CPU Scheduling (1) CPU Scheduling (Topic 3) CPU Scheduling (2) CPU Scheduling (3) Resources fall into two classes:

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

Chapter 6: CPU Scheduling

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

Process behavior. Categories of scheduling algorithms.

Advanced Operating Systems (CS 202) Scheduling (1)

Announcements/Reminders

CS4411 Intro. to Operating Systems Exam 2 Fall 2009

CPU Scheduling. Schedulers. CPSC 313: Intro to Computer Systems. Intro to Scheduling. Schedulers in the OS

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

A COMPARATIVE STUDY OF CPU SCHEDULING POLICIES IN OPERATING SYSTEMS

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT-1

Practice Exercises 305

CS630 Operating System Design, First Exam, Spring 2017,

Frequently asked questions from the previous class survey

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

CHAPTER NO - 1 : Introduction:

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

8th Slide Set Operating Systems

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

3. CPU Scheduling. Operating System Concepts with Java 8th Edition Silberschatz, Galvin and Gagn

Transcription:

Roll Number: Thapar University Patiala Computer Science & Engineering Department B.E 2 nd Yr. 1 st Semester CSE UCS303: Operating System MST, 19 th September 2017 Maximum Marks: 20 Time: 2 Hrs. Name of Faculty: Vinay, Tarunpreet, Ashish, Santosh, Raman Note: All Questions are Compulsory; Attempt in a SEQUENTIAL ORDER; Assume data from your side (if found missing). Q.1 a. Consider a system with the following set of processes, where arrival time and CPUburst time are in milliseconds. Compute the average turnaround time for the system taking pre-emptive shortest job first (SJF) algorithm. (2+2) Process Arrival Time Burst Time P 1 0 5 P 2 1 3 P 3 2 3 P 4 4 1 b. Consider three processes, all arriving at time zero, with total execution time (CPU and I/O) of 10, 20 and 30 units, respectively. Each process spends the first 20% of execution time doing I/O, the next 70% of time doing computation, and the last 10% of time doing I/O again. The operating system uses a SJF scheduling algorithm and schedules a new process either when the running process gets blocked on I/O or when the running process finishes its compute burst. Assume that all I/O operations can be overlapped as much as possible. For what percentage of time does the CPU remain idle? Q.2 a. Explain the role of MBR and POST in context of the steps that a computer follows after getting the power supply. (2+2) b. With a suitable diagram, comment on the statement, Multi-tasking is an expansion of multi-programming. Q.3 a. With a suitable depiction, explain multi-threading models. (2+2) b. List Pros and Cons of Microkernel-based architecture and Layered approach for designing an operating system. Q.4 a. Consider the following snapshot of a system with four processes A, B, C, and D. Compute the average waiting time for the Round Robin scheduling, where quantum is taken as 1ms. (2+2) Process A B C D Arrival Time (in ms) 0.000 2.001 3.001 3.002 CPU Burst (in ms) 4 7 2 2 b. Explain the statement with proper justification: In operating systems, the context switching represents a substantial cost to the system in terms of CPU time. P.T.O.

Q.5 Consider a system with 4 processes and 5 resource classes. At a particular time t 0, the snapshot for the various data structures involved in the system are as shown in the table below: Allocation MAX Available Process P 0 P 1 P 2 P 3 ABCDE ABCDE ABCDE 10211 11213 00X11 20110 22210 11011 21311 11110 11221 (4) a. Compute the smallest value of X for which the system is in safe state. Write the safe sequence too. b. After computing the values for X above, assume that a request of (00110) resources from P 3 arrives in the system. Describe by showing the values of various datastructures, the feasibility for granting the said request immediately. c. (This is in continuation of part b above) Now, comment on the feasibility for granting the request of (00001) resources initiated by P 0. d. Give the count for the total (maximum) available instances of all the resource classes present in the system. Solution 1: a) SOLUTIONS (TENTATIVE) b)

Marking Scheme for Solution 1 (Vinay Arora): a) GANTT Chart 0.5, Proper calculations for TAT 01, Final Avg. TAT 0.5 b) Matrix or Graphical representation for Burst Time / IO Time 01, Proper calculations for Idle time and total execution time 0.5, Percentage Idle time 0.5 Solution 2: a)

b) Multi tasking: Multitasking is the logical extension of multiprogramming.the concept of multitasking is quite similar to multiprogramming but difference is that the switching between jobs occurs so frequently that the users can interact with each program while it is running. This concept is also known as time-sharing systems. A time-shared operating system uses CPU scheduling and multiprogramming to provide each user with a small portion of time-shared system. Marking Scheme for Solution 2: a) Full form of MBR / correct description of MBR 1 mark Full form of POST / correct description of POST 1mark b) Description of time slices for making systems interactive in multi-tasking 1.5 marks Diagram showing switching between processes. 0.5 marks Solution 3: a)

b) Microkernal-based The main function of the microkernel is to provide a communication facility between the client program and the various services that are also running in user space. Communication is provided by message passing. For example, if the client program and service never interact directly. Rather, they communicate indirectly by exchanging messages with the microkernel. On benefit of the microkernel approach is ease of extending the operating system. All new services are added to user space and consequently do not require modification of the kernel. When the kernel does have to be modified, the changes tend to be fewer, because the microkernel is a smaller kernel. The resulting operating system is easier to port from one hardware design to another. Disadvantages in the microkernel exist however. A few examples are: Larger running memory footprint More software for interfacing is required, there is a potential for performance loss. Messaging bugs can be harder to fix due to the longer trip they have to take versus the one off copy in a

monolithic kernel. Process management in general can be very complicated. Layered-approach A system can be made modular in many ways. One method is the layered approach, in which the operating system is broken up into a number of layers (levels). The bottom layer (layer 0) id the hardware; the highest (layer N) is the user interface. The main advantage of the layered approach is simplicity of construction and debugging. The layers are selected so that each uses functions (operations) and services of only lower-level layers. This approach simplifies debugging and system verification. A final problem with layered implementations is that they tend to be less efficient than other types. For instance, when a user program executes an I/O operation, it executes a system call that is trapped to the I/O layer, which calls the memory-management layer, which in turn calls the CPU-scheduling layer, which is then passed to the hardware. At each layer, the parameters may be modified; data may need to be passed, and so on. Each layer adds overhead to the system call; the net result is a system call that takes longer than does one on a non-layered system. These limitations have caused a small backlash against layering in recent years. Fewer layers with more functionality are being designed, providing most of the advantages of modularized code while avoiding the difficult problems of layer definition and interaction. Marking Scheme for Solution 3: a) A bit about model with diagram and no explanation 1 mark; if appended with a bit of explanation 1.5 marks, whereas, with elaboration 2 marks. b) More than two pros cons of both the models 2 marks, Only two pros cons 1.5 marks, and with less than two pros cons 1 mark; 0.5 mark for giving just a general idea. Solution 4: a) b) Context switching indulge unnecessary time for saving and loading the context of processes that are needed

to be thrown out from the RAM and loaded into the RAM respectively. Marking Scheme for Solution 4: a) Gantt Chart 1 + waiting time 0.5 (each process) and avg. waiting time 0.5 (total 2 marks) b) Context switching 0.5+ why it incurs cost 1 + diagram 0.5 (total 2 marks) Solution 5: a) The smallest value is x = 2. The order of finishing is P 3 P 2 P 1 P 0 or P 3 P 2 P 0 P 1. Process Allocated Maximum Need P 0 P 1 P 2 P 3 ABCDE ABCDE ABCDE 10211 11213 01002 20110 22210 02100 11011 21311 10300 11110 11221 00111 FIRST, let us show that the problem is not safe when x = 1: only P 3 can finish. The available vector is now (1 1 2 2 1). But then no other process can finish. NEXT, if x = 2, then we can can again let P 3 finish first. Then the available vector is (1 1 3 2 1). Now Process P 2 can finish, and the available vector becomes (2 2 3 3 2). Now both P 1 or P 0 can finish (in either order). b) Can be granted immediately Process P 0 P 1 P 2 P 3 Allocated Maximum Need ABCDE ABCDE ABCDE 10211 11213 01002 20110 22210 02100 11011 21311 10300 11220 11221 00001 Available is 00101 The order of finishing is P 3 P 2 P 1 P 0 or P 3 P 2 P 0 P 1. c) New Available is 00101-00001=00100 Process Allocated Maximum Need ABCDE ABCDE ABCDE

P 0 P 1 P 2 P 3 10212 20110 11011 11220 11213 22210 21311 11221 01001 02100 10300 00001 Deadlock is there d) Max resources = 52653 Marking Scheme for Solution 5 (Tarunpreet Bhatia): a. 0.5 mark for X=2 and 0.5 mark for correct sequence P 3 P 2 P 1 P 0 or P 3 P 2 P 0 P 1. b. 0.25 mark for correct values of data structures Need, Allocation and Available, 0.25 mark for Yes request is feasible, 0.5 mark for showing safe sequence after the request is granted. c. 0.25 mark for request should not be granted, 0.75 mark for correct explanation as Available = 00100. d. 0.25 mark for first two correct entries A and B, 0.5 mark for C=6, 0.25 mark for correct values of D and E.