Threads++: A New Solution to the Multi-threading Dilemma
Current error-detection technology's lack of support for multithreaded applications has forced developers to choose between 1) using threads to enhance their applications' performance and efficiency and 2) ensuring that their applications are reliable. Threads++ resolves this dilemma by allowing developers of multithreaded applications to thoroughly test these applications-- including the threads within them-- with a state-of-the-art automatic runtime error-detection tool.
Multithreading gives developers a powerful way to control, enhance, and optimize program execution. Multithreaded programs have a number of significant advantages over single-threaded programs. According to an article in Sun World Online, multithreading...
- increases performance gains from multiprocessing hardware (parallelism)
- increases application throughput
- increases application responsiveness
- enhances process to process communication
- efficiently uses system resources
- allows developers to make use of the inherent threadedness of distributed objects
- improves developers' ability to create well-structured programs (1)
Multithreading is currently being hailed as "one of the most important skills [developers] can add to [their] repertoire," and will become increasingly important as developers create applications that meet the needs of the future (2). According to an article in Dr. Dobb's Journal
- It can finally be said that we are at the dawn of multithreaded client/server development. We live at a time in which it is necessary to build high performance servers, develop sophisticated extensions for Internet/intranet servers, utilize the power of multiprocessor systems, construct high-performance OLE and COM objects, and enhance overall application responsiveness. In the coming years, there will be the need for high-performance video servers and complex real-time animation and simulation systems--many under the auspices of virtually reality.
While multithreading can greatly bolster an application's performance, the fact that "developing multithreaded applications is difficult for even veteran developers"--so difficult that merely the mention of it is enough to give most programmers chills-- is widely recognized among developers (3, 2). According to DeMarco and Lister, nonthreaded applications contain an average of 1.2 bugs per 400 lines of code. Multithreading, as does any performance-optimizing programming technique, significantly increases the potential number of bugs per line.
Unfortunately for developers and managers, normal debuggers such as dbx and even runtime error-detection tools are unable to detect bugs in threads. The non-linear nature of multithreaded applications confuses most debuggers and runtime error-detection tools. As a result, most debuggers and runtime error-detection tools cannot even "run" a multithreaded application and test its non-threaded code. Even those debuggers and runtime error-detection tools that can run a multithreaded application cannot detect bugs in the threads because they are incapable of noticing when a new thread begins. As a result, a core dump caused by a thread could easily pass through one of these debuggers or runtime error-detection tools without being reported, then be shipped to end-users.
Consequently, developers of multithreaded applications must make a difficult decision between 1) shipping buggy, unreliable multithreaded code; 2) spending vast amounts of time and money attempting to debug multithreaded code by hand and hoping that they catch all the bugs; or 3) eliminating multithreading-- and the complexities and enhancements it allows-- in order to ensure that their code has been thoroughly debugged and that the application is reliable.
None of the above options are viable solutions for developers. Shipping buggy code is hardly time or cost-effective, as it will undoubtedly require costly on-site visits and increased technical support, as well as additional testing, debugging, and post-release patches. Moreover, shipping unreliable applications can cause longstanding damage to a company's reputation and finances. Because it takes an average of 12 hours to find and fix a single bug in a nonthreaded application, trying to manually find and fix bugs in multithreaded code can delay release by weeks or more, and still allow unreliable applications to get shipped to end-users. Avoiding threads will dramatically increase reliability, but producing less complex applications than your competition can instantly spell disaster for almost any type of software.
If developers are going to efficiently produce complex, competitive, reliable software, they need to use multithreading, then use a tool capable of thoroughly, automatically detecting runtime errors every thread. Such error-detection can be performed when the Threads++ module is added on to Insure++, ParaSoft's automatic runtime error-detection tool. With the addition of the Threads++ module, Insure++ becomes the only available runtime error-detection tool that can not only "run" multithreaded applications, but also detect errors in every thread. Threads++ allows Insure++ to instrument all threads, track all processes in the application, and quickly pinpoint algorithmic anomalies, bugs, and deficiencies.
Considering the importance, advantages, and risks of multithreading, it is clear that the ability to produce reliable multithreaded applications is a must in current and future software development. Only Threads++ allows developers of multithreaded applications to rapidly find and fix the bugs that would otherwise remain hidden in threads and cause the application to perform incorrectly, or to fail to perform at all. Threads++ functionality is therefore a necessary component of any multithreading development environment.
For more information about how your department can develop reliable multithreaded applications, contact a Software Quality Specialist at (888) 305-0041.
(1) Lewis, Bill and Berg, Daniel J. "How to program with threads." SunWorld Online, February 1996.
(2) Cromwell, Jeff. "The Dawning of the age of multithreading." Dr. Dobb's Journal, September 1998.
(3) Stamatakis, Bill. "Creating a Multi-User Interface Threaded Application in MFC." Visual C++ Developers Journal, November, 1997.