Underneath each of the /proc/[pid] directories, a task subdirectory contains subdirectories of the form task/[tid], which contain corresponding information about each of the threads in the process, where tid is the kernel thread ID of the thread.
$ grep -c processor /proc/cpuinfo
2
$ cat ./test.cr
#!/usr/bin/env crystal
sleep 1
system "ls -lA /proc/#{Process.pid}/task"
sleep 1
spawn do
sleep
end
system "ls -lA /proc/#{Process.pid}/task"
sleep 1
$ ./test.cr
total 0
dr-xr-xr-x 7 x x 0 May 21 19:28 29680
dr-xr-xr-x 7 x x 0 May 21 19:28 29681
total 0
dr-xr-xr-x 7 x x 0 May 21 19:28 29680
dr-xr-xr-x 7 x x 0 May 21 19:28 29681
The real program has 12 tasks, running on a 12-vcore CPU, so I guess this is a thread pool?
I guess my first hunch that the second thread was the GC/scheduler was plain wrong.