Linux进程与线程的关系

crash> ps | grep ovs
   5657      1  10  ffff88031b910000  IN   0.0   28668   5236  ovsdb-server
   5715      1   8  ffff880329ec1d00  IN   0.9 1284180 151728  ovs-vswitchd
crash> task_struct.comm,tgid,pid ffff880329ec1d00
    comm = "ovs-vswitchd\000\000\000"
    tgid = 0x1653
    pid = 0x1653
crash> task_struct.thread_group ffff880329ec1d00 -o
struct task_struct {
  [ffff880329ec22d8]     struct list_head thread_group;
}
crash> list -H ffff880329ec22d8 -s task_struct.comm,tgid,pid -l task_struct.thread_group
ffff88031b911458
    comm = "urcu5\000r2\000chd\000\000\000"
    tgid = 0x1653
    pid = 0x165c
ffff8803955a9458
    comm = "handler210\000d\000\000\000"
    tgid = 0x1653
    pid = 0xebd
ffff8803955aa2d8
    comm = "handler211\000d\000\000\000"
    tgid = 0x1653
    pid = 0xebe
ffff8803955ab158
    comm = "handler212\000d\000\000\000"
    tgid = 0x1653
    pid = 0xebf
ffff8803955abfd8
    comm = "handler213\000d\000\000\000"
    tgid = 0x1653
    pid = 0xec0
ffff8803955ace58
    comm = "handler214\000d\000\000\000"
    tgid = 0x1653
    pid = 0xec1
ffff8803955adcd8
    comm = "handler215\000d\000\000\000"
    tgid = 0x1653
    pid = 0xec2
ffff8803955aeb58
    comm = "handler216\000d\000\000\000"
    tgid = 0x1653
    pid = 0xec4
ffff8803955a85d8
    comm = "handler217\000d\000\000\000"
    tgid = 0x1653
    pid = 0xec5
ffff8803a9dd05d8
    comm = "handler218\000d\000\000\000"
    tgid = 0x1653
    pid = 0xec6
ffff8803a9dd1458
    comm = "handler219\000d\000\000\000"
    tgid = 0x1653
    pid = 0xec7
ffff8803a9dd22d8
    comm = "handler220\000d\000\000\000"
    tgid = 0x1653
    pid = 0xec8
ffff8803a9dd3158
    comm = "revalidator221\000"
    tgid = 0x1653
    pid = 0xec9
ffff8803a9dd3fd8
    comm = "revalidator222\000"
    tgid = 0x1653
    pid = 0xeca
ffff8803a9dd4e58
    comm = "revalidator223\000"
    tgid = 0x1653
    pid = 0xecb
ffff8803a9dd5cd8
    comm = "revalidator224\000"
    tgid = 0x1653
    pid = 0xecc
ffff8803a9dd6b58
    comm = "revalidator225\000"
    tgid = 0x1653
    pid = 0xecd
在Linux中线程并没有单独的数据结构,也用task_struct,通过thread group来把进程和线程联系起来。

你可能感兴趣的:(linux)