Cosc 4740 Chapter 6, Part 3 Process Synchronization.

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

TRANSACTION PROCESSING SYSTEM ROHIT KHOKHER. TRANSACTION RECOVERY TRANSACTION RECOVERY TRANSACTION STATES SERIALIZABILITY CONFLICT SERIALIZABILITY VIEW.
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community.
Chapter 6: Process Synchronization
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 5: Process Synchronization.
Database Systems, 8 th Edition Concurrency Control with Time Stamping Methods Assigns global unique time stamp to each transaction Produces explicit.
Monitors A high-level abstraction that provides a convenient and effective mechanism for process synchronization Only one process may be active within.
Chapter 6 Process Synchronization: Part 2. Problems with Semaphores Correct use of semaphore operations may not be easy: –Suppose semaphore variable called.
Chapter 6: Process Synchronization. 6.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 8, 2005 Module 6: Process Synchronization.
Chapter 6.4: Process Synchronization Part Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Module 6: Process Synchronization Lecture.
Chapter 6: Process Synchronization. 6.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 8, 2005 Objectives Understand.
Silberschatz, Galvin and Gagne ©2007 Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Chapter 6: Process Synchronization.
CPSC 4650 Operating Systems Chapter 6 Deadlock and Starvation
Chapter 6: Process Synchronization. Module 6: Process Synchronization Background The Critical-Section Problem Peterson’s Solution Synchronization Hardware.
1 Concurrency: Deadlock and Starvation Chapter 6.
6: Process Synchonization II 1 PROCESS SYNCHRONIZATION II THE BOUNDED BUFFER ( PRODUCER / CONSUMER ) PROBLEM: This is the same producer / consumer problem.
Modified from Silberschatz, Galvin and Gagne & Stallings Lecture 12 Chapter 6: Process Synchronization (cont)
Concurrency: Deadlock and Starvation Chapter 6. Goal and approach Deadlock and starvation Underlying principles Solutions? –Prevention –Detection –Avoidance.
1 Concurrency: Deadlock and Starvation Chapter 6.
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic,
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
Solution to Dining Philosophers. Each philosopher I invokes the operations pickup() and putdown() in the following sequence: dp.pickup(i) EAT dp.putdown(i)
6.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Module 6: Process Synchronization.
UNIT III: Concurrency Process SynchronizationSynchronization The Critical-Section problemCritical-Section problem Peterson’s Solution Synchronization HardwareHardware.
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.
Chapter 6: Synchronization. 6.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Module 6: Synchronization Background The Critical-Section.
Kernel Locking Techniques by Robert Love presented by Scott Price.
Chapter 6: Process Synchronization. 6.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Module 6: Process Synchronization Background The.
Chapter 6: Synchronization. 6.2 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Module 6: Synchronization Background The Critical-Section.
7c.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Module 7c: Atomicity Atomic Transactions Log-based Recovery Checkpoints Concurrent.
Chapter 6: Process Synchronization. 6.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Module 6: Process Synchronization Background The.
Chapter 6: Process Synchronization. 6.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Module 6: Process Synchronization Background The.
Chapter 6: Process Synchronization. 6.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 8, 2005 Module 6: Process Synchronization.
Chapter 6: Process Synchronization. Module 6: Process Synchronization Background The Critical-Section Problem Peterson’s Solution Synchronization Hardware.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 6: Process Synchronization.
Process Synchronization Monitors Simulation of Monitors Checkpoint and Recovery Monitors Simulation of Monitors Checkpoint and Recovery Topics:
Chapter 6: Process Synchronization. 6.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 8, 2005 Module 6: Process Synchronization.
Chapter 6: Process Synchronization. 6.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Module 6: Process Synchronization Background The.
Chapter 6: Synchronization. 6.2Operating System Principles Module 6: Synchronization Background The Critical-Section Problem Peterson’s Solution Synchronization.
Chapter 6: Process Synchronization. 6.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 8, 2005 Module 6: Process Synchronization.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 6 Operating Systems.
Chapter 6: Process Synchronization. 6.2 Chapter 6: Process Synchronization Background The Critical-Section Problem Peterson’s Solution Synchronization.
Chapter 6: Process Synchronization. 6.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 8, 2005 Module 6: Process Synchronization.
Chapter 6: Process Synchronization. 6.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 8, 2005 Module 6: Process Synchronization.
Chapter 6: Process Synchronization. 6.2CSCI 380 – Operating Systems Module 6: Process Synchronization Background The Critical-Section Problem Peterson’s.
Transaction Management Transparencies. ©Pearson Education 2009 Chapter 14 - Objectives Function and importance of transactions. Properties of transactions.
Practice Chapter Five.
Chapter 6: Process Synchronization. 6.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Module 6: Process Synchronization Background The.
6.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles 6.5 Semaphore Less complicated than the hardware-based solutions Semaphore S – integer.
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community.
Deadlock and Starvation
Chapter 6: Process Synchronization
Chapter 5: Process Synchronization
Deadlock and Starvation
Advanced Operating Systems - Fall 2009 Lecture 8 – Wednesday February 4, 2009 Dan C. Marinescu Office: HEC 439 B. Office hours: M,
CSCI 511 Operating Systems Chapter 5 (Part C) Monitor
Chapter 6: Process Synchronization
Chapter 6: Process Synchronization
Chapter 6: Process Synchronization
Chapter 6: Process Synchronization
Chapter 6: Process Synchronization
Lecture 2 Part 2 Process Synchronization
Chapter 6: Process Synchronization
Chapter 7: Synchronization Examples
Concurrency: Mutual Exclusion and Process Synchronization
Chapter 6: Process Synchronization
Module 6: Process Synchronization
Chapter 6: Process Synchronization
CSE 542: Operating Systems
CSE 542: Operating Systems
Presentation transcript:

Cosc 4740 Chapter 6, Part 3 Process Synchronization

OS Synchronization Sun Solaris implementation Windows XP implementation Linux implementations Atomic transactions

Solaris Synchronization Implements a variety of locks to support multitasking, multithreading (including real- time threads), and multiprocessing. Uses adaptive mutexes for efficiency when protecting data from short code segments.

Adaptive Mutexes Protects every critical data item With a multiprocessor system, it has two functions and if the data is locked 1.If lock is held by running thread, then use a spinlock (busy loop). 2.If lock is held by blocked thread, then process blocks. Single processor, uses only #2

Uses condition variables and readers-writers locks when longer sections of code need access to data. –Readers-Writers locks protect data is read often, but needs little updating. Uses turnstiles to order the list of threads waiting to acquire either an adaptive mutex or reader- writer lock. –turnstiles: data structure containing threads blocked on a lock

Windows XP Synchronization Uses interrupt masks to protect access to global resources on uniprocessor systems. Uses spinlocks on multiprocessor systems. –Also protects spinlocks, by not allowing a process to be preempted when holding a spinlock. Also provides dispatcher objects which may act as mutexes and semaphores.

Dispatcher objects may also provide events. –An event acts much like a condition variable (monitors). –It will signal when blocked processes on a waiting queue, when the resource is available.

Linux Synchronization Linux: –Prior to kernel Version 2.6, disables interrupts to implement short critical sections –Version 2.6 and later, fully preemptive Linux provides: –semaphores –spinlocks –reader-writer versions of both On single-cpu system, spinlocks replaced by enabling and disabling kernel preemption

Pthreads Synchronization Pthreads API is OS-independent It provides: –mutex locks –condition variables Non-portable extensions include: –read-write locks –spin locks

Atomic Transactions Database principles for O/S actions –Mainly, storage, retrieval of data, and consistency –File system management and shared memory.

System Model Transaction: a series of operations (instructions) that performs a single logical function –A sequence of reads and writes for file systems –The action is either committed or aborted –When an action is aborted, then the “system” is rolled back to a stable state. Allows for failure of the system, but the file system is easily recovered and undamaged.

Log-Based Recovery A record of each action is recorded, before the action takes place. Called write-ahead logging Known as journaling for File systems In the log –Transaction name (unique name of transaction) –Data Item Name (unique name of data item written) –Old value –New value

Log-Based Recovery (2) If the action failures to commit, then issue and undo or redo (depends on the system) –Undo returns to the state before the action started. –Redo attempts to finish the action (good for file system recovery)

Checking points When a failure occurs, we need to check the log and determine what to do. Can very time-consuming So reduce overhead, log is written out and put a checkpoint in log, to state it has gotten this far. –An action may have completed, but not committed yet.

Serializability Serialize atomic actions –Since they are atomic and can interfere with actions of another they can be executed in an arbitrary order –May not always produce the same final answer though.

Schedule 1: T 0 then T 1

Schedule 2: Concurrent Serializable Schedule

Locking Protocol and Timestamp- Based Protocols Each works to ensure that final result comes out as expected, by ordering the serial atomic actions. Locking Protocol, required to get the locks as they did the first time. Timestamp, use extra information with timestamps of reads and writes.

Next Time Chapter 6.9: Deadlock! –Deadlock Prevention and Avoidance –Deadlock Detection and Recovery

Q A &