Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: Advanced Synchronization in Java Threads

In this chapter, we look at some of the more advanced issues related to data synchronization--specifically, timing issues related to data synchronization. When you write a Java program that makes use of several threads, issues related to data synchronizat

Tutorial Details:

Often an error in data synchronization can be masked in the code by timing dependencies. You may notice some sort of data corruption in a normal run of your program, but when you run the program in a debugger or add some debugging statements to the code, the timing of the program is completely changed, and the data synchronization error no longer occurs.

These issues can't be simply solved. Instead, developers need to design their programs with these issues in mind. Developers need to understand what the different threading issues are: what are the causes, what they should look for, and the techniques they should use to avoid and mitigate them. Developers should also consider using higher-level synchronization tools--tools that provide the type of synchronization needed by the program and that are known to be threadsafe. We examine both of these ideas in this chapter.
Synchronization Terms
Programmers with a background in a particular threading system generally tend to use terms specific to that system to refer to some of the concepts we discuss in this chapter, and programmers without a background in certain threading systems may not necessarily understand the terms we use. So here's a comparison of particular terms you may be familiar with and how they relate to the terms in this chapter:


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Advanced Synchronization in Java Threads

View Tutorial:
Advanced Synchronization in Java Threads

Related Tutorials:

Programming Java threads in the real world, Part 1 - JavaWorld - September 1998
Programming Java threads in the real world, Part 1 - JavaWorld - September 1998
 
Programming Java threads in the real world, Part 2 - JavaWorld - October 1998
Programming Java threads in the real world, Part 2 - JavaWorld - October 1998
 
Programming Java threads in the real world, Part 8
Programming Java threads in the real world, Part 8
 
Programming Java threads in the real world, Part 9 - JavaWorld June 1999
Programming Java threads in the real world, Part 9 - JavaWorld June 1999
 
Use the JVM Profiler Interface for accurate timing - JavaWorld
Use the JVM Profiler Interface for accurate timing - JavaWorld
 
Double-checked locking: Clever, but broken - JavaWorld February 2001
Double-checked locking: Clever, but broken - JavaWorld February 2001
 
Master Java with these introductory books - JavaWorld May 2001
Master Java with these introductory books - JavaWorld May 2001
 
Can double-checked locking be fixed? - JavaWorld May 2001
Can double-checked locking be fixed? - JavaWorld May 2001
 
Avoid synchronization deadlocks
Avoid synchronization deadlocks
 
Can ThreadLocal solve the double-checked locking problem?
Can ThreadLocal solve the double-checked locking problem?
 
Achieve strong performance with threads, Part 1
Achieve strong performance with threads, Part 1
 
Achieve strong performance with threads, Part 2
Achieve strong performance with threads, Part 2
 
Transparently cache XSL transformations with JAXP
Transparently cache XSL transformations with JAXP
 
High-availability mobile applications
High-availability mobile applications
 
Very interesting
Very interesting
 
elegant turnaround
elegant turnaround
 
Fixing the Java Memory Model, Part 2
Writing concurrent code is hard to begin with; the language should not make it any harder. While the Java platform included support for threading from the outset, including a cross-platform memory model that was intended to provide \"Write Once, Run Anywh
 
The ABCs of Synchronization, Part 1
Threads may execute in a manner where their paths of execution are completely independent of each other. Neither thread depends upon the other for assistance. For example, one thread might execute a print job, while a second thread repaints a window. And
 
Advanced Synchronization in Java Threads
In this chapter, we look at some of the more advanced issues related to data synchronization--specifically, timing issues related to data synchronization. When you write a Java program that makes use of several threads, issues related to data synchronizat
 
Understanding MIDP System Threads
Describes the multi-threaded aspects of the J2ME application environment. Understanding the interactions between systems threads, user-interface and application threads will help in avoiding MIDlet deadlock.
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.