How does a single thread run on multiple cores?

1.39K views

REDIS is single threaded. So what does it mean when I deploy it to machines with 2 or more cores? How does the single thread utilize these multiple cores?

In: Engineering

3 Answers

Anonymous 0 Comments

In order to process multiple threads the OS runs the thread in turns, each one gets to run on an available core for a few milliseconds so over time all threads can progress.

If a thread has no CPU affinity it can happen that on the next turn it runs on a different core, so the thread technically runs on multiple cores, but only on one core at a time. To make it clear this means that at most it’s processed as fast as a single core allows.

Because of this, when running a heavy thread on a dual core CPU the task manager may display both cores having a load around 50% giving the impression the thread runs on both cores simultaneously but this really means it runs on each one about 50% of the time.

You are viewing 1 out of 3 answers, click here to view all answers.