Can multithreading be implemented on a single processor system?

Ayse picture Ayse · Apr 20, 2013 · Viewed 55.8k times · Source

I have always followed the concept that multithreading can only be implemented on multiple processors system where there are more than one processor to be assigned to each thread and each thread can be executed simultaneoulsy. There is no scheduling in this case as each of the thread has separate resources all dedicated to it. But I recenetly read it somewhere that I can do multithreading on single processor system as well. Is it correct? and if yes then what is the difference between single processor and multiple processor systems?

Answer

Barath Ravikumar picture Barath Ravikumar · Apr 20, 2013

I recenetly read it somewhere that I can do multithreading on single processor system as well. Is it correct? and if yes then what is the difference between single processor and multiple processor systems?

Yes you can do multithreading on a single processor system.

In multi-processor system , multiple threads execute , simultaneously on different cores. Eg- If there are two threads and two cores , then each thread would run on individual core.

In a single-processor system, multiple threads execute , one after the other or wait until one thread finishes or is preempted by the OS , depending on the thread priority and the OS policy.But the running threads , gives an illusion that they run simultaneous , relative to the required application response time of the User space application.

Time Comparison(Example):

if two threads take 10us each to execute, then on a 2 processor system , the net time take is 10us

if two threads take 10us each to execute, then on a 1 processor system , the net time take is 20us