In the book Modern Operating Systems,
Multithreading has implications for the operating system because each thread appears to the operating system as a separate CPU. E.g., Consider a system with two actual CPUs, each with two threads. The operating system will see this as four CPUs.
I don't understand that. A thread is a light weighted process which in turn is a running program. A cpu is a hardware.
A thread runs on a cpu.
An OS manages the hardware directly including cpu, while processes (including threads) see the hardware indirectly via the abstraction provided by OS. How can an OS not know how many cpus are there?
In what sense does each thread appears to the operating system as a separate CPU?
Thanks.
pthreads
OS-level threads. Related terms would be simultaneous multi-threading (SMT) - a single physical CPU core presenting multiple sets of CPU context resources to the OS to appear as multiple "virtual CPUs"... Unless that fact is disambiguated elsewhere, I would concur that it's a bit poorly written... – twalberg