1 Feedback Dave Eckhardt 1 Homework Q2 ● Was deadlock prevention an option for P2? ● Answer – We couldn't violate the “mutual exclusion”

Slides:



Advertisements
Similar presentations
1 Deadlock Solutions: Avoidance, Detection, and Recovery CS 241 March 30, 2012 University of Illinois.
Advertisements

Ch. 7 Process Synchronization (1/2) I Background F Producer - Consumer process :  Compiler, Assembler, Loader, · · · · · · F Bounded buffer.
Chapter 6: Process Synchronization
MACHINE-INDEPENDENT VIRTUAL MEMORY MANAGEMENT FOR PAGED UNIPROCESSOR AND MULTIPROCESSOR ARCHITECTURES R. Rashid, A. Tevanian, M. Young, D. Golub, R. Baron,
15-410, F’ Exam #1 Oct. 25, 2004 Dave Eckhardt L21_Exam “...What does BSS stand for, anyway?...”
Chapter 10 Operating Systems.
Cpr E 308 Spring 2004 Recap for Midterm Introductory Material What belongs in the OS, what doesn’t? Basic Understanding of Hardware, Memory Hierarchy.
Review: Chapters 1 – Chapter 1: OS is a layer between user and hardware to make life easier for user and use hardware efficiently Control program.
CS444/CS544 Operating Systems Synchronization 2/16/2006 Prof. Searleman
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Dr. Mohamed Hefeeda.
Deadlocks. 2 System Model There are non-shared computer resources –Maybe more than one instance –Printers, Semaphores, Tape drives, CPU Processes need.
CS 104 Introduction to Computer Science and Graphics Problems
OS Spring 2004 Concurrency: Principles of Deadlock Operating Systems Spring 2004.
CMPT 300: Operating Systems Review THIS REIVEW SHOULD NOT BE USED AS PREDICTORS OF THE ACTUAL QUESTIONS APPEARING ON THE FINAL EXAM.
Cs238 CPU Scheduling Dr. Alan R. Davis. CPU Scheduling The objective of multiprogramming is to have some process running at all times, to maximize CPU.
OS Fall’02 Concurrency: Principles of Deadlock Operating Systems Fall 2002.
CS533 Concepts of Operating Systems Class 7 Integrated Task and Stack Management.
1 Concurrency: Deadlock and Starvation Chapter 6.
CS533 - Concepts of Operating Systems 1 CS533 Concepts of Operating Systems Class 8 Synchronization on Multiprocessors.
CS252: Systems Programming Ninghui Li Final Exam Review.
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic,
Exam2 Review Bernard Chen Spring Deadlock Example semaphores A and B, initialized to 1 P0 P1 wait (A); wait(B) wait (B); wait(A)
CS 153 Design of Operating Systems Spring 2015 Lecture 11: Scheduling & Deadlock.
Ch. 4 Memory Mangement Parkinson’s law: “Programs expand to fill the memory available to hold them.”
CH 3 Deadlock When 2 (or more) processes remain blocked forever!
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Introduction to Concurrency.
Cpr E 308 Spring 2004 Real-time Scheduling Provide time guarantees Upper bound on response times –Programmer’s job! –Every level of the system Soft versus.
1 Announcements The fixing the bug part of Lab 4’s assignment 2 is now considered extra credit. Comments for the code should be on the parts you wrote.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Mutual Exclusion.
OPERATING SYSTEMS - I. What is an Operating System OS is a program that manages the computer hardware It provides a basis for application programs and.
Computer Systems Week 14: Memory Management Amanda Oddie.
CS399 New Beginnings Jonathan Walpole. 2 Concurrent Programming & Synchronization Primitives.
CS333 Intro to Operating Systems Jonathan Walpole.
1 Exam Feedback Dave Eckhardt
Memory Management OS Fazal Rehman Shamil. swapping Swapping concept comes in terms of process scheduling. Swapping is basically implemented by Medium.
1 Critical Section Problem CIS 450 Winter 2003 Professor Jinhua Guo.
CS3771 Today: Distributed Coordination  Previous class: Distributed File Systems Issues: Naming Strategies: Absolute Names, Mount Points (logical connection.
Where Testing Fails …. Problem Areas Stack Overflow Race Conditions Deadlock Timing Reentrancy.
Silberschatz, Galvin and Gagne ©2009 Edited by Khoury, 2015 Operating System Concepts – 9 th Edition, Chapter 7: Deadlocks.
Introduction to operating systems What is an operating system? An operating system is a program that, from a programmer’s perspective, adds a variety of.
CH 3 Deadlock When 2 (or more) processes remain blocked forever!
Tutorial 2: Homework 1 and Project 1
Memory Management.
Sarah Diesburg Operating Systems COP 4610
Background on the need for Synchronization
Practice Chapter Four.
Section 10: Last section! Final review.
HW1 and Synchronization & Queuing
Chapter 8: Main Memory.
Practice Six Chapter Eight.
CS140 – Operating Systems Midterm Review
Main Memory Background Swapping Contiguous Allocation Paging
Midterm review: closed book multiple choice chapters 1 to 9
Process Description and Control
Lecture 2 Part 2 Process Synchronization
CS 333 Introduction to Operating Systems Class 7 - Deadlock
CPU scheduling decisions may take place when a process:
Concurrency: Mutual Exclusion and Process Synchronization
Process Description and Control
CSE451 Virtual Memory Paging Autumn 2002
February 5, 2004 Adrienne Noble
CSE 451: Operating Systems Autumn 2003 Lecture 7 Synchronization
CSE 451: Operating Systems Autumn 2005 Lecture 7 Synchronization
CSE 451: Operating Systems Winter 2003 Lecture 7 Synchronization
CS333 Intro to Operating Systems
CS703 - Advanced Operating Systems
EECE.4810/EECE.5730 Operating Systems
CSE 542: Operating Systems
Sarah Diesburg Operating Systems CS 3430
Presentation transcript:

1 Feedback Dave Eckhardt

1 Homework Q2 ● Was deadlock prevention an option for P2? ● Answer – We couldn't violate the “mutual exclusion” deadlock requirement ● “because the data structures would have been messed up” ● “Pixie dust” theory – Sprinkle mutex_lock() powder on sick programs – More is better ● Tape drive != “struct mutex”

1 Homework Q4 ● In the IBM System/370, memory protection is provided through the use of keys. ● A key is a 4-bit quantity. – How many 4-bit keys are there? – One per frame? – One per process? – One per process memory page?

1 Homework Q4 ● Each 2 KB block of memory has a key (the storage key) associated with it. ● The CPU also has a key (the protection key) associated with it. ● A store operation is allowed only if both keys are equal, or if either is zero. – Can a process change its protection key? – Does the kernel need protection_key=0 to write to kernel memory?

1 Homework Q4 ● (a) Explain why an operating system might typically arrange for memory pages allocated to a single user process to have different storage keys. ● Three issues – Storage key for page 1 – Storage key for page 2 – Protection key

1 Homework Q4 ● Assume pk = 1 – Some pages have sk = 1 ● The process can write to them – Some pages have sk != 1 ● The process can't write to them ● What is the common case of non-writeable pages?

1 Homework Q4 ● (b) Explain why an operating system kernel might be designed so most kernel code would not execute with the protection key equal to zero. ● Ok... – pk != 0, so pick one, i.e., pk = 2 – Some pages have sk = 2 (which ones?) – Some pages have sk != 2 (which ones?) – When is pk = 0 used?

1 Exam – overall ● Grade distribution – 24 A's ( ) – 20 B's (80..89) – 12 C''s (70..79) – 4 other ● No obvious need to curve ● Final exam could be harder ● Grade change requests: end of week

1 Exam - overall ● “And then the OS...”

1 Exam – overall ● “And then the OS...” – This is an OS class! – We are under the hood! – The job is to understand the parts of the OS ● What they do ● How they interact ● Why

1 Q1 ● Are keyboard interrupts really necessary? ● Same – Input may arrive early (input queue) – Processes may arrive early (waiting queue) ● Focus on what is different – Detecting new input – Carrying it to existing input queue/wait queue

1 Q1 ● “Polling” approach – When? – How long? ● “Process” approach – When? – How long? ● Eating every other quantum is not good – How to interact with wait queue?

1 Q2 (a) ● The “process exit” question ● Sum of process memory is 256 K ● Memory freed on exit is 50 K – Not a multiple of 4 K ● (so not an x86, no big deal) – Not “approximately” 16 K stack + 32 K heap

1 Q2 (b) ● Process state graph ● Went well overall

1 Q2 (c) ● Explain why you have no hope of accessing memory belonging to your partner's processes. ● Key concept: address space – Everybody gets their own 0..4 GB ● Other options possible – Segmented address space (Multics) ● But you needed to explain ● Common case: every main() in same place – Sparse virutal address space (EROS)

1 Q3: load_linked()/store_conditional() ● Required to consider multi-processor target – test-and-yield() is bad ● unless you carefully explained it ● Common concern: lock/unlock conflict – Real load-linked()/store-conditional() a bit better – Still an issue (see Hennessey & Patterson) ● random back-off ● occasional yield

1 Q4: “Concentration” card game ● “Global mutex” approach – “Solves” concurrency problems by removing concurrency! – Can be devastating ● (not a technique we covered in class) ● Deadlock avoidance/detection approaches – Hard to get right – There is another option

1 Deadlock prevention ● “Pass a law” – So every possible sequence violates one of: ● Mutual exclusion ● Hold & Wait ● Non-preemption ● Wait cycles

1 Common case ● Violate “wait cycles” ● Establish locking order – Total order on mutexes in system – Pre-sort locks according to order – Or, dump & start over ● Good locking order: memory addresses – &card[i][j] ● each lock is unique ● every lock is comparable to every other lock

1 A novel solution ● One mutex per card pair – 36 cards, (36*35)/2 = 630 mutexes ● Can make sense for small n – Lamport's fast mutual exclusion algorithm ● (related approach)

1 A subtle mistake ● i1 = generate_random(0, 5); ● j1 = generate_random(0, 5); ● i2 = generate_random(i1, 5); ● j2 = generate_random(j1, 5); ● Good news – No wait cycles ● Bad news?

1 Q5: Critical Section Protocol ● “Hyman's algorithm” – Comments on a Problem in Concurrent Programming ● CACM 9:1 (1966) ● (retracted) ● Doesn't provide mutual exclusion ● Doesn't provide bounded waiting

1 Q5: Critical Section Protocol ● You should understand these problems ● You won't implement mutexes often ● Thought patterns matter for concurrent programming