It is said that MySQL handles connections, allocating one thread per connection to the server,and MySQL is a single process with multiple threads.
Now in my localhost .
There are two connections to mysql.
sudo ps -el |grep mysql
4 S 0 892 1 0 80 0 - 1084 - ? 00:00:00 mysqld_safe
4 S 111 1338 892 0 80 0 - 172432 - ? 00:00:21 mysqld
0 S 1000 14903 14892 0 80 0 - 27406 - pts/1 00:00:00 mysql
0 S 1000 14937 14922 0 80 0 - 27375 - pts/2 00:00:00 mysql
Let's search 892's ps tree.
pstree 892 -p
mysqld_safe(892)───mysqld(1338)─┬─{mysqld}(1361)
├─{mysqld}(1362)
├─{mysqld}(1363)
├─{mysqld}(1364)
├─{mysqld}(1365)
├─{mysqld}(1366)
├─{mysqld}(1367)
├─{mysqld}(1368)
├─{mysqld}(1369)
├─{mysqld}(1370)
├─{mysqld}(1477)
├─{mysqld}(1478)
├─{mysqld}(1479)
├─{mysqld}(1480)
├─{mysqld}(1500)
├─{mysqld}(1518)
├─{mysqld}(2611)
└─{mysqld}(11598)
Are there 14903 and 14937 threads?Which process do they belong to?
It means that MySQL server handles connections, allocating one thread per connection to the server.
Now for the process of 14903 on the mysql client side ,the mysql server allocate one thread for the connection,now which one in range 1361-1370 or range 1477-1499 or 1500 ,1518,2611,11598 handle the 14903's connection?