Can multithreading be implemented on a single processor system? Can multithreading be implemented on a single processor system? c c

Can multithreading be implemented on a single processor system?


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


Of course it can be done on a single-processor system, and in fact it's much easier that way. It works the same way as running multiple processes -- the kernel, via a timer interrupt or other similar mechanism, suspends one, saving its machine state, and replacing that by the previously-saved state of another -- the only difference being that two threads of the same process share the same virtual memory space, making the task-switch much more efficient.

Multi-threading on multi-processor systems is actually much more difficult, since you have issues of simultaneous access to memory from multiple cpus/cores, and all the nasty memory synchronization issues that arise out of that.


You can have more than four active threads on a quad core system. There is scheduling, unless you can guarantee that processes won't try to create more threads than there are processors.

Yes, you can have multiple threads on a single-core computer.

The difference between single processor and multi-processor systems is that a multi-processor system can indeed do more than one thing at a time. It can do N things at a time, where N is the number of processor cores. A single-processor core can only do one thing at a time. As WhozCraig said in his comment, it's the difference between actual and perceived concurrency.