|
|
|
|
|   |
|
|
|
![]()
|
Blocked on Sync: Will move to Ready-to-Run when a lock is acquired (passes synchronized statement).
|
|
Thread methods suspend( ), resume( ), and stop( ) were deprecated by Java v1.3.
With C# .NET, another thread is created from within the main thread
by instantiating a delegate object:
|
|
|
|
|
|
|
|
|
|
|
![]()
$25 Taming Java Threads
by Allen Holub (JavaWorld magazine writer). APress, June 2000. 300 pages.
Includes semaphores and read/write locks with timeouts.
![]()
$40 Concurrent Programming in Java : Design Principles and Patterns
by Doug Lea. Addison-Wesley, November 1996. 339 pages. Describes Java 1.2.
|
|
| Java's 1 - 5 - 10A Java thread's priority is specified with an integer from (the lowest) 1 to 10 (the highest), constants Thread.MIN_PRIORITY and Thread.MAX_PRIORITY. By default, the setPriority method sets a thread's priority to a value of 5 — the Thread.NORM_PRIORITYBut if you can't resist messing with it, increment:
Thread t = Thread.currentThread();
int intCurrentPriority; intCurrentPriority = t.getPriority(); t.setPriority( intCurrentPriority+1 ); Default priorities for threads started by Java:
|
|
|
$40 Programming with Hyper-Threading Technology: How to Write Multithreaded Software for Intel IA-32 Processors
(Intel Press, 2004, 232 pages)
by Richard Gerber and Andrew Binstock
|
|
|
|
Use the keyword volatile
modifier |
|
|
|
|
![]()
$25 Java Thread Programming Sams, 1999. 510 pages
by
Paul Hyde.
|
Paul Hyde, author of Java Thread Programming recommends that multiple threads and safely interact with each other by going though a “StopLight” class for threads to query before taking action. It hides Java wait/notify mechanisms and enforces timeouts. The helper class uses three objects for locking and inter-thread communication:
|
|
|
|
|
|
Related: