-1

I have a small multi-core server that performs a variety of tasks, most of which are multi-threaded and have been speed-tuned satisfactorily. However, some of the tasks rely on existing single-threaded applications that occasionally block performance of the time-sensitive batch processes (as a concrete example, an occasional dump of the database system that streams through bzip2, a single-threaded process, will lock certain database records throughout the dump process, which may take 7-10hours, interfering with other database operations). Obviously, there no way to natively run the single-thread process through multiple CPUs other than to replace it with a multi-threaded fork of the original project. There are several multi-threaded alternatives to bzip2. However, there are a host of other problematic single-thread applications, and I'd prefer to reduce the number of applications on the server that require maintenance and testing.

To that end, I'm looking for a generic solution to run exiting single-threaded applications on existing hardware (i.e. an abstraction program that would essentially subdivide and reassemble the instruction sets across multiple processors). I've thought about virtualization solutions, but have little experience with such tools and can not seem to find features of same that would satisfy the aforementioned use case. Note the existing hardware is 64-bit, capable of virtualization and running non-BSD Linux.

Many thanks!

4

1 回答 1

2

You cannot make a single threaded application multithreaded. It doesn't work that way. What you can do is cluster single threaded applications - ie run multiple copies of them simultaneously.

An example of this can be seen with node.js - A single threaded event driven java-script based environment. There are tools such as http://learnboost.github.io/cluster/ cluster which will manage several instances of a node cluster and balance the work across them.

By running multiple copies you will have a separate process for each instance which will then run on different cores.

于 2013-05-03T15:32:42.513 回答