Process Control Blocks expose the /proc file system which allows PCBs to be read by users. Is there a similar file system for Thread Control Blocks? If not, is there a tool to read their contents (bonus points if it supports high-frequency sampling)?
1 Answer
The Kernel has a Thread Control Block (TCB). To view the information you're after, I would use -
# cat /proc/PID/task/PID/status
So, to view thread information for a process that has the PID 12345 -
# cat /proc/12345/task/12345/status
There's also libproc, available in procps. Sorry, I couldn't provide good documentation on that.
- Which entries in the
cat .../statusoutput correspond to program counter, register contents, and thread state?Justin Borromeo– Justin Borromeo2020-04-23 22:22:27 +00:00Commented Apr 23, 2020 at 22:22 - Please consult the docs at man7.org/linux/man-pages/man5/proc.5.htmlrubaiat– rubaiat2020-04-23 23:16:17 +00:00Commented Apr 23, 2020 at 23:16
-
/proc/.../taskgive the info you’re after?