CPSC/ECE 3220 Summer 2017 Exam 2

Similar documents
CPSC/ECE 3220 Summer 2018 Exam 2 No Electronics.

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

CPSC/ECE 3220 Fall 2017 Exam Give the definition (note: not the roles) for an operating system as stated in the textbook. (2 pts.

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

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

MC7204 OPERATING SYSTEMS

CSE 153 Design of Operating Systems

Advanced Topic: Efficient Synchronization

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

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

Lecture 9: Midterm Review

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University

Operating Systems (1DT020 & 1TT802)

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

CPU Scheduling. The scheduling problem: When do we make decision? - Have K jobs ready to run - Have N 1 CPUs - Which jobs to assign to which CPU(s)

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

Deadlock. Concurrency: Deadlock and Starvation. Reusable Resources

CSE 120. Fall Lecture 8: Scheduling and Deadlock. Keith Marzullo

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

CPU Scheduling. The scheduling problem: When do we make decision? - Have K jobs ready to run - Have N 1 CPUs - Which jobs to assign to which CPU(s)

Multiprocessor Systems. COMP s1

Lecture 10: Multi-Object Synchronization

CSCE Operating Systems Scheduling. Qiang Zeng, Ph.D. Fall 2018

Suggested Solutions (Midterm Exam October 27, 2005)

QUESTION BANK UNIT I

COMP 3361: Operating Systems 1 Midterm Winter 2009

CS 153 Design of Operating Systems Winter 2016

Subject Teacher: Prof. Sheela Bankar

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

The Deadlock Lecture

Midterm Exam Amy Murphy 6 March 2002

Second Midterm Exam March 21, 2017 CS162 Operating Systems

Concurrency: Deadlock and Starvation

CS 318 Principles of Operating Systems

Last Class: Deadlocks. Today

Chendu College of Engineering & Technology

UNIT:2. Process Management

Multiprocessor System. Multiprocessor Systems. Bus Based UMA. Types of Multiprocessors (MPs) Cache Consistency. Bus Based UMA. Chapter 8, 8.

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.

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

Multiprocessor Systems. Chapter 8, 8.1

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

COMP 3361: Operating Systems 1 Final Exam Winter 2009

CSE 120 Principles of Operating Systems

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

Last Class: Synchronization Problems. Need to hold multiple resources to perform task. CS377: Operating Systems. Real-world Examples

Operating Systems. Process scheduling. Thomas Ropars.

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

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

CS140 Operating Systems and Systems Programming Midterm Exam

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

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT I

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

Midterm Exam Amy Murphy 19 March 2003

CHAPTER NO - 1 : Introduction:

Midterm Exam March 13, 2013 CS162 Operating Systems

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

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

CSI3131 Final Exam Review

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

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

Fall 2015 COMP Operating Systems. Lab 06

1.1 CPU I/O Burst Cycle

Lecture 9: Multiprocessor OSs & Synchronization. CSC 469H1F Fall 2006 Angela Demke Brown

University of Waterloo Midterm Examination Model Solution CS350 Operating Systems

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

Indian Institute of Technology, Kharagpur

TDDB68 Processprogrammering och operativsystem / Concurrent programming and operating systems


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

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

OPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5

CSE 306/506 Operating Systems Deadlock. YoungMin Kwon

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

CSE 120 Principles of Operating Systems

Last Class: Monitors. Real-world Examples

Transactional Memory: Architectural Support for Lock-Free Data Structures Maurice Herlihy and J. Eliot B. Moss ISCA 93

CSL373: Lecture 5 Deadlocks (no process runnable) + Scheduling (> 1 process runnable)

Midterm Exam. October 20th, Thursday NSC

Advance Operating Systems (CS202) Locks Discussion

Tasks. Task Implementation and management

Main Points of the Computer Organization and System Software Module

CSE 120. Summer, Inter-Process Communication (IPC) Day 3. Inter-Process Communication (IPC) Scheduling Deadlock. Instructor: Neil Rhodes

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

ECE 3055: Final Exam

Process- Concept &Process Scheduling OPERATING SYSTEMS

Operating Systems: William Stallings. Starvation. Patricia Roy Manatee Community College, Venice, FL 2008, Prentice Hall

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

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

November 13, Networking/Interprocess Communication (25 pts)

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

CS 318 Principles of Operating Systems

Memory Management. 3. What two registers can be used to provide a simple form of memory protection? Base register Limit Register

Scheduling. Scheduling 1/51

FCM 710: Architecture of Secure Operating Systems

General Objectives: To understand the process management in operating system. Specific Objectives: At the end of the unit you should be able to:

Scheduling. The Basics

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

Chapter 5: CPU Scheduling

Chapter 6 Concurrency: Deadlock and Starvation

Transcription:

CPSC/ECE 3220 Summer 2017 Exam 2 Name: Part 1: Word Bank Write one of the words or terms from the following list into the blank appearing to the left of the appropriate definition. Note that there are more words and terms than definitions. (1.5 pts. each) affinity scheduling fine-grained locking mutually recursive locking real-time scheduling base and bound gang scheduling nested waiting scheduler activations compute-bound task I/O-bound task oblivious scheduling TLB hit core map lock-free data structure preemption TLB miss dynamic priority scheduling lock ordering priority donation TLB shootdown false sharing long-term scheduler processor scheduling policy zero-on-reference 1. A task that primarily does I/O, and does little processing. 2. A task that primarily uses the processor and does little I/O. 3. A request to another processor to remove a newly invalid TLB entry. 4. A widely used approach to prevent deadlock, where locks are acquired in a predetermined order. 5. An early system for memory protection where each process is limited to a specific range of physical memory. 6. When there are more runnable threads than processors, the policy that determines which threads to run first. 7. A scheduling policy where the OS assigns threads to processors without knowledge of the intent of the parallel application. 8. A scheduling policy for multiprocessors that performs all the runnable tasks for a particular process at the same time. 9. A scheduling policy where tasks are preferentially scheduled onto the same processor that they had previously been assigned to improve cache reuse. 10. When a thread waits for a lock held by a lower priority thread, the lock holder is temporarily increased to the waiter s priority until the lock is released. 11. A multiprocessor scheduling policy where each application is informed of how many processors it has been assigned and whenever the assignment changes. 12. A data structure used by the memory management system to keep track of the state of physical page frames, such as which processes reference the page frame.

Part 2: Multi-Object Locking and Non-Blocking Synchronization Compare and Swap / Mellor-Crummey Scott lock / Read-Copy-Update. Circle only one of CAS, MCS, or RCS. (1.5 pts. each) 13. CAS / MCS / RCU Has a grace period. 14. CAS / MCS / RCU Is an atomic read-modify-write instruction. 15. CAS / MCS / RCU Is an efficient form of readers/writer locking. 16. CAS / MCS / RCU An efficient spinlock implementation where each waiting thread spins on a separate memory location. 17. Suppose you have a table of 64 counters shared by hundreds of threads on a multiprocessor with 8 processors. Each counter is 4 bytes in length, and a cache line is 64 bytes in length. Updates (i.e., write accesses) to the counters account for approximately two-thirds of the accesses, and read-only accesses account for the rest. There is no discernable pattern in which a thread accesses a particular counter, so consider the accesses as random. Identify any correctness and/or performance concerns you have for the following approaches during peak times when dozens of threads may contend for access to any given lock: (8 pts.) (a) a single mutual exclusion lock for the whole table (b) a separate mutual exclusion lock for each counter (c) an RCU lock for the whole table (d) CAS-based optimistic concurrency control used for counter updates, with no synchronization for reads

Part 3: Deadlock 18. Give the four necessary conditions for deadlock. (6 pts.) True/False. Circle only one of T or F. (1 pt. each) Use this table for questions 19-22 for deadlock avoidance questions based on the Banker s algorithm. Treat each question independently, starting each time from the values shown in the table. process max need allocated remaining need A 10 4 6 B 9 2 7 C 8 3 5 Unused units = 6 19. T / F Can safely grant request of process A for 1 units. 20. T / F Can safely grant request of process B for 1 unit. 21. T / F Can safely grant request of process B for 2 units. 22. T / F Can safely grant request of process C for 2 units. 23. T / F An unsafe state will always lead to deadlock. 24. T / F If you prevent deadlock by making sure that one of the four conditions does not hold, you will also prevent starvation. Part 4: Scheduling Short-Term/Medium-Term/Long-Term Scheduling. Circle one or more of S, M, L, as applies. (1.5 pts. each) 25. S / M / L Is called a dispatcher. 26. S / M / L Typically runs after every interrupt. 27. S / M / L Attempts to dynamically maintain a balanced job mix. FIFO/RR/MFQ/SJF-preemptive. Circle one or more of F, R, M, S, as applies. (2 pts. each) 28. F / R / M / S Is preemptive. 29. F / R / M / S Allows starvation. 30. F / R / M / S Uses time quantums. 31. F / R / M / S Requires future knowledge. 32. F / R / M / S Has minimum average response time.

True/False. Circle only one of T or F. (1 pt. each) 33. T / F A program is the unit of scheduling in a computer system. 34. T / F A CPU timer allows round-robin scheduling to be implemented. 35. T / F SJF-preemptive is used by most time-sharing systems. 36. Given the following list of tasks, arrival times, and service times, calculate the completion (i.e., departure) time and response (i.e., turnaround) time of each task for FIFO scheduling and again for SJF-preemptive scheduling. (6 pts.) ------------ FIFO ------------ ------ SJF-preemptive ------ Task Arrival Service Completion Response Completion Response Time Time Time Time Time Time A 0 10 B 2 4 C 4 1 Aging/Boosting. Circle only one or A or B. (1 pt. each) 37. A / B Priority increases while waiting. 38. A / B Priority decreases while running. 39. A / B Priority increase value specified in signal operation for I/O completion. 40. Devise a workload when FIFO is pessimal for average response time. (2 pts.)

41. Explain the priority inversion problem. (4 pts.) Part 5: Address Translation Base and Bound relocation registers/segmentation/paged memory. Circle one or more of BB, S, or P, as applies. (1.5 pts. each) 42. BB / S / P Uses variable-length allocation. 43. BB / S / P Can have internal fragmentation. 44. BB / S / P Can be sped up by the use of a TLB. 45. BB / S / P Performs a bounds/limit check on the address. 46. BB / S / P Process control block holds the base address of the mapping table. The MULTICS system was word-addressable, and a virtual address was structured in this manner: Answer questions 47-48 using powers of 2. Use words as the addressable units, and do not convert to bytes. 47. Consider a data structure of 512 K words. How many segments do you need to store this structure? (1 pt.) 48. How many pages do you need to store the data structure in question 47? (1 pt.)

Consider a simple architecture with paged segments in which three-decimal-digit virtual addresses are used. The segment id is the first decimal digit, the virtual page number is the second decimal digit, and the offset is the last decimal digit. The physical address are two decimal digits: the page frame is the first decimal digit, and the offset is the second decimal digit. E.g., the virtual address 013 would be translated to physical address 23 given the following segment and page table entries. Give the physical addresses for the following virtual addresses. (2 pts. each) Segment Table Page Table A Page Table B 0 = points to page table A, segment length is 3 pages 0 = page frame 4 0 = page frame 7 1 = points to page table B, segment length is 2 pages 1 = page frame 2 1 = page frame 5 X (other values are invalid) 2 = page frame 0 X (other values are invalid) X (other values are invalid) 49. Virtual address 000 is translated to physical address. 50. Virtual address 111 is translated to physical address. 51. What should happen when the processor tries to translate virtual address 123 and why? 52. Explain what the term superpage means and how the concept helps improve TLB performance. (2 pts.) 53. Explain what is meant by a tagged TLB and how the concept helps improve TLB performance. (2 pts.)

54. Consider the following two approaches to zero matrix a. Assume that matrix a is stored in row-major order, that a double-precision value is 8 bytes, that the page size is 4 KB, that the i and j index variables are register-allocated rather than memory allocated, and that you have a traditional TLB with 8 entries. For each approach, compute the number of TLB misses, assuming that for each approach the TLB starts off as empty. (4 pts.) double a[1024][1024]; double a[1024][1024]; for( i = 0; i < 1024; i++ ){ for( j = 0; j < 1024; j++ ){ for( j = 0; j < 1024; j++ ){ for( i = 0; i < 1024; i++ ){ a[i][j] = 0.0; a[i][j] = 0.0; } } } } Extra Credit. Identify the two distinct ways to recover from deadlock mentioned in the textbook. (up to 3 pts.)