HXY Debugging Made by 14302010050. Contents 目录 History of Java MT Sequential & Parallel Different types of bugs Debugging skills.

Slides:



Advertisements
Similar presentations
1 Interprocess Communication 1. Ways of passing information 2. Guarded critical activities (e.g. updating shared data) 3. Proper sequencing in case of.
Advertisements

Concurrency: Deadlock and Starvation Chapter 6. Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate.
1 Chapter 5 Concurrency: Mutual Exclusion and Synchronization Principals of Concurrency Mutual Exclusion: Hardware Support Semaphores Readers/Writers Problem.
Global Environment Model. MUTUAL EXCLUSION PROBLEM The operations used by processes to access to common resources (critical sections) must be mutually.
CS492B Analysis of Concurrent Programs Lock Basics Jaehyuk Huh Computer Science, KAIST.
Concurrency Important and difficult (Ada slides copied from Ed Schonberg)
Chapter 2 Processes and Threads
Chapter 6: Process Synchronization
EEE 435 Principles of Operating Systems Interprocess Communication Pt II (Modern Operating Systems 2.3)
Interprocess Communication
Parallel Processing (CS526) Spring 2012(Week 6).  A parallel algorithm is a group of partitioned tasks that work with each other to solve a large problem.
Threading Part 2 CS221 – 4/22/09. Where We Left Off Simple Threads Program: – Start a worker thread from the Main thread – Worker thread prints messages.
EEE 435 Principles of Operating Systems Interprocess Communication Pt I (Modern Operating Systems 2.3)
Avishai Wool lecture Introduction to Systems Programming Lecture 4 Inter-Process / Inter-Thread Communication.
Concurrent Processes Lecture 5. Introduction Modern operating systems can handle more than one process at a time System scheduler manages processes and.
CS533 Concepts of Operating Systems Class 7 Integrated Task and Stack Management.
Chapter 11 Operating Systems
CS533 - Concepts of Operating Systems 1 CS533 Concepts of Operating Systems Class 8 Synchronization on Multiprocessors.
CPS110: Implementing threads/locks on a uni-processor Landon Cox.
Parallel Processing (CS526) Spring 2012(Week 8).  Thread Status.  Synchronization in Shared Memory Programming(Java threads ) ◦ Locks ◦ Barriars.
1 Thread II Slides courtesy of Dr. Nilanjan Banerjee.
Object Oriented Analysis & Design SDL Threads. Contents 2  Processes  Thread Concepts  Creating threads  Critical sections  Synchronizing threads.
Programming Paradigms for Concurrency Part 2: Transactional Memories Vasu Singh
1 Java Threads Instructor: Mainak Chaudhuri
Java Threads 11 Threading and Concurrent Programming in Java Introduction and Definitions D.W. Denbo Introduction and Definitions D.W. Denbo.
Today’s Agenda  Quick Review  Finish Java Threads  The CS Problem Advanced Topics in Software Engineering 1.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Mutual Exclusion.
TANNENBAUM SECTION 2.3 INTERPROCESS COMMUNICATION OPERATING SYSTEMS.
Copyright © 1997 – 2014 Curt Hill Concurrent Execution of Programs An Overview.
COMP 111 Threads and concurrency Sept 28, Tufts University Computer Science2 Who is this guy? I am not Prof. Couch Obvious? Sam Guyer New assistant.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Mutual Exclusion.
Producer-Consumer Problem The problem describes two processes, the producer and the consumer, who share a common, fixed-size buffer used as a queue.bufferqueue.
Kernel Locking Techniques by Robert Love presented by Scott Price.
Chapter 7 -1 CHAPTER 7 PROCESS SYNCHRONIZATION CGS Operating System Concepts UCF, Spring 2004.
Consider the program fragment below left. Assume that the program containing this fragment executes t1() and t2() on separate threads running on separate.
1 Interprocess Communication (IPC) - Outline Problem: Race condition Solution: Mutual exclusion –Disabling interrupts; –Lock variables; –Strict alternation.
15.1 Threads and Multi- threading Understanding threads and multi-threading In general, modern computers perform one task at a time It is often.
CS399 New Beginnings Jonathan Walpole. 2 Concurrent Programming & Synchronization Primitives.
Copyright © Curt Hill Concurrent Execution An Overview for Database.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
1 Previous Lecture Overview  semaphores provide the first high-level synchronization abstraction that is possible to implement efficiently in OS. This.
CSCI1600: Embedded and Real Time Software Lecture 17: Concurrent Programming Steven Reiss, Fall 2015.
Debugging In a Multi- Threads Program. Contents Advantages Of Multithreaded Programs Characteristics Of Sequential and Multithreaded Programs.
Copyright © Curt Hill More on Operating Systems Continuation of Introduction.
Concurrency in Java MD. ANISUR RAHMAN. slide 2 Concurrency  Multiprogramming  Single processor runs several programs at the same time  Each program.
Mutual Exclusion -- Addendum. Mutual Exclusion in Critical Sections.
Linux Kernel Development Chapter 8. Kernel Synchronization Introduction Geum-Seo Koo Fri. Operating System Lab.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Mutual Exclusion Mutexes, Semaphores.
CS162 Section 2. True/False A thread needs to own a semaphore, meaning the thread has called semaphore.P(), before it can call semaphore.V() False: Any.
Lecture 5 Page 1 CS 111 Summer 2013 Bounded Buffers A higher level abstraction than shared domains or simple messages But not quite as high level as RPC.
Kernel Synchronization David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
Tutorial 2: Homework 1 and Project 1
Interprocess Communication Race Conditions
Multithreading / Concurrency
Multi Threading.
PARALLEL PROGRAM CHALLENGES
Background on the need for Synchronization
Multicore Programming Final Review
Atomic Operations in Hardware
Atomic Operations in Hardware
Producer-Consumer Problem
Last Week Introduced operating systems Discussed the Kernel
Shared Memory Programming
Software Transactional Memory Should Not be Obstruction-Free
CSCI1600: Embedded and Real Time Software
CS333 Intro to Operating Systems
CSCI1600: Embedded and Real Time Software
Atomicity, Mutex, and Locks
Synchronization and liveness
Presentation transcript:

HXY Debugging Made by

Contents 目录 History of Java MT Sequential & Parallel Different types of bugs Debugging skills

Part One History of Java MT 01

JDK 1.0: as a basic and essence, preemptive and cooperative multitasking History of Java MT JDK 1.2: abolish stop(), suspend(), resume() JDK 5.0 & JSR: happens- before, Lock-free(CAS) JDK 6.0 & 7.0: CyclicBarrier, spin lock, CountDownLatch

Part Two Sequential & Parallel 02

Thread Model Multi threaded apartment: There is only one block in each process, which takes control of more than one thread Single threaded apartment: Each thread is divided into a block in the process, sharing data in blocks. Single thread: One thread in one process, other process must wait until the previous ends. Thread model

Sequential & Parallel Sequential Parallel pros cons Faster only if when there is more CPUs because of higher efficiency and full use of CPU Easier to learn and has less problem, spend no time on shifting from one thread to the other. There may occur many problem when visiting public variables or methods. Some CPUs are left waiting and may cause many waste, which result in worse performance.

Part Three Different types of bugs 03

Every thread in the set are waiting for other thread’s signal to get start. Dead lock Tear apart the thread that can’t be divided by other threads. Atomicity violation The non-deterministic of the order of the executing order of threads. Ordering violation Wrongly visit the sharing memory without proper synchronization Data race Types of bug

Part Four Debugging skills 04

Cancel all threads in dead lock. Cancel some threads in the dead lock until the lock set free. Force the process to give up some resource until the dead lock is set free. Rob other process of their resource and relocate enough of it to the dead lock to set the lock free. Dead lock

Ordering violation Add lock to protect the atomicity of the operation, preventing it from being interrupted by other threads, guarantee the execution order to some extent. Add lock & Synchronize Checking the condition is a common solution to the problem. The critical part is to be sure that the extra conditional statement works at your will. Use condition checking

Data race A specific kind of race condition involves checking for a predicate Acting on the predicate, while the state can change between the time of check and the time of use. Strictly speaking, data race is just a special type of atomicity violation. Data race

1. lock before line 2 and unlock after line 6 2. put lines 6–8 and line 8 each into one critical region. 3. Two patches that separately fix the above two atomicity violations could deadlock with each other Debug method Atomicity violation

HXY Thank You Made by