CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11:30 - 12:30 AM.

Slides:



Advertisements
Similar presentations
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community.
Advertisements

Chapter 7 - Resource Access Protocols (Critical Sections) Protocols: No Preemptions During Critical Sections Once a job enters a critical section, it cannot.
1 Lecture 11: Transactions: Concurrency. 2 Overview Transactions Concurrency Control Locking Transactions in SQL.
CS492B Analysis of Concurrent Programs Lock Basics Jaehyuk Huh Computer Science, KAIST.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 6: Process Synchronization.
Mutual Exclusion.
COP 4600 Operating Systems Fall 2010 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 3:30-4:30 PM.
1 Advanced Operating Systems - Spring 2009 Lecture 9 – February 9, 2009 Dan C. Marinescu Office: HEC 439 B. Office.
02/27/2004CSCI 315 Operating Systems Design1 Process Synchronization Deadlock Notice: The slides for this lecture have been largely based on those accompanying.
CY2003 Computer Systems Lecture 05 Semaphores - Theory.
COT 5611 Operating Systems Design Principles Spring 2012 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 5:00-6:00 PM.
Chapter 6 Concurrency: Deadlock and Starvation
Chapter 6 Concurrency: Deadlock and Starvation
Concurrency Control and Recovery In real life: users access the database concurrently, and systems crash. Concurrent access to the database also improves.
Concurrent Processes Lecture 5. Introduction Modern operating systems can handle more than one process at a time System scheduler manages processes and.
Chapter 7: Deadlocks. 7.2 Chapter Objectives To develop a description of deadlocks, which prevent sets of concurrent processes from completing their tasks.
1 Chapter 7: Deadlock. 2 The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance.
Modified from Silberschatz, Galvin and Gagne Lecture 13 Chapter 7: Deadlocks.
Transaction Management and Concurrency Control
02/18/2008CSCI 315 Operating Systems Design1 Deadlock Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating.
Deadlock Prevention CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han.
9 Chapter 9 Transaction Management and Concurrency Control Hachim Haddouti.
COT 4600 Operating Systems Spring 2011 Dan C. Marinescu Office: HEC 304 Office hours: Tu-Th 5:00-6:00 PM.
08_Transactions_LECTURE2 DBMSs should guarantee ACID properties (Atomicity, Consistency, Isolation, Durability). This is typically done by guaranteeing.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
Cosc 4740 Chapter 6, Part 3 Process Synchronization.
Transactions1 Unit of work on a database. Transactions2 Transactions, concept Logical unit of work on the database –Examples Transfer money from bank.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Mutual Exclusion.
Deadlocks Silberschatz Ch. 7 and Priority Inversion Problems.
Chapter 7 -1 CHAPTER 7 PROCESS SYNCHRONIZATION CGS Operating System Concepts UCF, Spring 2004.
Chapter 6 – Process Synchronisation (Pgs 225 – 267)
COT 4600 Operating Systems Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 3:00-4:00 PM.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock.
This Time - Deadlock Definition Conditions for deadlocks
Copyright © Curt Hill Concurrent Execution An Overview for Database.
CSE 153 Design of Operating Systems Winter 2015 Midterm Review.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 7 Operating Systems.
COP 4600 Operating Systems Fall 2010 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 3:30-4:30 PM.
Deadlock. Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 6: Deadlocks.
COP 4600 Operating Systems Spring 2011 Dan C. Marinescu Office: HEC 304 Office hours: Tu-Th 5:00 – 6:00 PM.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
Mutual Exclusion -- Addendum. Mutual Exclusion in Critical Sections.
Linux Kernel Development Chapter 8. Kernel Synchronization Introduction Geum-Seo Koo Fri. Operating System Lab.
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community.
Interprocess Communication Race Conditions
Multithreading / Concurrency
COT 4600 Operating Systems Fall 2009
Background on the need for Synchronization
COP 5611 Operating Systems Spring 2010
COP 4600 Operating Systems Spring 2011
COT 5611 Operating Systems Design Principles Spring 2014
CGS 3763 Operating Systems Concepts Spring 2013
COT 5611 Operating Systems Design Principles Spring 2014
COP 4600 Operating Systems Fall 2010
COP 4600 Operating Systems Spring 2011
Chapter 7: Deadlocks.
COT 4600 Operating Systems Spring 2011
COT 5611 Operating Systems Design Principles Spring 2012
Lecture 2 Part 2 Process Synchronization
CGS 3763 Operating Systems Concepts Spring 2013
CGS 3763 Operating Systems Concepts Spring 2013
Concurrency: Mutual Exclusion and Process Synchronization
CSE 153 Design of Operating Systems Winter 19
CSE 153 Design of Operating Systems Winter 2019
CGS 3763 Operating Systems Concepts Spring 2013
CSE 542: Operating Systems
CSE 542: Operating Systems
Presentation transcript:

CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM

Last time:  CPU Scheduling  Process synchronization Today Process synchronization  Transactions  Locks  Deadlocks  Semaphores  Monitors  Thread coordination with a bounded buffer. Next time  Process synchronization Reading assignments  Chapter 6 of the textbook Lecture 26 – Wednesday, March 20, 2013 Lecture 262

Transaction Transaction processing  information processing that is divided into individual, indivisible operations. Transaction  operation that must succeed or fail as a complete unit; it cannot remain in an intermediate state. Example - ordering an airline ticket requires two actions: payment, and a seat reservation. The user must either:  both pay for and reserve a seat; OR  neither pay for nor reserve a seat. In database systems, atomicity (from Greek a-tomos, undividable) is one of the ACID transaction properties. ACID – atomicity – consistency – isolation- durability  Atomicity  indivisibility of an operation.  Consistency  a transaction will bring the database from one valid state to another.  Isolation  concurrent execution of transactions results in a system state that would be obtained if transactions were executed one after another.  Durability  a transaction has been committed, it will remain so. Lecture 26 3

Why do we need concurrency control? In a transaction processing system we have to guarantee the ACID properties. Example: An electronic funds transfer requires several steps: 1. Get the current balance 2. Check that the transaction is possible - if enough funds are available in case of a withdraw. 3. Compute the new balance. 4. Write the new balance. 5. Complete the transaction – transfer the funds. The system may fail at any point and we have to guarantee that either all steps are completed or none. What if two transactions act upon an account, e.g., there arte two threads T1 and T2 which both wish to withdraw from the account? Lecture 264

Critical concepts for thread coordination Critical section  code that accesses a shared resource. Race conditions  two or more threads access shared data and the result depends on the order in which the threads access the shared data. Mutual exclusion  only one thread should execute a critical section at any one time. Lock  shared variable which acts as a flag to coordinate access to shared data. Spin lock  A spin lock causes a thread trying to acquire it to simply wait in a loop ("spin") while repeatedly checking if the lock is available. It is also called a ``busy waiting'' as the processor is busy checking the lock. Thus, on a single processor/single core system no other thread can run and the one holding the lock cannot release it Side effects of thread coordination  Deadlock  Priority inversion  a lower priority activity is allowed to run before one with a higher priority Lecture 265

6

Deadlocks Happen quite often in real life and the proposed solutions are not always logical: “When two trains approach each other at a crossing, both shall come to a full stop and neither shall start up again until the other has gone.” a pearl from Kansas legislation. Deadlock jury. Deadlock legislative body. Lecture 267

Examples of deadlock Traffic only in one direction. Solution  one car backs up (preempt resources and rollback). Several cars may have to be backed up. Starvation is possible. Lecture 268

9

Thread deadlock Deadlocks  prevent sets of concurrent threads/processes from completing their tasks. How does a deadlock occur  a set of blocked threads each holding a resource and waiting to acquire a resource held by another thread in the set. Example  locks A and B, initialized to 1 P 0 P 1 wait (A);wait(B) wait (B);wait(A) Aim  prevent or avoid deadlocks Lecture 2610

Lecture 2611