COMP 3361: Operating Systems 1 Final Exam Winter 2009

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

COMP 3361: Operating Systems 1 Midterm Winter 2009

Main Points of the Computer Organization and System Software Module

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

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

MC7204 OPERATING SYSTEMS

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

QUESTION BANK UNIT I

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

Final Exam Preparation Questions

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

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

COMP SCI 3SH3: Operating System Concepts (Term 2 Winter 2006) Test 2 February 27, 2006; Time: 50 Minutes ;. Questions Instructor: Dr.

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT I

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

CS 537 Fall 2017 Review Session

CSI3131 Final Exam Review

Operating Systems (1DT020 & 1TT802)

CSE 120 PRACTICE FINAL EXAM, WINTER 2013

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

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

CHAPTER NO - 1 : Introduction:

Exam Guide COMPSCI 386

CSE 421/521 - Operating Systems Fall Lecture - XXV. Final Review. University at Buffalo

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

Course Description: This course includes the basic concepts of operating system

1. a. Show that the four necessary conditions for deadlock indeed hold in this example.

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

SNS COLLEGE OF ENGINEERING

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

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

King Fahd University of Petroleum and Minerals. Write clearly, precisely, and briefly!!

Unit In a time - sharing operating system, when the time slot given to a process is completed, the process goes from the RUNNING state to the

PESIT SOUTHCAMPUS. Question Bank

Delhi Noida Bhopal Hyderabad Jaipur Lucknow Indore Pune Bhubaneswar Kolkata Patna Web: Ph:

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

Midterm Exam Amy Murphy 6 March 2002

Midterm Exam. October 20th, Thursday NSC

EECE.4810/EECE.5730: Operating Systems Spring 2017 Homework 3 Solution

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

INSTITUTE OF AERONAUTICAL ENGINEERING

OPERATING SYSTEMS. Sharafat Ibn Mollah Mosharraf TOUCH-N-PASS EXAM CRAM GUIDE SERIES. Students. Special Edition for CSEDU

Operating Systems (Classroom Practice Booklet Solutions)

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

This exam paper contains 8 questions (12 pages) Total 100 points. Please put your official name and NOT your assumed name. First Name: Last Name:

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

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

Example Sheet for Operating Systems I (Part IA)

Fall COMP3511 Review

Scheduling of processes

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

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

Operating System Review Part

OPERATING SYSTEMS FINAL EXAMINATION APRIL 30, 2006 ANSWER ALL OF THE QUESTIONS BELOW.

EECE.4810/EECE.5730: Operating Systems Spring Midterm Exam March 8, Name: Section: EECE.4810 (undergraduate) EECE.

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

SYED AMMAL ENGINEERING COLLEGE CS6401- OPERATING SYSTEM

Distributed Deadlock Detection

Example Sheet for Operating Systems I (Part IA)

To Everyone... iii To Educators... v To Students... vi Acknowledgments... vii Final Words... ix References... x. 1 ADialogueontheBook 1

Process Scheduling. Copyright : University of Illinois CS 241 Staff

CSE 4/521 Introduction to Operating Systems. Lecture 27 (Final Exam Review) Summer 2018

1.1 CPU I/O Burst Cycle

Chapter 5: CPU Scheduling

OPERATING SYSTEMS ECSE 427/COMP SECTION 01 WEDNESDAY, DECEMBER 7, 2016, 9:00 AM

MARUTHI SCHOOL OF BANKING (MSB)

Review. Preview. Three Level Scheduler. Scheduler. Process behavior. Effective CPU Scheduler is essential. Process Scheduling

CS6401- Operating System QUESTION BANK UNIT-IV

Last Class: Processes

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

CSE 153 Design of Operating Systems

Architectural Support. Processes. OS Structure. Threads. Scheduling. CSE 451: Operating Systems Spring Module 28 Course Review

File. File System Implementation. Operations. Permissions and Data Layout. Storing and Accessing File Data. Opening a File

Chendu College of Engineering & Technology

CPU Scheduling Algorithms

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

FCM 710: Architecture of Secure Operating Systems

Announcements. Final Exam. December 10th, Thursday Patrick Taylor Hall. Chapters included in Final. 8.

Operating Systems. Process scheduling. Thomas Ropars.

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

Unit 3 : Process Management

CS4411 Intro. to Operating Systems Final Fall points 10 pages

OPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5

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

1. Consider the following page reference string: 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6.

Scheduling. The Basics

EECS 482 Introduction to Operating Systems

Course Syllabus. Operating Systems

Final Review. Quiz-5 Solutions. Tevfik Koşar

Operating Systems. Operating Systems Professor Sina Meraji U of T

Computing Science 300 Sample Final Examination

* What are the different states for a task in an OS?

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

2 nd Half. Memory management Disk management Network and Security Virtual machine

CPU Scheduling CHAPTER. Exercises


CSL373: Lecture 6 CPU Scheduling

1. [Lock, Monitor and Deadlock: 5 Lectures (=26%)] 16 Marks [ ]

Indian Institute of Technology, Kharagpur

UNIT I OVERVIEW OF OPERATING SYSTEMS

Transcription:

COMP 3361: Operating Systems 1 Final Exam Winter 2009 Name: Instructions This is an open book exam. The exam is worth 100 points, and each question indicates how many points it is worth. Read the exam from start to finish and allocate your time wisely. That is, do not spend a lot of time trying to answer a question that is only worth a few points. If you think any question is ambiguous, make and state a reasonable assumption. Answer all questions on this exam paper. Please make sure your writing and diagrams are legible. 1 of 14

1. (10 points) Consider a demand-paging system in which processes are performing sequential data accesses with the following time-measured utilizations: CPU utilization 20% Paging disk 98% Other I/O devices 10% For each of the following, indicate yes or no to say whether or not it will (or is likely to) improve CPU utilization: a. Install a faster CPU b. Install a bigger paging disk. c. Increase the degree of multiprogramming. d. Decrease the degree of multiprogramming. e. Install more main memory. f. Install a faster hard disk. g. Install multiple controllers with multiple hard disks and stripe the data across the disks. h. Add prepaging (prefetching0 to the page-fetch algorithms. i. Increase the page size. j. Increase the I/O bus speed. 2 of 14

2. (10 points) Consider a system with 3 physical frames of memory that is given the following page memory reference sequence: 1, 3, 6, 7, 1, 3, 6, 7, 1, 3, 6, 7 What is the number of page faults that would occur for each of the following page replacement algorithms? a. An optimal page replacement algorithm b. LRU c. Does an optimal page replacement algorithm exist that does not require future knowledge for cyclical memory reference sequences such as shown above? If so, give a general algorithm. If not, explain why. 3 of 14

3. (20 points) A file is stored on a LOOK scheduled disk system. The disk is 1 MB in size and has disk blocks of size 1 KB. The file is stored in sequential order in 4 disk blocks: 20, 500, 10, and 900. The last disk access was to block 51 and the directory entry for the file is stored in block 50. The first disk block is numbered block 0. A single block disk cache is present. a. Suppose a linked disk allocation method is used. What is the total seek distance for reading the entire file from beginning to end? b. Suppose a FAT allocation method is used in which the FAT is stored at the beginning of the disk and each FAT entry is 2 bytes. What is the total seek distance for appending and storing data in disk block 600 at the end of the file? c. If a C-SCAN disk scheduler is used in part b, what is the total seek distance? d. Suppose an indexed disk allocation method is used and the index block contains 1 byte direct entries. If the index is stored in block 55, what is the total seek distance for reading the entire file from beginning to end? e. Suppose an indexed disk allocation method is used and the index block contains 1 byte direct entries. If the disk contains 100 files, what is the maximum size file possible (in bytes)? 4 of 14

4. (20 points) Suppose there are four processes (P1 - P4) with respective arrival times of 0, 10, 20, and 40, priorities 1, 2, 3, and 4, and job times of 30, 20, 50, and 20 ms. These processes are scheduled from a single run queue to run on a dual-processor machine. a. Suppose the context switch overhead is 1 ms. What is the average turnaround time for scheduling the four processes using the following preemptive schedulers: priority (highest-priority-first, use 1 as the hightest priority), round-robin, or shortest-job-first? For round-robin, assume a 20 ms time quantum. 5 of 14

5. (15 points) Synchronization. Imagine I have a bank account, which is shared among multiple people. The bank supports all transactions in software, and therefore defines a class to represent the bank account, which can be accessed by a thread. Each thread can represent a person, and therefore transactions can occur concurrently. The bank has tried to use synchronization primitives to guard access to shared variables and critical sections. For example, the method to update the bank account balance, can be modified by any thread. For the code below, describe why it does not properly implement the updatebalance() method, and give a sequence of instructions that shows how it is broken. class BankAccount { Lock lock = new Lock(); Condition cv = new Condition(lock); int numusers = 0; int balance = INIT BALANCE; void updatebalance(int amount) { while (numusers!= 0) cv.sleep(); numusers++; balance = balance + amount; numusers--; cv.wakeall(); } } 6 of 14

6. (10 points) File Systems and Disk. (a) In many Unix systems, the inodes are kept at the start of the disk. An alternative design is to allocate an inode when a file is created and put the inode at the start of the first block of the file. Discuss the pros and cons of this alternative. (b) Consider a disk with a sector size of 512 bytes, 100 sectors per track. Given a rotational speed of 7200 revolutions per minute, what is the maximum rotational delay to the start of a sector? Assuming that one track of data can be transferred per revolution, what is the transfer rate? 7 of 14

7. (5 points) Compare I/O based on polling with interrupt-driven I/O. In what situation would you favor one technique over the other? 8. (10 points) Deadlock Detection Is the following system of four processes with 2 resources deadlocked? Current allocation matrix P1 1 3 P2 4 1 P3 1 2 P4 2 0 Current request matrix P1 1 2 P2 4 3 P3 1 7 P4 5 1 Availability Vector 1 4 If the availability vector is as below, is the system above still deadlocked? 2 3 Is the system deadlocked if the availability is 2 4 8 of 14

9. (15 points) System Reliability When an operating system crashes, it often leaves the data that it stores on the disk in an inconsistent state. By inconsistent state, we mean that file system data structures do not correctly describe what should be in the files, directories, descriptors, and free lists. This can happen because it takes several disk reads and writes to update a file, its descriptors, and the free list. When the system comes up, it is necessary to validate that the file system and its data structures are all right (or figure out how to fix them). A) With an allocation scheme based on block pointers and a free block list (such as that used in UNIX), is it possible to tell, after a crash, if a given block that is on the free list should not be? If so, how? If not, why not? B) With an allocation scheme based on block groups and a free block bit map (such as that used in DEMOS), is it possible to tell, after a crash, if a block that is marked ``free'' in the bit-map should not be? If so, how? If not, why not? C) Suppose we know that a disk block appears both in the free list/map and in a file. Is there some action we could safely take? (I.e., we do not want to make matters any worse, and would like to make them better). If so, what? If not, why not? D) Suppose we know that a disk block appears in two files at the same time. Is there some action we could safely take? If so, what? If not, why not? 9 of 14

10. (10 points) RAID Systems Could a RAID Level 1 organization achieve better performance for read requests than a RAID Level 0 organization (with nonredundant striping of data)? If so, how? Consider a RAID Level 5 organization comprising five disks, with the parity for sets of four blocks on four disks stored on the fifth disk. How many blocks are accessed in order to perform the following? a. A write of one block of data b. A write of seven continuous blocks of data 10 of 14

11. (10 points) Resource Allocation Graphs A system is composed of four processes, p1 through p4, and three types of consumable resources, R1 through R3. There is one unit each of R1 and R3 available. p1 requests a unit of R1 and a unit of R2. p2 produces a unit of R1 and a unit of R2 and requests one unit of R3. p3 requests a unit of R1 and a unit of R2. p4 produces a unit of R2 and requests one unit of R3. Show the resource allocation graph to represent the system state. Which, if any, of the processes are deadlocked in this state? Can the deadlock be avoided by some sequence of execution of the processes? 11 of 14

12. (10 points) Space Partition Given memory partitions of 100 KB, 500 KB, 200 KB, 300 KB, and 600 KB (in order), how would each algorithm place processes of size 212 KB, 417 KB, 112 KB, and 426 KB (in order)? Explain for each algorithm, where each of the processes are placed in the memory. a) First-fit b) Best-fit c) Worst-fit Which algorithm makes the most efficient use of memory? 12 of 14

13. (15 points) File System Implementation Suppose a file system is constructed using blocks of 8 words each. In this system, a word has a length of 4 bytes. The disk pack used to hold the file system consists of 32 blocks. The initial block (block 0) contains a directory entry. The directory entry contains the filename of a single file in this file system, and a pointer to the first I-node in block 1. The I-node structure is as follows (word, value): 0 Permission word 1 File Size 2 Direct block 3 Direct block 4 Direct block 5 Direct block 6 Single-indirect 7 Double-indirect The file contains 16 words of data: the first direct index points at block 31, and the second direct index points at block 29. Blocks 4,7,10,and 15 are marked bad. Assume that free blocks are allocated in logical order starting with block 0 and that write operations modify the file system 1 block at a time. What will the state of the system look like after 100 additional words are appended to the file (draw a block diagram showing the structure of the I-node and the blocks that are allocated) 13 of 14

14. (15 points) Miscellaneous Which is not able to solve the race condition? (A) Test and Set Lock (B) Shared memory (C) Semaphore (D) Monitor CPU Scheduling algorithms are used for: (A) Picking one of the ready processes in main memory to run next (B) Putting to sleep and waking up processes in an efficient manner (C) Allocating memory to the processes in a fair and efficient way (D) None of the above Which is not a CPU scheduling criterion? (A) CPU utilization (B) Throughput (C) Waiting time (D) Burst time Which is not the necessary condition of a deadlock? (A) Mutual exclusion (B) Hold and wait (C) Preemption (D) None of the above A computer provides the user with virtual address space of 2^24 words. Pages of size 4096 (2^12) words If the hexadecimal virtual address is 123456, the page number in hexadecimal would be: (A) 123 (B) 1234 (C) 456 (D) 3456 Which file allocation method suffers from disk fragmentation (except for internal fragmentation in the last block)? (A) Linked list allocation (B) Contiguous allocation (C) I-nodes (D) None of the above A piece of code which lies dormant until triggered by by some event causing system damage is called: (A) Logic bomb (B) Trap door (C) Virus (D) Worm The modified (dirty) bit is used for the purpose of: (A) Dynamic allocation of memory used by one process to another (B) Implementing FIFO page replacement algorithm (C) To reduce the average time required to service page faults (D) None of the above Which is a preemptive scheduling? (A) SJF (B) FCFS (C) RR (D) None of the above Describe and justify at least three major advantages of distributed file systems (compared to nondistributed file systems). Describe at least two potential problems that affect distributed file systems (compared to nondistributed file systems). 14 of 14