Announcing: Slashdot Deals - Explore geek apps, games, gadgets and more. (what is this?)

Thank you!

We are sorry to see you leave - Beta is different and we value the time you took to try it out. Before you decide to go, please take a look at some value-adds for Beta and learn more about it. Thank you for reading Slashdot, and for making the site better!



How an Online-Only TV Series Stays Successful

myawn Re:Eek. (163 comments)

All things in moderation

Especially moderation.

more than 5 years ago

Why COBOL Could Come Back

myawn The real skill is 'thinking before coding' (405 comments)

One thing about the mainframe coding mentality was that compilation time was expensive, processing time was expensive, and sophisticated debuggers didn't exist (and it's expensive to print 500+ page core dumps on fanfold paper). So programmers tended to do much more up-front design so that the first effort tended to be much higher quality.

Or, as I saw on someone's whiteboard once, "It's easier to teach a COBOL programmer C than to teach a C programmer discipline".

more than 6 years ago



myawn myawn writes  |  more than 7 years ago

myawn writes "Threading has been an integral part of Java since the 1.0 release. Up until Java 5.0, you could know everything you needed to know about threads if you understood the 'synchronized' keyword and the Object wait(), notify(), and notifyAll() methods. Yet mastering this seemingly small amount of material is much tougher than it looks at first glance — resulting in a lot of thread-safe code that isn't, or that doesn't scale well. It was eye-opening, and scary, to learn from this book just how much code that looks correct at first glance is in fact broken (not thread-safe). And since many threading errors don't show up except under heavy load, and are very susceptible to timing, even seemingly rigorous testing might not uncover the issue. So there's just no escaping the need to have a thorough understanding of threading idioms, and to be able to recognize safe from unsafe code.

The authors assert that the increase in multi-core processors changes the game, such that soon even on entry level systems, your code will need to be multi-threaded to have any chance of being able to use all of the processing power you're paying for. So techniques that used to be something needed only by high-end server-side programmers will increasingly become part of every Java programmer's basic skillset.

Java 5.0 saw a major reworking of the threading facilities available to the Java programmer. If you need to write or support threaded code on Java, I'd consider this book a must-have. The authors are the primary members of the Expert Group responsible for the Java 5.0 java.util.concurrent packages. The level of detail here is excellent — not just an overview of new Java APIs, but a tutorial on threading concepts that is very clear, richly detailed, and fully supported by examples. The book doesn't suffer from having multiple authors — there is a consistent voice throughout, so either the authors worked very closely together or great editorial work was done to ensure a consistent tone.

Here's just a small sample some of the things you'll learn
  • what's the difference between monitors, locks, latches, semaphores
  • why double-check locking is broken
  • why not to start a thread from a constructor
  • why GUI event dispatch loops are single-threaded
  • use (and mis-use) of volatile
  • various ways in which multithreaded code can deadlock; techniques for avoiding or backing out of a deadlock
  • how multi-threaded code interacts with exception handling, finalizers, and interruptions
  • understanding the Java Memory Model and object visibility (when changes made to an object by one thread will be seen by other threads)

The practical stuff in Part III (testing multi-threaded code, and performance) is especially welcome. There are several graphs that show performance of various implementation alternatives, which make a very convincing case that the 5.0 concurrency packages provide great out-of-the-box performance.

The writing is a joy to read; in addition to being clear and concise, it includes some humorous observations such as 'writing tests is an adventure in iterative specification discovery' and 'a thread-safe class is one that is no more broken in a concurrent environment than in a single-threaded environment'.

The book provides exhaustive coverage of new concurrency stuff in 5.0, such as
  • Concurrent Collections
  • Executor Framework, thread pools, Callable, FutureTask, Blocking Queues
  • ReentrantLock, ReadWriteLock, Condition
  • Atomic variables ("better volatiles")
as well as previews on Java 6 changes, and at least one reference to a feature intended for Java 7.

    • 1. Introduction
  • I. Fundamentals
    • 2. Thread Safety (atomicity, race conditions, locking, reentrancy, liveness)
    • 3. Sharing objects
    • 4. Composing objects
    • 5. Building blocks (synchronized collections, iterators, concurrent collections, queues, synchronizers, semaphores, barriers)
  • II. Structuring Concurrent Applications
    • 6. Task Execution (the Executor framework, thread pools, queues)
    • 7. Cancellation and Shutdown
    • 8. Applying Thread Pools
    • 9. GUI applications
  • III. Liveness, Performance, and Testing
    • 10. Avoiding Liveness Hazards
    • 11. Performance and Scalability
    • 12. Testing Concurrent Programs
  • IV. Advanced Topics
    • 13. Explicit Locks
    • 14. Building Custom Synchronizers
    • 15. Atomic Variables and Nonblocking Synchronization
    • 16. The Java Memory Model
  • A. Annotations for Concurrency
Over 40 pages of index makes it very useable as a reference.
The book's website is here
Order it from Amazon.com "


myawn has no journal entries.

Slashdot Login

Need an Account?

Forgot your password?