Threads & Processes Vs MultiThreading & Multi-Core/MultiProcessor : How they are mapped?

后端 未结 7 1982
灰色年华
灰色年华 2020-12-07 08:49

I was very confused but the following thread cleared my doubts:

Multiprocessing, Multithreading,HyperThreading, Multi-core

But it addresses the queries from

7条回答
  •  [愿得一人]
    2020-12-07 08:54

    1. Broadly speaking, yeah, but "parallel" can mean different things.

    2. It depends what tasks you want to run in parallel.

    3. Not necessarily. Some (indeed most) threads spend a lot of time doing nothing. Might as well switch away from them to a thread that wants to do something.

    4. The OS handles thread switching. It will delegate to different cores if it wants to. If there's only one core it'll divide time between the different threads and processes.

    5. The number of threads is limited by software and hardware. Threads consume processor and memory in varying degrees depending on what they're doing. The thread management software may impose its own limits as well.

提交回复
热议问题