Why do I see one more thread than the number I created in my `ps` listing?

后端 未结 3 872
我在风中等你
我在风中等你 2021-01-19 05:27

When I create a thread (pthread_create()) from my main process, I see three (3) threads in the ps listing, why is this? That is, I see the process

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-19 05:47

    Could it be that ps is displaying 1 line for the process and 2 lines for both threads. You don't show how ps is being issued, what version, nor do you contain the entire about of the ps command.

    ps typically shows only processes, not threads.

    According to busybox.net/downloads/BusyBox.html the ps command will not show threads. ps -T will show threads. So if you are sure only ps is being issued (I don't know about alias in BusyBox or anything at all, I've never used it) then you are seeing 3 processes, not threads.

    Also you may be using an old version of BusyBox? Refer to this bug report: bugs.busybox.net/show_bug.cgi?id=3835

提交回复
热议问题