|Sent on:||Monday, September 2, 2013 10:19 AM|
On Sat,[masked] at 11:43 -0400, Linesh wrote:Java programmers have, for the past 18 years, been taught that
> "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.
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: www.russel.org.uk 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: http://www.meetup.com/Londonjavacommunity/members/8819202/
Set my mailing list to email mehttp://www.meetup.com/Londonjavacommunity/list_prefs/?pref=1
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]