SlideShare a Scribd company logo
Practical Concurrency January, 2009 http://javadom.blogspot.com/2011/06/lecture-on-java-concurrency-day-2.html
Day 2 (9am, Feb 4, 2009) Concurrency Concerns Performance Concurrency Design
2-1 Concurrency Concerns Correctness Liveness
Correctness (Multi-threaded Safety) Conflicts Read-write conflicts Write-write conflicts
Liveness Blockages Lock Wait Input CPU contention Failure
Deadlock A situation wherein two or more competing actions are waiting for the other to finish, and thus neither ever does. Lock-ordering deadlock Dynamic lock-ordering deadlock Resource deadlock Thread-starvation deadlock
Livelock similar to a deadlock, except that the states of the processes involved in the livelock constantly change with regard to one another, none progressing
2-2 Performance Amdahl’s law Context Switch Overhead Memory Barrier Overhead
Amdahl’s law
Context Switch Overhead All the Registers Program Control Block Kernel stack User Area Text/data/ stack
Memory Barrier a class of instructions which cause a central processing unit (CPU) to enforce an ordering constraint on memory operations issued before and after the barrier instruction. Assures ordered access and memory visibility in multi-processor environments Accessing volatile fields are usually implemented using memory barrier
2-3 Concurrency Design Concurrency Design Step Concerns Objects in Worker Thread Model Collection Design
Steps of Designing Concurrency Identify Shared Resources Identify Critical Sections Design Lock Granularity Check multiple locking sanity Check long critical sections Check possible locking order problems
Concerns on Designing Concurrency Liveness Deadlock Starvation Waiting Performance Context switching overhead Lock contention
Further considerations Thread confinement Locking itself is not critical overhead Lock contention and context switching is.
Worker Threads Worker threads One thread to execute many unrelated tasks Aka., background threads or thread pools (when more than one thread is used) Object life cycle and work threads Instance sharing New instance per work Worker threads and Instance variables
Worker Threads and Objects JavaEE EJB Session Bean Stateless session bean objects are pooled The container assures the serialized access to each objects (so, always thread-safe) Statefull session bean might throw ConcurrentAccessException JavaEE Servlet Servlet object life cycle Objects per Request/Session/Page/Application lifecycle
Worker Threads and Objects (2) JMX MBean (Local/Connector) Creates new thread per messages Just like the servlet model ProBus Process(or Flow) Use the same Flow class and LProcess objects are created per flow instances (contentions against Lprocess and …) BizMaster Workflow Process Per-process class is generated and no process instances (contentions against RuntimeContext and …) ProBus Adapter Rule Just like the servlet model

More Related Content

PPT
Lecture on Java Concurrency Day 3 on Feb 11, 2009.
PPTX
PPTX
Basic Thread Knowledge
PPT
The Pillars Of Concurrency
PPTX
Multithreading models.ppt
PPTX
THREADS of Operating System by Noman Zahid
PPTX
.NET: Thread Synchronization Constructs
Lecture on Java Concurrency Day 3 on Feb 11, 2009.
Basic Thread Knowledge
The Pillars Of Concurrency
Multithreading models.ppt
THREADS of Operating System by Noman Zahid
.NET: Thread Synchronization Constructs

What's hot (20)

PPTX
Threads (operating System)
PPTX
Thread presentation
PDF
Thread
PPTX
Multi threading model
PPTX
Threads
PPTX
Concurrency in Java
PPTX
Networking threads
PPT
Operating System-Threads-Galvin
PPTX
threads and its types ....in operating system ..
PPTX
Thread (Operating System)
PPTX
Operating system: threads(mulithreading,benefits of threads, types of thread)
PPTX
Multi-Threading
PPTX
Singleton Design Pattern - Creation Pattern
PPT
Single thread interface in servlet
PPTX
Multithreading
PPT
Operating System 4
PPTX
Threading in C#
PPT
Ch4 Threads
PPTX
Thread&multithread
Threads (operating System)
Thread presentation
Thread
Multi threading model
Threads
Concurrency in Java
Networking threads
Operating System-Threads-Galvin
threads and its types ....in operating system ..
Thread (Operating System)
Operating system: threads(mulithreading,benefits of threads, types of thread)
Multi-Threading
Singleton Design Pattern - Creation Pattern
Single thread interface in servlet
Multithreading
Operating System 4
Threading in C#
Ch4 Threads
Thread&multithread
Ad

Viewers also liked (9)

PPTX
GlassFish Roadmap
PDF
Topic 4: Concurrency
PPTX
SBJUG - Building Beautiful Batch Jobs
PDF
How does pair programming work?
PDF
Design & Develop Batch Applications in Java/JEE
PDF
JSR 352 “Batch Applications for the Java Platform”
PDF
20160215 04 java ee7徹底入門 jbatch
PDF
Jbatch実践入門 #jdt2015
PDF
Java Batch 仕様 (Public Review時点)
GlassFish Roadmap
Topic 4: Concurrency
SBJUG - Building Beautiful Batch Jobs
How does pair programming work?
Design & Develop Batch Applications in Java/JEE
JSR 352 “Batch Applications for the Java Platform”
20160215 04 java ee7徹底入門 jbatch
Jbatch実践入門 #jdt2015
Java Batch 仕様 (Public Review時点)
Ad

Similar to Lecture on Java Concurrency Day 2 on Feb 4, 2009. (20)

ODP
Multithreading 101
PDF
Concurrency in Java
PDF
Concurrent Programming in Java
PPT
Shopzilla On Concurrency
PDF
Java Tutorials - Concurrency
PPT
Java Threading
ODP
Java Concurrency, Memory Model, and Trends
PDF
Multithreading 101
PPTX
Threading through InterBase, Firebird, and beyond
PDF
Concurrency-5.pdf
PPT
Threads in java, Multitasking and Multithreading
PDF
.Net Threading
PPTX
chap 7 : Threads (scjp/ocjp)
PDF
Need for Async: Hot pursuit for scalable applications
PDF
Concurrency in java
ODP
Concept of thread
PDF
Java concurrency in practice
PDF
The Need for Async @ ScalaWorld
DOCX
Processes and threads
PPTX
Threading.pptx
Multithreading 101
Concurrency in Java
Concurrent Programming in Java
Shopzilla On Concurrency
Java Tutorials - Concurrency
Java Threading
Java Concurrency, Memory Model, and Trends
Multithreading 101
Threading through InterBase, Firebird, and beyond
Concurrency-5.pdf
Threads in java, Multitasking and Multithreading
.Net Threading
chap 7 : Threads (scjp/ocjp)
Need for Async: Hot pursuit for scalable applications
Concurrency in java
Concept of thread
Java concurrency in practice
The Need for Async @ ScalaWorld
Processes and threads
Threading.pptx

More from Kyung Koo Yoon (12)

PDF
Kubernetes
PDF
Java 8 고급 (6/6)
PDF
Java 8 고급 (5/6)
PDF
Java 8 고급 (4/6)
PDF
Java 8 고급 (3/6)
PDF
Java 8 고급 (2/6)
PDF
Java 8 고급 (1/6)
PDF
Spring Framework - Inversion of Control Container
PDF
Smart software engineer
PPT
Lecture on Java Concurrency Day 4 on Feb 18, 2009.
PPT
Lecture on Java Concurrency Day 1 on Jan 21, 2009.
PPTX
창의와 열정, 소프트웨어 엔지니어
Kubernetes
Java 8 고급 (6/6)
Java 8 고급 (5/6)
Java 8 고급 (4/6)
Java 8 고급 (3/6)
Java 8 고급 (2/6)
Java 8 고급 (1/6)
Spring Framework - Inversion of Control Container
Smart software engineer
Lecture on Java Concurrency Day 4 on Feb 18, 2009.
Lecture on Java Concurrency Day 1 on Jan 21, 2009.
창의와 열정, 소프트웨어 엔지니어

Recently uploaded (20)

PDF
NewMind AI Weekly Chronicles - August'25-Week II
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
A comparative analysis of optical character recognition models for extracting...
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Machine Learning_overview_presentation.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PPT
Teaching material agriculture food technology
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Encapsulation theory and applications.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
cuic standard and advanced reporting.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
NewMind AI Weekly Chronicles - August'25-Week II
“AI and Expert System Decision Support & Business Intelligence Systems”
A comparative analysis of optical character recognition models for extracting...
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
MIND Revenue Release Quarter 2 2025 Press Release
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Big Data Technologies - Introduction.pptx
Empathic Computing: Creating Shared Understanding
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Machine Learning_overview_presentation.pptx
Encapsulation_ Review paper, used for researhc scholars
Teaching material agriculture food technology
sap open course for s4hana steps from ECC to s4
Encapsulation theory and applications.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
cuic standard and advanced reporting.pdf
Programs and apps: productivity, graphics, security and other tools
20250228 LYD VKU AI Blended-Learning.pptx

Lecture on Java Concurrency Day 2 on Feb 4, 2009.

  • 1. Practical Concurrency January, 2009 http://javadom.blogspot.com/2011/06/lecture-on-java-concurrency-day-2.html
  • 2. Day 2 (9am, Feb 4, 2009) Concurrency Concerns Performance Concurrency Design
  • 3. 2-1 Concurrency Concerns Correctness Liveness
  • 4. Correctness (Multi-threaded Safety) Conflicts Read-write conflicts Write-write conflicts
  • 5. Liveness Blockages Lock Wait Input CPU contention Failure
  • 6. Deadlock A situation wherein two or more competing actions are waiting for the other to finish, and thus neither ever does. Lock-ordering deadlock Dynamic lock-ordering deadlock Resource deadlock Thread-starvation deadlock
  • 7. Livelock similar to a deadlock, except that the states of the processes involved in the livelock constantly change with regard to one another, none progressing
  • 8. 2-2 Performance Amdahl’s law Context Switch Overhead Memory Barrier Overhead
  • 10. Context Switch Overhead All the Registers Program Control Block Kernel stack User Area Text/data/ stack
  • 11. Memory Barrier a class of instructions which cause a central processing unit (CPU) to enforce an ordering constraint on memory operations issued before and after the barrier instruction. Assures ordered access and memory visibility in multi-processor environments Accessing volatile fields are usually implemented using memory barrier
  • 12. 2-3 Concurrency Design Concurrency Design Step Concerns Objects in Worker Thread Model Collection Design
  • 13. Steps of Designing Concurrency Identify Shared Resources Identify Critical Sections Design Lock Granularity Check multiple locking sanity Check long critical sections Check possible locking order problems
  • 14. Concerns on Designing Concurrency Liveness Deadlock Starvation Waiting Performance Context switching overhead Lock contention
  • 15. Further considerations Thread confinement Locking itself is not critical overhead Lock contention and context switching is.
  • 16. Worker Threads Worker threads One thread to execute many unrelated tasks Aka., background threads or thread pools (when more than one thread is used) Object life cycle and work threads Instance sharing New instance per work Worker threads and Instance variables
  • 17. Worker Threads and Objects JavaEE EJB Session Bean Stateless session bean objects are pooled The container assures the serialized access to each objects (so, always thread-safe) Statefull session bean might throw ConcurrentAccessException JavaEE Servlet Servlet object life cycle Objects per Request/Session/Page/Application lifecycle
  • 18. Worker Threads and Objects (2) JMX MBean (Local/Connector) Creates new thread per messages Just like the servlet model ProBus Process(or Flow) Use the same Flow class and LProcess objects are created per flow instances (contentions against Lprocess and …) BizMaster Workflow Process Per-process class is generated and no process instances (contentions against RuntimeContext and …) ProBus Adapter Rule Just like the servlet model

Editor's Notes

  • #7: Deadlock :circular dependencies among locks Livelock : a continously retried action countinously fails
  • #10: rs represents the ratio of the sequential portion in one program
  • #11: Process Context Switch Overhead : text/data/stack (user area), kernel stack Thread Context Switch Overhead : stack (user), kernel stack