Skip to content

A question about running multiple threads

Hi, I need to know if adding many newer threads will make the threads that are already running slower?
That is, will the number of threads running affect their speed?
Thanks

Comments

  • SvenSven www.GSA-Online.de
    Yes of course you can expect that as it is a natural behavior. Though this slowdown can be noticeable or not at all depending on the CPU and memory power.

    Imagine you are the CPU and have to give water to flowers. The threads are the number of flowers.
    Each flower should get 100ml of water.
    With one thread you say in front of that flower and give it the full amount. With two flowers you run around and switch between one flower, give it 10ml of water and turn to the next giving it another 10ml of water.

    Now when there are more than two flowers, you run more around and give them a bit water of the required 100ml. This running around and switching between flowers takes time and slows down the whole process.

    If you have a 2core CPUs, you have a co-worker doing the same and then it is twice as fast.
Sign In or Register to comment.