josph1980 发表于 2012-09-05 13:22

进程线程的疑惑???


一:linux 2.5.13 内核

# ps
PIDUid   VmSize Stat Command
    1 root      292 S   init   
    2 root            SWN
    3 root            SW<
    4 root            SW<
    5 root            SW<
   23 root            SW<
   25 root            SW<
   65 root            SW
   66 root            SW
   68 root            SW<
   67 root            SW
142 root            SW<
202 root            SW
226 root            SW<
250 root      700 S   /usr/sbin/inetd
252 root      304 S   syslogd
286 root      788 S   ./hellp
294 root      788 S   ./hellp
295 root      788 S   ./hellp
296 root      788 S   ./hellp
297 root      788 S   ./hellp
298 root      788 S   ./hellp
299 root      788 S   ./hellp
300 root      788 S   ./hellp
301 root      788 S   ./hellp
302 root      788 S   ./hellp
309 root      868 S   -sh
2472 root      664 R   ps

hellp是在 2.6.13内核下编译的一个应用程序。在执行 ./hellp &后,用PS 查看,发现有10个hellp,
他们的 PID 不一样。
在hellp里我调用了pthread_create()创建了多个线程。都是默认属性。

二: linux 2.6.32 内核

当程序不做修改我在 2。6.32 下编译,执行 ./hellp &后,用PS 查看,发现只有一个hellp,但VSZ占用率达到 111%。

三:问题,

1:不同的内核版本出现 10个hellp 和一个hellp,是怎么回事?如何能控制他是出现10个还是合成一个?
2:VSZ占有率会不会影响应用程序的运行?是否会因为 程序里有 Malloc()函数没有及时free()而造成 应用程序hellp 死掉的情况?


谢谢大家帮忙分析一下啊、、

leejqy 发表于 2012-09-05 13:33

linux里面的线程实现机制问题~~

josph1980 发表于 2012-09-05 15:48

那么这个如何实现 这个 看似分离的机制喃
页: [1]
查看完整版本: 进程线程的疑惑???