回到首页| 网络安全 名人故事 申请书 | 名人名言 财富榜 关于我们

当前位置:名人故事传 > 互联网 > Linux服务器 > > 正文

linux 进程的最大线程个数

08-19  Linux服务器     来源: 未知  
1. 可以通过下面的方法查到:[plain] view plaincopyprint?cat /proc/sys/kernel/threads-max 15882 另外,一个进程实际的线程个数,可以从 /proc/{PID}/status里得出:[plain] view plaincopyprint?/proc/544#cat status Name: kpsmoused State: S (sleeping) Tgid: 544 Pid: 544 PPid: 2 TracerPid: 0 Uid: 0 0 0 0 Gid: 0 0 0 0 FDSize: 32 Groups: <strong>Threads: 1</strong> SigQ: 0/7941 2。这个最大个数是在函数 fork_init 里算出来的:[cpp] view plaincopyprint?/* * The default maximum number of threads is set to a safe * value: the thread structures can take up at most half * of memory. */ max_threads = mempages / (8 * THREAD_SIZE / PAGE_SIZE); [cpp] view plaincopyprint?#define THREAD_SIZE 8192 mempages 是物理内存的大小(以页面为单位)。可以用如下方法查到:[cpp] view plaincopyprint?cat /proc/zoneinfo | grep spanned | awk '{totalpages=totalpages+$2 } END {print totalpages}' THREAD_SIZE为线程的栈大小。可以用 ulimit 查看:[cpp] view plaincopyprint?#ulimit -s 8192
互联网 网络安全 申请书 创业资讯 创业故事明朝十六帝故事
© 2012-2022 名人故事传网版权所有 关于我们 | 版权声明 | 网站协议 | 友情申请 | 免责声明 | 网站地图 | 联系我们 | 广告服务