Dear Readers,
In the last article, we saw the difficulties in concurrent programming. The difficulties arise due to the complex interplay of different threads of execution, how they communicate with each other and how they access common variables.
But there are some cases, where this is NOT an issue.
Suppose there is an array of 1000000 bytes which has to be initialized with zeros. We can have a program that sequentially fills the array with zero. Or we can create multiple threads, and allow them to initialize different parts of the array. Since the threads work on different parts of the data, there is no access to common variables. There is also no communication between the threads. So, the potential issues of deadlocks, race conditions don’t apply.
In such cases, a multicore system can potentially run each thread on a seperate core thereby speeding up the performance. Such models have been used in scientific computing, using a model called OpenMP.
In parallel computing, such problems are called “Embarrassingly Parallel Problems”. These are computations which can be decomposed to a number of threads that can execute more or less independently, without communication. Such problems are easily converted to concurrent programs and one can get benefits of multiple cores with little effort.
Some examples that are “embarrassingly parallel programs” from Wikipedia are:
As we can see, all of them are scientific computation in nature and are of little use to a common man. Is there anything for a simple desktop PC user like us?
Fortunately, there is hope in computer graphics. The computer screen consists of many pixels. When we update the screen memory, we can partition the memory, create multiple threads and allow each thread to update their relevant part of the memory, thereby improving graphics performance.
Microsoft has made many changes in their recently released Windows 7 to improve their graphics performance. Multithreaded graphics libraries leverage multiple cores as each thread runs on a different core. As a result, the new DirectX11 from Microsoft makes games, visualization and other graphics intensive programs to deliver higher performance and a better user experience for users.
This is the first clear dividend to a common user from the multicore technology!
文章评论(0条评论)
登录后参与讨论