Posted in Programming Programming Languages

Get Ален Холаб. Приручаем потоки Java PDF

By Allen Holub

ISBN-10: 1893115100

ISBN-13: 9781893115101

Studying find out how to write multithreaded functions is the major to taking complete good thing about the Java platform. In Taming Java Threads, famous columnist and Java specialist Allen Holub offers Java programmers with the data they should write actual multithreaded courses - courses with actual code. Holub presents an in-depth clarification of the way threads paintings in addition to information regarding easy methods to remedy universal difficulties akin to deadlocks and race stipulations. He not just explains universal difficulties, but in addition offers the unusual ideas that mark the variation among production-level code and toy demos.Topics coated during this e-book contain the structure of threads; the mutex and lock administration; situation variables and counting semaphores; timers, alarms, and swing thread defense; observers and multicasters; singletons, severe periods, and reader/writer locks; threads in an object-oriented global; and object-oriented threading architectures.While it really is necessary to construct help for threading right into a Java software from the very starting, such a lot books at the topics of Java-UI building and Java networking slightly contact on threading issues. besides being a uncomplicated Java reference, this e-book is a must-read for any Java developer.

Show description

Read or Download Ален Холаб. Приручаем потоки Java PDF

Best programming: programming languages books

Get php|architect?s Guide to PHP Design Patterns PDF

You will have most likely heard much approximately layout Patterns—a approach that is helping you layout rock-solid strategies to useful difficulties that programmers all over the place stumble upon of their day by day work.
Even even though there was loads of buzz, besides the fact that, no-one has but get a hold of a complete source on layout styles for personal home page developers—until today.
Author Jason E. Sweat's ebook php|architect's consultant to personal home page layout styles is the 1st, complete consultant to layout styles designed particularly for the Hypertext Preprocessor developer. This booklet contains insurance of sixteen layout styles with a particular eye to their purposes in personal home page whilst development complicated internet functions, either in personal home page four and Hypertext Preprocessor five (where applicable, pattern code for either types of the language is provided). With an intensive, test-driven method, this ebook represents the definitive consultant to layout styles for the personal home page developer.
As you could anticipate from a php|architect ebook, this advisor is especially concerned with its subject, without any of the fluff that accompanies the big, dear titles you typically locate on the book place. obviously, this does not come on the fee of intensity of assurance or readability: the booklet includes tens of scripts that offer you a realistic review of each subject lined, from most sensible to backside.

Additional resources for Ален Холаб. Приручаем потоки Java

Example text

The real issue here is that the Java specification does not require that wait() be implemented as an atomic operation (one that can't be preempted while moving from the condition variable to the monitor's lock). This means that using an if instead of a while might work in some Java implementations, but the behavior is really undefined. Using a spin lock instead of a simple if statement is cheap insurance against implementations that don't treat wait() as atomic. While we're on the subject of wait(), there's one additional point to consider.

7. The dequeueing thread now has to wait to reacquire the monitor before wait() can return, so it blocks again, this time on the lock associated with the monitor. It can't acquire the monitor because the second thread hasn't returned from enqueue() yet. 8. The enqueueing thread now returns from the enqueue() method releasing the monitor. 9. The dequeueing thread acquires the monitor, wait() returns, an object is dequeued, and dequeue() returns, releasing the monitor. 1, line 22) is pretty important.

So Wilma wakes up and tries to acquire lock_2 but can't because Betty has it. Wilma and Betty are now deadlocked. Neither thread can ever execute. Note that lock_1 and lock_2 are raw Object objects. The Object class isn't abstract, precisely so that you can use it as a roll-your-own lock. Of course, any Object will do as the argument to a synchronized statement; even an array will work. You can't use a primitive (like an int or boolean) for this purpose, however. Wilma and Betty are a contrived example, but the multiple-lock situation comes up frequently.

Download PDF sample

Ален Холаб. Приручаем потоки Java by Allen Holub


by Christopher
4.3

Rated 4.92 of 5 – based on 23 votes