Newsletter sign-up
View all newsletters

Sign up for our technology specific newsletters.

Enterprise Java
Email Address:

Thread-safe design (4/20/99)

The JavaWorld experts answer your most pressing Java questions -- every week

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone

Page 2 of 2

This situation is safe, as long as A and B are really independent and given than they remain independent after subsequent changes to the server. If A and B aren't truly independent, we can end up with what is called deadlock, a situation in which the first client has A and also needs B, while the second client has B and also needs A. This is a special case of starvation, in which the client shares responsibility for its own starvation. Note that Oaks and Wong state in Java Threads that "Deadlock ... is the hardest problem to solve in any threaded program."

In summation, thread-safe programming seeks to maximize efficiency by eliminating racing situations, while at the same time avoiding starvation situations.

About the author

Random Walk Computing is the largest Java/CORBA consulting boutique in New York, focusing on solutions for the financial enterprise. Known for their leading-edge Java expertise, Random Walk consultants publish and speak about Java in some of the most respected forums in the world.
  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Comment
Login
Forgot your account info?
Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a JavaWorld account? Log in here. Register now for a free account.
Resources
  • Java Threads, Second Edition, Scott Oaks, Henry Wong, et al. (O'Reilly, 1999) http://www1.fatbrain.com/asp/bookinfo/bookinfo.asp?theisbn=1565924185