img
.
Responsiveness
Blocking one part of a process need not block the entire process. Single-threaded applications that
do something lengthy when a button is pressed typically display a "please wait" cursor and freeze
while the operation is in progress. If such applications were multithreaded, long operations could
be done by independent threads, allowing the application to remain active and making the
application more responsive to the user. In Figure 2-10, one thread is waiting for I/O from the
buttons, and several threads are working on the calculations.
Figure 2-10. Threads Overlapping Calculation and I/O
Communications
An application that uses multiple processes to accomplish its tasks can be replaced by an
application that uses multiple threads to accomplish those same tasks. Where the old program
communicated among its processes through traditional interprocess communications facilities (e.g.,
pipes or sockets), the threaded application can communicate via the inherently shared memory of
the process. The threads in the MT process can maintain separate connections while sharing data
in the same address space. A classic example is a server program, which can maintain one thread
Search WWH :
Custom Search
Previous Page
Multithreaded Programming with JAVA - Topic Index
Next Page
Multithreaded Programming with JAVA - Bookmarks
Home