8 (In this paper we focus on synchronous queues within a multithreaded program, not across address spaces or distributed nodes.) They are also widely used in message-passing software and in stream style "hand-off" algorithms. They constitute the central synchronization primitive of Hoare's CSP 8 and of languages derived from it, and are closely related to the rendezvous of Ada. For decades, synchronous queues have played a prominent role in both the theory and practice of concurrent programming. That is, producers can "run ahead" of consumers, but consumers cannot "run ahead" of producers.Ī synchronous queue provides the "pairing up" function without the buffering it is entirely symmetric: Producers and consumers wait for one another, "shake hands," and leave in pairs. This buffering, in systems that provide it, is naturally asymmetric: A consumer that tries to take data from an empty concurrent queue will wait for a producer to perform a matching put operation however, a producer need not wait to perform a put unless space has run out. It can also serve to smooth out fluctuations in their relative rates of progress by buffering unconsumed data. This structure serves to "pair up" producers and consumers. Shared memory transfers are typically effected via a concurrent data structure that may be known variously as a buffer, a channel, or a concurrent queue. Mechanisms to transfer data between threads are among the most fundamental building blocks of concurrent systems. Our synchronous queues have been adopted for inclusion in Java 6. Our new algorithms consistently outperform the Java SE 5.0 SynchronousQueue by factors of three in unfair mode and 14 in fair mode this translates to factors of two and ten for the ThreadPoolExecutor. We compare our algorithms to commonly used alternatives from the literature and from the Java SE 5.0 class both directly in synthetic microbenchmarks and indirectly as the core of Java's ThreadPoolExecutor mechanism. We present performance results on 16-processor SPARC and 4-processor Opteron machines. We present two new nonblocking, contention-free synchronous queues that achieve high performance through a form of dualism: The underlying data structure may hold both data and, symmetrically, requests. In a synchronous queue, producers similarly wait for consumers to take the data. In a thread-safe concurrent queue, consumers typically wait for producers to make data available.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |