Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

The title says it all: is there a way to get an older program designed to use a single CPU core to use multiple CPU cores?

share|improve this question
13  
No, not possible. –  Moab Jun 7 '11 at 0:07
5  
If only it was that easy.. –  Brendan Long Jun 7 '11 at 4:44

3 Answers 3

up vote 16 down vote accepted

Unfortunately, a legacy program written for a single CPU cannot be forced to use multiple CPU cores. The usage of multiple CPU cores requires multiple threads, which need to communicate with each other while ensuring that race conditions and other problems do not occur. An older application cannot be made to use more than CPU core unless it is rewritten to do so, and only if the nature of the application allows it to be parallelized.

share|improve this answer
17  
It's also worth noting that some applications simply can't be rewritten to take into account multiple cores. It mostly depends on how parallelizable the process is. A simple example of non-parallelizable process would be human reproduction: One woman can make one child in 9 months. Nine women can make 9 children in 9 months, but you can't use 9 women to manufacture a single child in one month. –  AndrejaKo Jun 7 '11 at 0:25
    
Thanks. I've edited my answer to reflect your comment. –  DragonLord Jun 7 '11 at 0:29
1  
In principle one could write a program to analyze another program and attempt to parallelize it. That said, even very limited "easy" versions of this problem have been generating Ph.D. dissertations for the last couple of generations and progress has been slow. The full problem may very well be AI-complete. –  dmckee Jun 7 '11 at 0:48
    
Great, thank you all, you made me grion with your Women and birth example, especially when you talk about manufacturing :D –  Chris Jun 7 '11 at 18:51

What is your goal with it? Increased performance? Sadly applications that are designed to make use of only 1 core will not make use of more. Thats what this talk of "multi-threaded" applications are all about.

share|improve this answer

There are at least three techniques for exploiting multiple processors in a program designed for using a single core. The most straightforward of these techniques is to use libraries and system code that uses multiple cores or can execute at least partially in parallel with the application code. Garbage collection is an example of functionality that can be parallelized and might be possible to do in parallel with application execution. Even without automatic memory management, there is some potential for parallelism in memory deallocation functions because the memory allocator may have some work to do beyond simply marking the section of memory as available.

A second technique is binary translation. While this might be considered "rewriting the application", it is done by software and without access to source code. Producing thread-level parallelism seems not to have been the main goal of most research and development using binary translation (which often concerns running legacy code on a different ISA, exploiting ISA extensions or optimizing for a particular microarchitecture, and using dynamic information to provide higher quality profile-guided optimization), but the potential is obvious.

A third technique is speculative multithreading. Currently no processors (that I know of) support hardware-managed speculative multithreading. However, with the introduction of hardware transactional memory, having a runtime system implement such becomes somewhat more practical because the HTM can be used to detect conflicts in memory use. Software-managed speculative multithreading would typically involve some binary translation, but its speculative nature justifies considering a separate technique.

The practicality of these techniques is limited by costs associated with existing systems (including the cost of communication between threads and of spawning threads), by the limited parallelism that they can exploit, and by the limited return on investment (important applications that can be beneficially parallelized are likely to be rewritten, many applications would benefit relatively little if at all from such techniques (especially with power/thermal limits allowing a single core to run at a higher frequency than multiple cores), and the development costs are significant). Yet these techniques do exist and it is theoretically possible to use multiple cores with an application designed to use a single core.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.