Code: thread-weaver. Managing Threads in J2SE. Edward Harned (eh at coopsoft dot com) Senior Developer, Cooperative Software Systems, Inc. April, 2009PrefaceIt is often imperceptible why we house application threads inside a container. After all, anyone can create a thread anywhere, so what's the point? Exactly the enigma. Once you understand the problem, then the solution makes perfect sense. Therefore, we start at the beginning.The problem arisesMainframes In the beginning (of third generation computers) came the IBM® System/360® series of computers. Just as there are two similar issues with juggling balls.When the balls are in the air, the balls may try to occupy the same space at the same time. Failure to address both these issues means the endeavor will fail sooner or later.The Concurrency API contains three packages: java.util.concurrent.atomic java.util.concurrent.locks java.util.concurrentConcurrency The atomic and locks packages have to do with concurrency.
Put requests in queues for processing by asynchronous threads. Advanced Topics in Programming Languages: The Java Memory Model. Hyper-threaded Java - Java World. Until recently, true concurrency has been impossible on most computers marketed to consumers. Most have been one-processor models capable of executing only a single thread in any given time slice. Operating systems simulate doing many things at once by rapidly time-slicing between threads, a practice known as temporal multithreading. True concurrency, also known as simultaneous multithreading (SMT), occurs when multiple threads execute instructions during the same clock cycle. While in the past, SMT has been possible only on high-end, multiple-processor systems, the advent of inexpensive multiple-core processors is bringing SMT-capable systems to average consumers. The laptop you pick up at Best Buy this holiday season might very well sport a Centrino Duo capable of simultaneously executing two threads.
These new systems give you, the high-performance Java developer, a tremendous opportunity for speeding up your programs. A simple approach The basic approach is rather simple: Listing 1.