addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwchatcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrosseditemptyheartexportfacebookfolderfullheartglobegmailgoogleimageimagesinstagramlinklocation-pinmagnifying-glassmailminusmoremuplabelShape 3 + Rectangle 1outlookpersonplusprice-ribbonImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruseryahoo

Re: [ljc] what is the best book to master multi-threading.

From: Martijn V.
Sent on: Monday, September 2, 2013 10:19 AM
+1 to this - it's great to read about and to understand what the state of the art is for Java/The JVM up until now. It'll greatly assist you in making the right threading technology choice for avoiding some of it's fundamental pitfalls (shared mutable state being the real killer here).

Martin Thompson also recently wrote about lock vs lock free algorithms as well, definitely worth a read to understand his motivations for lock free -->


On 2 September[masked]:22, Russel Winder <[address removed]> wrote:
On Sat,[masked] at 11:43 -0400, Linesh wrote:
> "Concurrent Programming in Java: Design Principles and Patterns" by
> Doug Lea.
> No matter which book you read, you will need to study relevant Java
> API documentation in-depth, i.e. Object, Thread, Runnable, concurrent
> package etc.

Java programmers have, for the past 18 years, been taught that
shared-memory multi-threading is what concurrency and parallelism is all
about. That threads, locks, monitors, semaphores, mutexes, etc. are the
stuff of concurrent and parallel programming. This has been a bad thing
for Java  programming.

Remember that all these techniques are ones for implementing operating
systems. Almost the entire theory of concurrency and parallelism is
founded on techniques required for realizing operating systems that
applications programmers have been told is all there is. And Java made
things worse in 1994 by reifying it all in the language.

By all means read the books and learn, it is all good stuff. However for
writing concurrent and parallel applications there are higher level
models (realized over thread pools, definitely). Actors, dataflow,
communicating sequential processes (CSP), data parallelism (streams in
JDK8) are architectural and design models that do away with the need for
explicit locks etc. since the synchronization is an integral part of the

Even just using appropriate data structure, e.g. ConcurrentHashMap,
where appropriate, stops us using locks even if using explicit threads
rather than managed thread pools.

How many of you explicitly manage the Java stack in your code?

How many of you explicitly manage the Java heap in your code?

How many of you explicitly manage the Java threads in your code?

My bet is few, few, many. You should stop believing you have to
explicitly manage threads. Threads should be managed infrastructure (*)
just as stack and heap are.

Extended polemic available on request.

(*) I agree there are some very few cases where explicit shared memory
multi-threading with explicit heap control is required. I've been there
trying to implement Java ME on smartcards.
Dr Russel Winder      t: [masked]   voip: sip:[address removed]
41 Buckmaster Road    m: [masked]   xmpp: [address removed]
London SW11 1EN, UK   w:  skype: russel_winder

Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Russel Winder ([address removed]) from LJC - London Java Community.
To learn more about Russel Winder, visit his/her member profile:
Set my mailing list to email me

As they are sent

In one daily email

Don't send me mailing list messages
Meetup, POB 4668 #37895 NY NY USA 10163 | [address removed]

Our Sponsors

  • Our Blog

    Read the latest news from the LJC

  • RecWorks Ltd

    Fixing Tech Recruitment using the Power of Community

  • jClarity

    Java/JVM Performance Analysis Tools & mentoring for Java related matters

  • LJC Aggrity

    Our LJC Aggrity site contains blog posts from our members

  • LJC Book Club

    Our Book club with book reviews from our members

  • Devoxx UK

    Java Community Conference in collaboration with the LJC, 8-10th June 16

  • SkillsMatter

    "Host, help organise, promote, film many of our meetings."

  • IBM

    Build Enterprise-grade apps at start-up speed.

  • New Relic

    New Relic makes sense of billions of metrics a day in real time.

  • Hazelcast

    Hazelcast is the leader in operating in-memory computing.

  • Java.Net

    We are an official Java User Group recognised by Oracle's JUG program

  • JRebel

    Free 3 month J-Rebel license.

  • O'Reilly

    40% discount on printed books and 50% on e-books.

  • Craft Rebellion

    Your choice of fresh craft beer, delivered. For 10% off use ‘LJC'

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy