CS4411 Intro. to Operating Systems Final Fall points 12 pages

Similar documents
CS4411 Intro. to Operating Systems Final Fall points 10 pages

CS4411 Intro. to Operating Systems Exam 2 Fall 2009

CS4411 Intro. to Operating Systems Exam 1 Fall points 10 pages

CS4411 Intro. to Operating Systems Exam 1 Fall points 9 pages

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

Final Exam Preparation Questions

MC7204 OPERATING SYSTEMS

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

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

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

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

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT I

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

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

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

SYED AMMAL ENGINEERING COLLEGE CS6401- OPERATING SYSTEM

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

CS630 Operating System Design, Second Exam, Fall 2014

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

QUESTION BANK UNIT I

COMP 3361: Operating Systems 1 Final Exam Winter 2009

University of Waterloo Midterm Examination Model Solution CS350 Operating Systems

Q 1. (10 Points) Assume that a process executes the following pseudo codes:

Distributed Deadlock Detection

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

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

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

CS Operating system

Chendu College of Engineering & Technology

CS630 Operating System Design Second Exam, Spring 2015,

CSE 120 PRACTICE FINAL EXAM, WINTER 2013

PESIT SOUTHCAMPUS. Question Bank

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

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

Exam Guide COMPSCI 386

SNS COLLEGE OF ENGINEERING

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

Question Points Score Total 100

CSI3131 Final Exam Review

Fall COMP3511 Review

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

Main Points of the Computer Organization and System Software Module

1993 Paper 3 Question 6

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

CSE 120 Principles of Operating Systems

Practice Exercises 449

CSE 451 Midterm Exam May 13 th, 2009

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:

Student Name: University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Science

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

Where are we in the course?

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

Virtual Memory. Chapter 8

Virtual Memory. Virtual Memory. Demand Paging. valid-invalid bit. Virtual Memory Larger than Physical Memory

CS370 Operating Systems

Operating Systems. No. 9 ศร ณย อ นทโกส ม Sarun Intakosum

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science

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.

Final Exam April 14, 2007 COSC 3407: Operating Systems

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science

Problem Max Points Score Total 100

INSTITUTE OF AERONAUTICAL ENGINEERING

MEMORY: SWAPPING. Shivaram Venkataraman CS 537, Spring 2019

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

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

Operating Systems (1DT020 & 1TT802)

Final Review. Geoffrey M. Voelker. Final mechanics Memory management Paging Page replacement Disk I/O File systems Advanced topics

CS350: Final Exam Review

Roll No. :... Invigilator's Signature :.. CS/B.TECH(CSE/IT)/SEM-5/CS-501/ OPERATING SYSTEM. Time Allotted : 3 Hours Full Marks : 70

Second Midterm Exam March 21, 2017 CS162 Operating Systems

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

CS 4410 Operating Systems. Review 1. Summer 2016 Cornell University

b. How many bits are there in the physical address?

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

CS370 Operating Systems

CSCI 4210 Operating Systems CSCI 6140 Computer Operating Systems Sample Final Exam Questions (document version 1.0) WITH SELECTED SOLUTIONS

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

CPSC/ECE 3220 Summer 2017 Exam 2

SPOS MODEL ANSWER MAY 2018

CS153: Final Review1. Chengyu Song. Slides modified from Harsha Madhyvasta, Nael Abu-Ghazaleh, and Zhiyun Qian

Sections 01 (11:30), 02 (16:00), 03 (8:30) Ashraf Aboulnaga & Borzoo Bonakdarpour

2.c Concurrency Mutual exclusion & synchronization mutexes. Unbounded buffer, 1 producer, N consumers

Module 9: Virtual Memory

Institute of Engineering & Management. Course:CS603- Operating System. Course pre-requisites

CS6401- Operating System QUESTION BANK UNIT-IV

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

Ph.D. Programme in Computer Science. Model Question Paper RESEARCH APTITUDE ASSESSMENT TEST. Time : 2 Hours Max. Marks : 75

Semaphores. A semaphore is an object that consists of a. methods (e.g., functions): signal and wait. semaphore. method signal. counter.

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

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Science

Operating Systems EDA092, DIT 400 Exam

Chapter 8 & Chapter 9 Main Memory & Virtual Memory

Introduction to Virtual Memory Management

(VERSION WITH ANSWERS) CORE EXAMINATION Department of Computer Science New York University September 26, 2008

CSCI 346 Final Exam Review Materials

May 19, Answer pieces in italics were not required to receive full points.

Stanford University Computer Science Department CS 140 Midterm Exam Dawson Engler Winter 1999

Demand Paging. Valid-Invalid Bit. Steps in Handling a Page Fault. Page Fault. Transfer of a Paged Memory to Contiguous Disk Space

CHAPTER NO - 1 : Introduction:

Chapter 9: Virtual-Memory

Transcription:

CS44 Intro. to Operating Systems Final Exam Fall 5 CS44 Intro. to Operating Systems Final Fall 5 points pages Name: Most of the following questions only require very short answers. Usually a few sentences would be sufficient. Please write to the point, however. If I don t understand what you are saying, I believe, for most of the cases, you don t understand the subject. Justify your answer with a convincing argument. If there is no justification when it is needed, you will receive no credit for that question even though you have provided a correct answer. I consider a good and correct justification more important than a right answer. Repeated problems are marked with asterisks, and will be graded with the all-or-nothing policy. If you made any mistakes, you receive no credits. Except for the last two problems which are programming related, all problems test if you have understood the basic concepts and can be answered quickly. Please go through all problems once and do those you know how to do first. The programming related problems are easy, if you understand the merit of channels and semaphores.

CS44 Intro. to Operating Systems Final Exam Fall 5. Threads and Synchronization (a) [8 points] What is thread cancelation? Define the term and discuss the two commonly used versions and their differences. (b) [8 points] A good solution to the critical section problem must satisfy three conditions: mutual exclusion, progress and bounded waiting. Explain the meaning of the progress condition. Does starvation violate the progress condition? Why? Note that there are two problems. For each problem, you should provide a clear answer with convincing argument. Otherwise, you will receive no credit.. CPU Scheduling (a) [8 points] What are preemptive and non-preemptive scheduling policies? Elaborate your answer.

CS44 Intro. to Operating Systems Final Exam Fall 5 (b) [8 points] What is priority inversion? How could it happen? How can it be overcome? Note that there are three questions here.. Deadlock (a) [8 points] Consider a system consisting of four resources of the same type that are shared by three processes, each of which needs at most two resources. Show that the system is deadlock free. (b) [8 points] A system has four processes P, P, P and P 4, and two resource types R and R, each of which has two instances. Suppose further P is requesting an instance of R and allocated an instance of R, P is allocated an instance of R, P is requesting an instance of R and allocated an instance of R, and P 4 is allocated an instance of R. Do the following two problems: () Draw the resource-allocation graph, and () Does this system have a deadlock? Only providing an answer and/or vague elaboration will receive no credit.

CS44 Intro. to Operating Systems Final Exam Fall 5 4 4. Memory Management (a) [8 points] A system has 8 page frames and each process has a page table of four entries in which a indicates the corresponding page is not in physical memory. Suppose a snapshot of the page tables at certain moment is shown below: Process Process Process 5 Convert the content of these three page tables to an inverted page table below. Inverted Page Table 4 5 6 7 4 (b) [ points] Let the page size be 4K. Each page table has four entries. Suppose we have the following two-level page tables in which only page frame numbers are shown, where an means the corresponding entry is not in physical memory. 4 6 5 8 7 6 Translate the following virtual addresses to the corresponding physical addresses (in decimal). Fill in the table with your answers. Please only fill the table entries with decimal values. Expressions are not acceptable. Virtual Addr. st level page # nd level page # Offset Page frame # Physical Addr. 46, 58, 5. Page Replacement Algorithms Let the page reference string be,,, 4,,, 5,,,,, 4. The computer on which this page reference string is run has three page frames. Run this page reference string with the LRU and the Optimal algorithms. Initially, the memory is empty. Give the content after each reference and compute the number of page faults, miss ratio and hit ratio. You should circle those pages that cause page faults.

CS44 Intro. to Operating Systems Final Exam Fall 5 5 (a) [ points] LRU algorithm: Page 4 5 4 Memory Page faults Miss ratio Hit ratio (b) [ points] The Optimal algorithm: Page 4 5 4 Memory Page faults Miss ratio Hit ratio (c) [ points] Working set of window size θ =: Page 4 5 4 Memory (d) [8 points] Suppose the CLOCK page-replacement algorithm is used to approximate the LRU algorithm. Currently a system has six page frames with RM (Reference/Modified) bits as shown below (i.e., the first and second bits are the reference and modified bits, respectively): A B F C E D If the clock pointer is at the page frame as shown and a page fault occurs, after running the CLOCK algorithm, what are the new RM bits? Which page frame will be selected as a victim? Is a page-out required in this case? Why? Which page frame will be selected if a new page fault occurs immediately? Note that there are five questions!

CS44 Intro. to Operating Systems Final Exam Fall 5 6 (e) [8 points] What is Belady s anomaly? What is the inclusion property? Show that a page replacement algorithm that satisfies the inclusion property does not have Belady anomaly. Note that there are three questions! (f) [8 points] What is thrashing? How can it happen? How can it be overcome? Note that there are three questions. Elaborate your answer. Otherwise, you will receive no credit. 6. File System and Storage Management (a) [8 points] Suppose we have an access matrix as shown below, where o, r, w and e mean owner, read only, write only and execution only, respectively: User A User B User C File File File orwe rw rw r re orwe rw e orwe From this access matrix, construct a access control list and a capability list. Make sure you will indicate clearly which answer is for the access control list and which is for the capability list. Otherwise, you will receive no credit.

CS44 Intro. to Operating Systems Final Exam Fall 5 7 (b) [6 points] Consider a file currently consisting of blocks, from block to block 9. Assume that the FCB is already in memory. There are a few more assumptions as shown blow: In the contiguous allocation case, assume that there is no room to grow in the beginning, but room to grow in the end, and the directory entry has a start pointer and a length value. In the linked allocation, a directory entry has a start pointer and an end pointer. In the FAT allocation, the FAT table is in memory and a directory entry has a start pointer to the FAT table. In the case of indexed allocation, the index block is in memory and is large enough for further expansion. How many disk I/O operations are required for contiguous, linked, FAT, and indexed (single-level) allocation strategies, if a new block is to be inserted between block 4 and block 5. Assume that the block information to be added is already in memory. Note that there are four questions in this problem. Note also that you have to provide a complete elaboration of your calculation. Only providing an answer or vague elaboration will receive no credit. (c) [6 points] Suppose a disk has cylinders numbered (outer-most) to 9 (inner-most). In a sequence of I/O requests, the cylinders, in the order received, are, 6, 5, 8 and 9, and the disk head is currently on cylinder and moves inward. Use the following disk arm scheduling algorithms to determine the cylinders visited in correct order and the total number of cylinders crossed. Cylinders Visited Algorithm 4 5 Cylinders Crossed FCFS SSTF SCAN LOOK

CS44 Intro. to Operating Systems Final Exam Fall 5 8 7. Problem Solving: (a) [ points] We mentioned in class that semaphores, monitors and channels are all equivalent in the sense that any one of them can be used to implement the other two in a shared memory system. Suppose a system supports channels but not semaphores. This system has a set of non-specific sender and non-specific receiver channel functions as follows: CHAN t channel name(int BUF SIZE): This creates a channel with name channel name and capacity BUF SIZE. BUF SIZE must be a non-negative integer and if BUF SIZE is zero, this is a synchronous channel. Channel channel name may have an infinite capacity if BUF SIZE is set to a pre-defined value INFINITY. CHAN SEND(channel name, (void *) addr, int size): This function sends a message of size bytes stored in a location with beginning address addr to channel channel name. CHAN RECV(channel name, (void *) addr, int size): This function receives a message size bytes from channel channel name and stores the information to a location with beginning address addr. Use the above channel primitives to design a semaphore system. More precisely, define a type SEM t and functions SIGNAL() and WAIT() as follows: SEM t sem name(int value): This creates a semaphore with name sem name and initial value value. WAIT(sem name): This function performs a semaphore wait on semaphore sem name. SIGNAL(sem name): This function performs a semaphore signal on semaphore sem name. You should present the definition of SEM t and the detailed implementation of all functions. An elaboration of each component is required. Otherwise, you will receive low or even no credit. However, exact and correct C/C++ syntax is not required. Note that you can only use the channel primitives to implement semaphore primitives. You will receive no credit if you use any primitives other than channels and if your implementation has busy waiting, deadlock, and race conditions Use this and the next blank page for your answer

CS44 Intro. to Operating Systems Final Exam Fall 5 9 Use this blank page for your answer

CS44 Intro. to Operating Systems Final Exam Fall 5 (b) [ points] Suppose we have a system of linear equations in the following form, where a i,j s are known coefficients, b i s are known constant terms, and x i s are unknowns to be solved: a x + a x + + a,n x n + a n x n = b a x + + a,n x n + a n x n = b We may solve the x i s in a backward order as follows:. x n = b n x n =. x = x = a nn. a n,n x n + a n,n x n = b n a nn x n = b n a n,n (b n a n,n x n) [b (a x a + a 4x 4 + + a nx n )] [b (a x + a x + + a n x a n)] In other words, we can solve for x n from the first equation, substitute the obtained value x n into the next equation to solve for x n, from x n and x n solve for x n, and so on. This process continues until x is computed. In general, if x n, x n,..., x i i+ are the available solutions, the following computes x i : ( ) x i = n b i a i,k x k a ii k=i+ Now suppose we have n threads T, T,..., T n, and thread T i has the values of a i,i, a i,i+,..., a i,n and b i. Suppose further that there is a channel C i+,i between T i+ and T i, where i n. Thread T i receives x i+,..., x n, x n from T i+ via channel C i+,i, computes x i, and sends x i, x i+,..., x n to thread T i if i>. Create the channels and design threads T i s to perform the above equation solving task. You may assume that the channels send and receive messages in the FIFO order. Your solution must meet the following requirements: () maximum parallelism, () an elaboration and convincing argument for each channel parameter and each thread, () using only channels, and (4) no busy waiting, no race condition, and no deadlock. and You only need to declare the channel(s) and write the thread function(s). You do not have to write a complete program. However, violating any of the above stated requirement will cause you to receive zero or very low grade. Use this and the next blank page for your answer

CS44 Intro. to Operating Systems Final Exam Fall 5 Use this blank page for your answer

CS44 Intro. to Operating Systems Final Exam Fall 5 Grade Report Problem Possible You Received a 8 b 8 a 8 b 8 a 8 b 8 4 a 8 b a b 5 c d 8 e 8 f 8 a 8 6 b 6 c 6 7 a b Total