title: How can I see which CPU core a thread is running in?
body: <p>In Linux, supposing a thread's pid is [pid], from the directory /proc/[pid] we can get many useful information. For example, these proc files, /proc/[pid]/status,/proc/[pid]/stat and /proc/[pid]/schedstat are all useful. But how can I get the CPU core number that a thread is running in? If a thread is in sleep state, how can I know which core it will run after it is scheduled again?</p>
  
  <p>BTW, is there a way to dump the process(thread) list of running and sleeping tasks for each CPU core?</p>