
Top : Computers : Programming : Threads :
Java
Websites
Though many Java books and articles recommend double-checked locking, unfortunately, it is not guaranteed to work in Java.
site exerpt
Double-checked locking: Clever, but broken Do you know what synchronized really means? Summary Many Java programmers are familiar with the double-checked locking idiom, which allows you to perform lazy initialization with reduced synchronization overhead. Though many Java books and articles recommend double-checked locking, unfortunately, it...Many authors advocate the double-checked locking idiom to access a Singleton object in an intuitively thread-safe way. Unfortunately, for counterintuitive reasons, double-checked locking doesn't work in Java.
site exerpt
Warning! Threading in a multiprocessor world Threading in a multiprocessor world Find out why many tricks to avoid synchronization overhead just don't work Summary Many authors (myself included at one point) advocate the double-checked locking idiom to access a Singleton object in an intuitively thread-safe way....Discussion of two more architectural solutions to threading problems: a synchronous dispatcher (or 'reactor') and an asynchronous dispatcher (or 'active object').
site exerpt
Programming Java threads in the real world, Part 9 Java threads in the real world, Part 9 More threads in an object-oriented world: Synchronous dispatchers, active objects, detangling console I/O Summary This article finishes up the series on threads with a discussion of two more architectural solutions to threading...Discusses architectural solutions to threading problems. Takes a look at threads from the perspective of an object-oriented designer, and at how to implement threads in an object-oriented environment, focusing on the implementation of asynchronous methods.
site exerpt
Programming Java threads in the real world, Part 8 Java threads in the real world, Part 8 Threads in an object-oriented world, thread pools, implementing socket accept loops Summary The previous installment of Allen's ongoing Java threads series was devoted to low-level solutions to threading problems: locks of various...Reader/writer locks let multiple threads safely access a shared resource in an efficient way.
site exerpt
Programming Java threads in the real world, Part 7 Java threads in the real world, Part 7 Singletons, critical sections, and reader/writer locks Summary This month's column builds on the preceding installments of the Java Toolbox threads series, adding a few more tools to your multithreading arsenal. Columnist Allen...How to implement the Observer pattern (used by AWT/Swing for its event model) in a multithreaded environment.
site exerpt
Programming Java threads in the real world, Part 6 Java threads in the real world, Part 6 The Observer pattern and mysteries of the AWTEventMulticaster Summary This month continues the thread theme by examining how to implement the Observer pattern (used by AWT/Swing for its event model) in a...Timers let you perform fixed-interval operations, such as animation refreshes.
site exerpt
Programming Java threads in the real world, Part 5 Java threads in the real world, Part 5 Has Sun abandoned run anywhere Plus: Threads and Swing, timers, and getting around stop suspend and resume deprecation Summary In an aside to his running series on programming Java threads in the...A condition variable adds to wait the ability to not wait when the condition you're waiting for has already taken place; and a counting semaphore lets you control a pool of resources without sucking up machine cycles in polling loops.
site exerpt
Programming Java threads in the real world, Part 4 Java threads in the real world, Part 4 Condition variables and counting semaphores filling in a few chinks in Java's threading model Summary This column continues where last month's column left off, presenting a few more implementations of classes that...Explains from the ground up how to get threads work correctly. (Chuck Allison)
http://www.cuj.com/java/allison/jun2001.htm
An easy to use library for adding thread management in Java applications. The library comes from early experience with JServ's lack of thread management, and recent posts to the java developer forums. [Open source]
site exerpt
index Applications without thread management. Designed for daily trips to the grocery store, the stylish Pacer was a veritable safety hazard and dropped from production. Applications with thread management. Sensible, safe, and functional, with elegance and performance, the Audi A6 is...Presents two approaches to creating thread-safe singletons.
site exerpt
Singletons with needles and thread Singletons with needles and thread Two approaches to creating thread-safe singletons By Tony Sintes January 25, 2002 n Singletons Rule Effective Object-Oriented Design and n Class Instances I addressed questions regarding the Singleton design pattern. As many readers have since...Introduces the Java Thread API, outlines issues involved in multithreading, and offers solutions to common problems.
http://www-106.ibm.com/developerworks/library/j-thread.html
Takes a look at the semantics and the performance penalty of Java's synchronized keyword.
http://www-106.ibm.com/developer...rks/java/library/j-threads1.html
If you're not careful, threads can disappear from server applications without a (stack) trace. In this article, threading expert Brian Goetz offers some techniques for both prevention and detection of threads going AWOL.
http://www-106.ibm.com/developerworks/library/j-jtp0924.html
Looks at how and why you might want to roll your own exclusion semaphores, and presents a lock manager that will help you safely acquire multiple semaphores.
site exerpt
Programming Java threads in the real world, Part 3 Java threads in the real world, Part 3 Roll-your-own mutexes and centralized lock management Summary In Parts 1 and 2 of this series on threads, Allen looked at some of the pitfalls of writing multithreaded applications in Java. This month,...Discusses the perils that can arise when you approach multithreading in a naive way.
site exerpt
Programming Java threads in the real world, Part 2 Java threads in the real world, Part 2 The perils of race conditions, deadlock, and other threading problems Summary This article, the second in a multipart series on threads, discusses the perils that can arise when you approach multithreading in...Discusses the things you need to know to program threads in the real world. This article assumes you understand the language-level support for threads and focuses on the legion of problems that arise when you try to use these language features.
site exerpt
Programming Java threads in the real world, Part 1 Java threads in the real world, Part 1 A Java programmer's guide to threading architectures Summary Programming Java threads isn't nearly as easy (or as platform-independent) as most books would have you believe, and all Java programs that use the...In this article, Brian Goetz looks at some of the commonly proposed fixes and shows how each of them fails to render the DCL idiom thread-safe under the Java Memory Model.
site exerpt
Can double-checked locking be fixed? World ran two articles on the double-checked locking idiom and its hazards Double-Checked Locking: Clever, but Broken and Warning! Threading in a Multiprocessor World In response to these articles, many JavaWorld readers proposed fixes to the problem. In this article,...Details on the reasons - some very subtle - why double-checked locking cannot be relied upon to be safe. Signed by a number of experts, including Sun engineers.
site exerpt
The Double-Checked Locking is Broken Declaration Locking is widely cited and used as an efficient method for implementing lazy initialization in a multithreaded environment. Unfortunately, it will not work reliably in a platform independent way when implemented in Java. When implemented in other languages, such as...Introduces basic concurrency problems and shows how to solve them by using builtin Java synchronization primitives. (Only sources free accessed without registration)
site exerpt
DevCentral Thread Synchronization in Java Code Lock if we are the first reader lock writers this is what we wanted to do from the pseudo code if( m_reading 0 lock writers But there is no way to do this with synchronized so the writer has to...Read-write locks allow multiple threads to acquire a read lock provided no other thread currently has a write lock on the same object. A thread can acquire a write lock if no other thread owns either a read lock or a write lock.
site exerpt
Read/Write Locks in Java by Amandeep Singh There can be many interesting situations when separate, concurrently running threads need to share data. A commonly given example to explain such a situation is the producer/consumer problem. Another common example is of Airline-Ticketing stations. Consider multiple ticketing stations for...Explores the motivations for thread pools, some basic implementation and tuning techniques, and some common hazards to avoid.
http://www-106.ibm.com/developerworks/library/j-jtp0730.html
Explains how to apply consistent rules for acquiring multiple locks simultaneously, to reduce the likelihood of synchronization deadlocks.
site exerpt
Avoid synchronization deadlocks Avoid synchronization deadlocks Use a consistent, defined synchronization ordering to keep your apps running Summary Though essential for ensuring the thread safety of Java classes, synchronization, if used improperly, can create the possibility for deadlocks. If you understand how your...Explains how to fix the double-checked locking idiom by using thread-local variables and takes a look at its performance.
site exerpt
Can ThreadLocal solve the double-checked locking problem? Local appears to fix the thread-safety issues behind double-checked locking Summary It has been suggested that java.lang.ThreadLocal can be used to fix the problems with the double-checked locking (DCL) idiom once and for all. ThreadLocal is indeed an underappreciated tool...Explains the use of thread pools to create better performing applications.
http://www.devx.com/upload/free/...o/2000/10oct00/tm0010/tm0010.asp
Takes a look at one of the most-used constructs in multithreaded programming: the producer-consumer scenario. Also shows a Consumer class which facilitates code reuse and simplifies debugging and maintenance in some multithreaded applications.
http://www-106.ibm.com/developerworks/java/library/j-prodcon/
Explains why contended synchronization is a problem and then explores several techniques for reducing contention, and hence improving scalability.
http://www-106.ibm.com/developer...rks/java/library/j-threads2.html
Examines ThreadLocal and offers tips for exploiting its power.
http://www-106.ibm.com/developer...rks/java/library/j-threads3.html
Examines the roots of the double-checked locking idiom, why it was developed, and why it doesn't work.
http://www-106.ibm.com/developerworks/java/library/j-dcl.html
Java's threading model is entirely inadequate for programs of realistic complexity and isn't in the least bit object oriented.
http://www-106.ibm.com/developerworks/library/j-king.html
Focuses on thread groups, volatility, thread-local variables, timers, and the ThreadDeath class. Also describes how various thread concepts combine to finalize objects.
site exerpt
Achieve strong performance with threads, Part 4 Achieve strong performance with threads, Part 4 Discover thread groups, volatility, thread-local variables, timers, and the ThreadDeath class Summary In this final series article, Jeff Friesen completes his exploration of threads by focusing on thread groups, volatility, thread-local variables, timers,...Explains how priority relates to thread scheduling and how to use the wait/notify mechanism to coordinate the activities of multiple threads.
site exerpt
Achieve strong performance with threads, Part 3 Achieve strong performance with threads, Part 3 Learn about thread scheduling, the wait/notify mechanism, and thread interruption Summary Jeff Friesen's four-part thread series continues with an investigation of thread scheduling, the wait/notify mechanism, and thread interruption. In Part 3, Friesen...Explains synchronization, Java's synchronization mechanism, and two problems that arise when developers fail to use that mechanism correctly.
site exerpt
Achieve strong performance with threads, Part 2 Achieve strong performance with threads, Part 2 Use synchronization to serialize thread access to critical code sections Summary Developers sometimes create multithreaded programs that produce erroneous values or exhibit other strange behaviors. Odd behavior typically arises when a multithreaded program...Gives an introduction to threads and explores the Thread class and runnables.
site exerpt
Achieve strong performance with threads, Part 1 Achieve strong performance with threads, Part 1 Introducing threads, the Thread class, and runnables Summary Users expect programs to exhibit strong performance. To satisfy those expectations, your programs often use threads. This article begins a four-part series that examines threads....Article by Neel V. Kumar. A tour in the land of multithreading in Java. Introduces the mechanisms and demonstrates how to use them in limited but very common cases.
http://www-106.ibm.com/developer...orks/library/multithreading.html
By Edward Harned. This article takes the multi-threading structures available today to the next level by making professional quality, Open Source code available to all programmers.
http://java.ittoolbox.com/browse...Fpub%2FEH111402%2Farticle%2Ehtml
Concurrent programming in Java applications is more complicated than it looks: there are several subtle (and not so subtle) ways to create data races and other concurrency hazards in Java programs. In this installment of Java theory and practice, Brian Goetz looks at a common threading hazard: allowing the this reference to escape during construction. This harmless-looking practice can cause unpredictable and undesirable results in your Java programs.
http://www-106.ibm.com/developerworks/library/j-jtp0618.html
Examines the performance of the Linux kernel when the system is running a heavily threaded Java program using the IBM Java Developer Kit for Linux.
http://www-106.ibm.com/developerworks/library/j-java2/
Message Driven Thread API for Java, which enables deadlock safe, multithreaded, concurrent, high level communication between threads.
site exerpt
mdthread.org Message-Driven Thread API for Java ...Discussion of thread cancellation techniques in Java. (excerpt from Doug Lea's Concurrent Programming in Java book)
site exerpt
Cancellation This set of excerpts from section 3.1 includes the main discussions of cancellation techniques that are further exemplified throughout the book. When activities in one thread fail or change course, it may be necessary or desirable to cancel activities in...A comprehensive course covering all aspects of multi-thread programming in Java from plain synchronization over Java 5.0 concurrency utilities to memory model issues.
site exerpt
AngelikaLanger.com This page has been moved Angelika Langer Training/Consulting AngelikaLanger Training Consulting HOME SEMINARS TALKS ARTICLES BOOKS LINKS IOSTREAMS GENERICS ABOUT NEWSLETTER CONTACT SITEMAP This page has been moved. HOME SEMINARS TALKS ARTICLES BOOKS LINKS IOSTREAMS GENERICS ABOUT NEWSLETTER CONTACT SITEMAP Click HERE for new location. Copyright 1995-2005 by...Explains how the new atomic variable classes in JDK 5.0 enable the development of highly scalable nonblocking algorithms in the Java language.
http://www-106.ibm.com/developerworks/java/library/j-jtp11234/
Producer Consumer, Dining Philosophers, Reader Writer problems. Applet demonstration, design diagram. Source code accessable by e-mail request.
site exerpt
Thread Synchronization ...Presents some predictions of how concurrent programming might evolve during until 2015.
site exerpt
A Critique of Java for Concurrent Programming The number of processors in a commercial microprocessor chip has been increasing by a factor of two every year, so your desktop has at least a thousand processors. Furthermore, your desktop is connected to millions of other processors whose power...