My guess: this was some awful compromise with the historical zealots who didn't want Linux to support real threads at all because they thought the "processes sharing memory" model of LinuxThreads was sufficient...
-
-
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
The second part seems reasonable to me in that it matches everything else (e.g., kill(2) a non-main thread by tid). The first part is backwards compat for stuff like ps(1), I assume.
-
The argument to kill is a pid, not a tid; it sends the signal to the process not a particular thread of the process. It makes no sense to call it with a tid.
-
The first part is correct. /proc is supposed to list processes; there's no reason for threads to be there.
End of conversation
New conversation -
-
-
IIRC in earlier versions of Linux all tasks (processes, threads) were in /proc and when threads got moved (tasks without CLONE_VM?) the open behaviour was kept for backwards compatibility. At one point ps and top showed threads by default.
-
Yes I'm aware. See the other branch of this thread. Also it's CLONE_THREAD; you can use CLONE_VM without CLONE_THREAD, e.g. as vfork.https://twitter.com/RichFelker/status/984465290489749504 …
-
Oh that’s right. Early on they only had CLONE_VM and no concept of tid. I think that is why CLONE_THREAD got added, so that proc and procps could differentiate processes from threads. I remember in the 2.4.x days a period where ps showed all threads as processes. Linus relented
-
Showing them in /proc was the least of the problems with this naive and bone-headed approach. Signal semantics, child process relationships, exec behavior, etc. were all wrong and could not be fixed just by emulating pthreads in userspace.
End of conversation
New conversation -
-
-
You have to remember Linux internally has “tasks” and there is a task struct. A process is a group of tasks that share the same mm struct. There are so many different CLONE_ flags nowadays, a task can be many thinking including a new namespace (is that a zone?)
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Sounds like the perfect time to plug Plan 9’s /proc in all its glory
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.