This sample contains a full project that shows how to create multiple threads and use Mutexes. The program creates multiple threads to calculate the prime numbers for any given range. The purpose of this program is not to efficiently calculate primes, but to show how to use mutexes; wait for a thread to complete, and how to release mutexes. The program creates 2 threads and calculates the prime numbers. The main function takes the upper bound as an argument to compute primes within the upper bound range and displays all the prime numbers found.
Web developers, developers building application server code, and developers working with multiple processor systems. Any developers working in a 32-bit Windows environment where optimization of code would be of interest via multi-threaded programming would find this example program worth a look.
Target Hardware & Software Platforms
Hardware Systems: Systems running Intel® Xeon® processors
Operating Systems: Microsoft Windows* 2000 and other Win32 operating systems
About the AuthorSoumya Gupta is a Technical Marketing Engineer in the Software Solutions Group at Intel Corporation.