A Method for Reducing Contention and Overhead in Worker Queues for Multithreaded Java Applications

Posted by Janice J. Heiss on Oracle Blogs See other posts from Oracle Blogs or by Janice J. Heiss
Published on Tue, 28 Jun 2011 10:05:00 -0700 Indexed on 2011/06/29 0:28 UTC
Read the original article Hit count: 375

Filed under:

A java.net article, rich in practical resources, by IBM India Labs’ Sathiskumar Palaniappan, Kavitha Varadarajan, and Jayashree Viswanathan, explores the challenge of writing code in a way that that effectively makes use of the resources of modern multicore processors and multiprocessor servers.

As the article states:

“Many server applications, such as Web servers, application servers, database servers, file servers, and mail servers, maintain worker queues and thread pools to handle large numbers of short tasks that arrive from remote sources. In general, a ‘worker queue’ holds all the short tasks that need to be executed, and the threads in the thread pool retrieve the tasks from the worker queue and complete the tasks.

Since multiple threads act on the worker queue, adding tasks to and deleting tasks from the worker queue needs to be synchronized, which introduces contention in the worker queue.”

The article goes on to explain ways that developers can reduce contention by maintaining one queue per thread. It also demonstrates a work-stealing technique that helps in effectively utilizing the CPU in multicore systems.

Read the rest of the article here.

© Oracle Blogs or respective owner

Related posts about /Oracle/General