Use system-stress simulation techniques during program testing
Such techniques, usually supported by development tools, include the artificial reduction of the available memory or of other system resources (CPU cycles, disk space, etc.). Stress simulation techniques can reveal inadequate error checking on memory or resource allocation, and can also reveal problems in thread synchronization.
Use a multiprocessor computer during program testing
On a single-processor computer, certain program defects related to thread synchronization may remain undiscovered forever because not all thread concurrency patterns may actually occur in practice, or they may be widely constrained. In contrast, the use of a multiprocessor computer increases the randomness of thread concurrency patterns and therefore can cause bugs in thread synchronization to manifest themselves so that they can be caught and corrected. (The thread timings change between a single-processor computer and a multiple-processor computer because they depend both on operating system policies and on the interactions between the physical system components - mainly CPUs and memory). An example of this is synchronized access to a variable pair, such that after a thread has changed the first one and before it changes the second one as well, another thread cannot read or change either variable. If this synchronization is not done correctly, depending on what other work these threads do, the frequency of collisions may vary, but it may be higher on a multiprocessor machine than on a single-processor machine. You'll surely want to see one of these collisions occur during development.
Ensure that the entire program code is executed during program testing
This is usually facilitated by development tools (profiling utilities) which can report the coverage of code achieved during execution. Whatever test methodologies you use, you must make sure that every statement or part of a statement of the program is executed at some time.
[ Table of Contents ] |