Performance testing of parallel programs on a single-core machine

I would like to start playing with concurrency in the programs that I write (mainly for fun), but I do not have a multi-core system and I can not afford it any time soon. I am running linux. Is there a way, for example, using a virtual machine to compare the performance of a multi-threaded implementation of a program with a single-threaded version, without actually running it on equipment with multiple processors or cores?

That is, I would like to be able to implement parallel algorithms and be able to say that yes, this multi-threaded implementation is better than single-threaded.

thanks

+4
source share
4 answers

You cannot reliably check multithreaded programs on one main machine. The race conditions will be displayed in a completely different way or even completely hidden on the same main machine. Productivity will decrease, etc.

If you want to LEARN how to program multiple threads, you can do this on one main machine for the first steps (for example, how the API works, etc.). But you will have to test a multi-core machine, and it is very likely that you will see errors on a multi-core machine that you do not see on the same main machine.

Virtual machines in my experience do not help. They introduce new errors that were not previously displayed, but they CANT mimic real concurrency with multiple cores.

+4
source

Depending on what you are comparing, you may use Amazon EC2 node. It is not free, but it is cheaper than buying a computer.

+2
source

If you only have one core / processor and your algorithm is intense, you will probably see that a multi-threaded program is actually slower than a single-threaded one. But if you have a program that uses i / o in one thread and cpu in another, for example, you can see that a multi-threaded program runs faster.

0
source

To observe effects other than potentially improved locality, you will need equipment or a simulator that actually models the connection / interaction that occurs when the program runs in parallel. There was no magic.

0
source

All Articles