swoole线程和进程

时间:2024-03-29 12:34:20

pstree -a | grep php

|   |       `-php server.php   主进程   
  |   |           |-php server.php   管理线程  worker线程死掉后 可以重启一个worker线程
  |   |           |   `-php server.php
  |   |           `-{php}

ps -aux

root        0.0  1.5    pts/    Sl+  :   : /usr/local/php-5.6./bin/php server.php
root 0.0 0.2 pts/ S+ : : /usr/local/php-5.6./bin/php server.php
root 0.0 0.2 pts/ S+ : : /usr/local/php-5.6./bin/php server.php
[root@LocalWeb01 ~]# strace -p 3797 (查看目前进程在干嘛)
Process attached - interrupt to quit
poll([{fd=, events=POLLIN}], , ) = (Timeout)
time(NULL) =
poll([{fd=, events=POLLIN}], , ) = (Timeout)
time(NULL) =
poll([{fd=, events=POLLIN}], , ) = (Timeout)
time(NULL) =
poll([{fd=, events=POLLIN}], , ) = (Timeout)
time(NULL) =
poll([{fd=, events=POLLIN}], , ) = (Timeout)
time(NULL) =
[root@LocalWeb01 ~]# strace -p
Process attached - interrupt to quit
wait4(-,

线程是可以共享进程的内存和资源

master  主进程  

manager  管理线程

worker