Reputation: 1269
Edit: For possible duplicated issue, I think the part I haven't solved is that the word managed is still not clear for me whether it would include scheduling, if so, then clearly software threads will not include user threads. But this is strange, since my intuition is that there are only two kinds of threads: either of hardware or of software, and then user threads are belong to neither.
Edit2: The candidate that may solve my question in the possibly duplicated link is this one, which states that it's included, so if this answer with no problem then I accept the closed.
From this answer - software threads vs hardware threads, software threads are threads managed by OS. But I also learn another term called user threads, which are threads that's not kernel threads, i.e. the OS won't know about these threads. So does software threads include user threads?
Upvotes: 1
Views: 78
Reputation: 140457
You are correct, there are hardware threads. Those resemble real physical hardware structures. In other words: hardware threads are implemented by having multiple "copies" of all required "units" within a CPU, allowing the CPU to really, in parallel, execute multiple "threads of execution".
Software threads are "decoupled" of the underlying hardware. They represent a "virtual" resource. The operating system manages these virtual threads, and either uses underlying hardware threads or purely "software only" thread management to execute threads.
Meaning: the OS looks to the underlying CPUs allows and uses the n hardware threads to run m software threads it knows about. Theoretically, when n is 1 (what we had like 20+ years ago), then you don't have any parallelism, but just time slot based scheduling.
The key thing to understand: all the threads the OS manages are "software" threads. As set, consider them a virtual resource. Now: there are simply different types of that resource. Some software threads are reserved for OS kernel usage only. The OS itself uses them, and no user application ever gets to see them. But obviously, applications want "their" own threads, too. Those would be the "user" threads then, as they are created per request in some userspace code.
Upvotes: 3