Re: Max number of pthreads in one process?
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Thread-index: Aci6cU5ujQSHPCZkEd2jIgAdT0T19A== Thread-topic: Max number of pthreads in one process? User-agent: Microsoft-Entourage/11.4.0.080122 On 5/20/08 3:07 AM, "Wade Tregaskis" <wadeslists@mac.com> wrote:
uname -a returns Darwin anvil.arl.army.mil 8.11.1 Darwin Kernel Version 8.11.1: Wed Oct 10 18:23:28 PDT 2007; root:xnu-792.25.20~1/ RELEASE_I386 i386 i386. This system is a fully patched 10.4.11 system.
Although I too am curious what's up with this, I cannot reproduce using 10.5.2 on my system. Have you tried on Leopard yourself?
Note yet. This was just a quick hack to see what would happen, I'll play with it on another system that has Leopard.
In any case you should file a bug report (http://bugreport.apple.com/) to ensure that the relevant people hear about your issue.
I plan on it, but if its been fixed on Leopard, then it probably isn't something to worry too much about.
This intrigued me so I decided to try to track it down. Especially since what I do see on Leopard is that the maximum number of threads your demo app can create is 2559. When I looked into the kernel code, I found that unsurprisingly there's a compile-time limit on the number of threads per process, THREAD_MAX, which is 2560 in Leopard. When this is hit thread_create_internal fails and returns KERN_FAILURE, which I verified as best I can is what actually happens on my system; this propagates back all the way to userspace where it's translated to EAGAIN by the pthread library.
OK, I don't have the sources here to look over, but that answers a different question for me; I was wondering if the machine type had something to do with how many threads you can spawn. My work machine is a dual-quad core machine, so I didn't know if that had something to do with it. Hmmm... actually... can someone with a dual-quad core machine running Leopard give that test app a quick whirl? If different systems get different results, then something VERY interesting is going on.
However, it looks like this is also what the limit was on Tiger (and Panther, though on Jaguar it was 1024). So I'm curious how you're able to create more threads than this? It doesn't look like it from your uname output, but are you running a modified kernel? [[ It looks like you could raise this limit easily enough by recompiling, but it may not actually be safe to do so. ]]
100% plain vanilla kernel; whatever Apple ships with OS X 10.4.11 (with all of the most recent patches) is what I've got. OK, one other question then; does my test app exit normally on your machine? On mine, it always hangs (like I mentioned in my earlier post). The only way out is to kill the app. Thanks, Cem Karan _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Army Research Lab