Linux – How do I track threads created for a process in Linux?

How do I track threads created for a process in Linux?… here is a solution to the problem.

How do I track threads created for a process in Linux?

I’m new to Linux.

I want to trace the threads created by the process like any command or program to know which thread is currently running for a particular process.

I found this link
Tracking threads memory and CPU consumption but didn’t find my solution.

I’m not asking for any tools, libraries, where and how to implement them, but some programming points. This means I want to know which APIs can be used to check the number of threads, memory, and CPU consumption of a given process.

Related Problems and Solutions