1. 系統命令
pid: 進程ID。 lwp: 線程ID。在用戶態的命令(比如ps)中常用的顯示方式。 tid: 線程ID,等於lwp。tid在系統提供的接口函數中更常用,比如syscall(SYS_gettid)和syscall(__NR_gettid)。 tgid: 線程組ID,也就是線程組leader的進程ID,等於pid。 pgid: 進程組ID,也就是進程組leader的進程ID。 pthread id: pthread庫提供的ID,生效范圍不在系統級別,可以忽略。 sid: session ID for the session leader。 tpgid: tty process group ID for the process group leader。
1)PS 命令查看
ps -eLlf|head -1;ps -eLlf|grep mysql
ps –Lf $pid
2)top
top -Hp $pid
3) pidstat
pidstat -t -p 16370

2. MySQL查看
select THREAD_ID,PROCESSLIST_ID,THREAD_OS_ID,name,TYPE from performance_schema.threads; SELECT a.THREAD_ID, a.NAME, a.TYPE, a.PROCESSLIST_ID, a.PROCESSLIST_USER, a.PROCESSLIST_HOST, a.PROCESSLIST_DB, a.PROCESSLIST_COMMAND, a.PROCESSLIST_TIME, a.CONNECTION_TYPE, a.THREAD_OS_ID FROM performance_schema.threads a;