通过应用程序更改最大pthread数限制 [英] Changing the limit of maximum number of pthreads by an application
本文介绍了通过应用程序更改最大pthread数限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以通过任何方式更改进程可以创建的pthread数量的限制? 当前在我的linux系统上,我可以创建大约380个线程,但是只要有可用内存,我想增加一点.
Is it possible by any means to change the limit on the number of pthreads a process can create ? Currently on my linux system I can create around 380 threads but I want to increase that to say as long as memory is available.
推荐答案
减小用户的堆栈大小'ulimit -s 1024
';
reduce user's stack size 'ulimit -s 1024
';
default: 8MB
reduced: 1MB
增加线程数.
设置堆栈大小:pthread_attr_setstacksize(1024)
这篇关于通过应用程序更改最大pthread数限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文