Advanced Topics in Software Engineering1 Today’s Agenda  HW #1  Quick Review  Finish The CS Problem  Replay Shared Variables.

Slides:



Advertisements
Similar presentations
Synchronization and Deadlocks
Advertisements

Concurrency Important and difficult (Ada slides copied from Ed Schonberg)
Ch. 7 Process Synchronization (1/2) I Background F Producer - Consumer process :  Compiler, Assembler, Loader, · · · · · · F Bounded buffer.
Concurrent Programming Problems OS Spring Concurrency pros and cons Concurrency is good for users –One of the reasons for multiprogramming Working.
1 CENG334 Introduction to Operating Systems Erol Sahin Dept of Computer Eng. Middle East Technical University Ankara, TURKEY URL:
Process Synchronization. Module 6: Process Synchronization Background The Critical-Section Problem Peterson’s Solution Synchronization Hardware Semaphores.
Operating System Concepts and Techniques Lecture 12 Interprocess communication-1 M. Naghibzadeh Reference M. Naghibzadeh, Operating System Concepts and.
CH7 discussion-review Mahmoud Alhabbash. Q1 What is a Race Condition? How could we prevent that? – Race condition is the situation where several processes.
China’s Software Industry August 2006 Instructor: Hengming Zou, Ph.D.
IT Requirements Capture Process. Motivation for this seminar Discovering system requirements is hard. Formally testing use case conformance is hard. We.
CS 5704 Fall 00 1 Monitors in Java Model and Examples.
Critical Section chapter3.
CHESS: A Systematic Testing Tool for Concurrent Software CSCI6900 George.
Today’s Agenda  HW #3  Replay Monitor Advanced Topics in Software Engineering 1.
Today’s Agenda  Midterm: Nov 3 or 10  Finish Message Passing  Race Analysis Advanced Topics in Software Engineering 1.
CS 106 Introduction to Computer Science I 12 / 04 / 2006 Instructor: Michael Eckmann.
Concurrency.
PARALLEL PROGRAMMING with TRANSACTIONAL MEMORY Pratibha Kona.
1 Tuesday, June 20, 2006 "The box said that I needed to have Windows 98 or better... so I installed Linux." - LinuxNewbie.org.
Concurrent & Distributed Systems Lecture 4: ME solutions Lecture 3 considered possible algorithms for achieving Mutual Exclusion between the critical sections.
COMS Prelim 1 Review Session Yejin Choi Daniel Williams
Chapter 2.3 : Interprocess Communication
Monitors CSCI 444/544 Operating Systems Fall 2008.
Recursion. Recursive Solutions Recursion breaks a problem into smaller identical problems – mirror images so to speak. By continuing to do this, eventually.
Race Conditions CS550 Operating Systems. Review So far, we have discussed Processes and Threads and talked about multithreading and MPI processes by example.
0 Deterministic Replay for Real- time Software Systems Alice Lee Safety, Reliability & Quality Assurance Office JSC, NASA Yann-Hang.
Deterministic Replay of Java Multithreaded Applications Jong-Deok Choi and Harini Srinivasan slides made by Qing Zhang.
CS 3305 Course Overview. Introduction r Instructor: Dr Hanan Lutfiyya r Office: MC 355 r hanan at csd dot uwo ca r Office Hours: m Drop-by m Appointment.
University of Kansas Electrical Engineering Computer Science Jerry James and Douglas Niehaus Information and Telecommunication Technology Center Electrical.
Advanced Synchronization Constructs Related Work: Monitors: An Operating System Structuring, C.A.R Hoare (developing on Brinch Hansen’s concepts) Synchronization.
Nachos Phase 1 Code -Hints and Comments
The Critical Section Problem
Software Component Technology and Component Tracing CSC532 Presentation Developed & Presented by Feifei Xu.
Tutorial 5 Even More Synchronization! presented by: Antonio Maiorano Paul Di Marco.
Concurrency, Mutual Exclusion and Synchronization.
Today’s Agenda  Quick Review  Finish Java Threads  The CS Problem Advanced Topics in Software Engineering 1.
CSE451 NT Synchronization Autumn 2002 Gary Kimura Lecture #9 October 18, 2002.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Mutual Exclusion.
© ABB University - 1 Revision C E x t e n d e d A u t o m a t i o n S y s t e m x A Chapter 4 Engineering Workplace Course T314.
The System and Software Development Process Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
Data Structures R e c u r s i o n. Recursive Thinking Recursion is a problem-solving approach that can be used to generate simple solutions to certain.
Shared Memory Consistency Models. SMP systems support shared memory abstraction: all processors see the whole memory and can perform memory operations.
Chapter 7 -1 CHAPTER 7 PROCESS SYNCHRONIZATION CGS Operating System Concepts UCF, Spring 2004.
Week 14 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
December 1, 2006©2006 Craig Zilles1 Threads and Cache Coherence in Hardware  Previously, we introduced multi-cores. —Today we’ll look at issues related.
Processor Architecture
Today’s Agenda  HW #2 Out  Replay Semaphore and Lock  Advanced Locking Advanced Topics in Software Engineering 1.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-5 Process Synchronization Department of Computer Science and Software.
1 Chapter 9 Distributed Shared Memory. 2 Making the main memory of a cluster of computers look as though it is a single memory with a single address space.
CS510 Concurrent Systems Jonathan Walpole. RCU Usage in Linux.
Concurrency in Shared Memory Systems Synchronization and Mutual Exclusion.
1 Critical Section Problem CIS 450 Winter 2003 Professor Jinhua Guo.
Agenda  Quick Review  Finish Introduction  Java Threads.
Reachability Testing of Concurrent Programs1 Reachability Testing of Concurrent Programs Richard Carver, GMU Yu Lei, UTA.
Homework-6 Questions : 2,10,15,22.
Synchronization Questions answered in this lecture: Why is synchronization necessary? What are race conditions, critical sections, and atomic operations?
6/27/20161 Operating Systems Design (CS 423) Elsa L Gunter 2112 SC, UIUC Based on slides by Roy Campbell, Sam King,
Adding Concurrency to a Programming Language Peter A. Buhr and Glen Ditchfield USENIX C++ Technical Conference, Portland, Oregon, U. S. A., August 1992.
Process Synchronization. Concurrency Definition: Two or more processes execute concurrently when they execute different activities on different devices.
Computer Engineering Department Islamic University of Gaza
IT Business Applications
Architecture Concept Documents
Day 13 Concurrency.
Day 15 Concurrency.
Advanced Topics in Software Engineering 1
Operating Systems : Overview
Operating Systems : Overview
CSE 153 Design of Operating Systems Winter 19
BANKER’S ALGORITHM Prepared by, Prof
Presentation transcript:

Advanced Topics in Software Engineering1 Today’s Agenda  HW #1  Quick Review  Finish The CS Problem  Replay Shared Variables

Advanced Topics in Software Engineering2 Quick Review  What are the three requirements for the critical section problem?

Advanced Topics in Software Engineering3 Tracing/Replay for Shared Variables  Introduction  RW-Sequence  Tracing and Replay  Implementation Issues

Advanced Topics in Software Engineering4 Tracing and Replay Replay is to repeat the behavior of a previous execution of a concurrent program. Tracing is to capture necessary information during a concurrent execution such that it can be repeated later in a controlled fashion.

Advanced Topics in Software Engineering5 Challenges There are a number of challenges to address for tracing and replay:  What exactly should be replayed?  What information should be captured?  How should such information be encoded?

Advanced Topics in Software Engineering6 SYN-sequence A SYN-sequence is a sequence of synchronization operations, i.e. operations that are performed on shared variables or synchronization constructs. A concurrent execution can be repeated, in terms of producing the same results, if the same SYN- sequence is replayed.

Advanced Topics in Software Engineering7 SYN-sequence (cont’d) A SYN-sequence can be object-based or thread- based. An object-based SYN-sequence is associated with a shared object, consisting of all synchronization operations that are executed on that object. A thread-based SYN-sequence is associated with a thread, consisting of all synchronization operations that are executed by that thread.

Advanced Topics in Software Engineering8 SYN-sequence (cont’d) Replay based on SYN-sequences can be accomplished by inserting additional control into programming objects. The alternative is to record thread schedules, i.e., we record information about how context switches are performed. Replay based on thread schedules often involve modifications to the thread scheduler, which is usually more difficult to implement, but can be more efficient.

Advanced Topics in Software Engineering9 Tracing/Replay for Shared Variables  Introduction  RW-sequence  Tracing and Replay  Implementation Issues

Advanced Topics in Software Engineering10 Definition A SYN-sequence for a shared variable is a sequence of read and write operations, called a RW-sequence. Each write operation on a shared variable creates a new version of the variable. An execution can be replayed by ensuring each thread reads and writes the same variable versions that were recorded in the execution trace.

Advanced Topics in Software Engineering11 Encoding For each variable, we keep track of its versions: a write operation increases the version number; a read operation keeps the version number unchanged. In a RW-sequence, a read event is encoded as (ID, version), where ID is the ID of the thread that executes the read event, and version is the current version number.

Advanced Topics in Software Engineering12 Encoding (cont’d) A write event is encoded as (ID, version, total reads), where ID is the ID of the thread that executes the write operation, version is the old version number, and total reads is the number of read operations that read the old version of the variable.

Advanced Topics in Software Engineering13 Encoding (cont’d) There are two important points to be made about the definition of RW-sequence:  We record the order in which read and write operations are performed, not the values that are read and written.  There is no need to record any type information.

Advanced Topics in Software Engineering14 Example T1T2T3 temp = s;temp = s;s = s + 1; Assume that s is initialized to 0. A possible RW- sequence of s is: (3, 0) (1, 0) (3, 0, 2) (2, 1)

Advanced Topics in Software Engineering15 Tracing/Replay for Shared Variables  Introduction  RW-sequence  Tracing and Replay  Implementation Issues

Advanced Topics in Software Engineering16 Tracing and Replay During program tracing, a RW-sequence is recorded for each shared variable. During program replay, we make sure that each read/write operation reads/writes the same version of shared variable as recorded in a RW-sequence.

Advanced Topics in Software Engineering17 Instrumentation Read and write operations are instrumented by adding routines to control the start and end of the operation: startRead(x) read the value of x endRead(x) read startWrite(x ) write the value of x endWrite(x) write

Advanced Topics in Software Engineering18 startRead & endRead startRead (x) if (mode == trace) { ++ x.activeReaders; RWSeq.record(ID, x.version); } else { readEvent r = RWSeq.nextEvent (ID); myVersion = r.getVersion (); while (myVersion != x.version) delay; } endRead (x) ++ x.totalReaders; -- x.activeReaders;

Advanced Topics in Software Engineering19 startWrite & endWrite startWrite (x) if (mode == trace) { while (x.activeReaders > 0) delay; RWSeq.record(ID, x.version, x.totalReaders); } else { writeEvent w = RWSeq.nextEvent (ID); myVersion = w.getVersion (); while (myVersion != x.version) delay; myTotalReaders = w.getTotalReaders (); while (x.totalReaders < myTotalReaders) delay; } endWrite (x) x.totalReaders == 0; ++ x.version;

Advanced Topics in Software Engineering20 CREW If two or more readers read a particular version during tracing, then they must read the same version during replay, but these read operations can be in any order. In our solution, readers are only partially ordered with respect to write operations, while write operations are totally ordered for each shared variable. This is known as Concurrent Reading and Exclusive Writing (CREW) policy.

Advanced Topics in Software Engineering21 C++ Implementation The course pack has shown a template class sharedVariable that can be used to trace and replay C++ programs. The only change involved is to wrap each variable as an instance of sharedVariable. int turn;sharedVariable turn;

Advanced Topics in Software Engineering22 Java Implementation More changes are necessary for Java programs, due to the lack of the features of template class and operator overloading. However, such changes can be made automatically, without leaving developers with too much burden.