Can multithreading be implemented on a single processor system?

前端 未结 6 1057
走了就别回头了
走了就别回头了 2020-12-04 08:16

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 t

6条回答
  •  借酒劲吻你
    2020-12-04 09:12

    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

提交回复
热议问题