关于pthread创建 [英] regarding pthreads creation

查看:85
本文介绍了关于pthread创建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我正在做学期项目,在linux和Windows中对多线程性能进行基准测试.

在Linux中,我编写了一个简单的程序来创建线程,在那里我可以创建30,000个线程.
效果很好.

我编写了一个用于测量上下文切换时间的程序,并实现了用于测量上下文切换时间的乒乓游戏.
即使将堆栈大小设置为32kb,我也无法创建1000个线程.我要11!错误.
可能是什么原因.
谢谢.

Hi ALL,
Iam doing term project, Benchmarking multhreaded performance in linux andin windows.

In linux I wrote simple program to create threads, where I was able to create 30,000 threads.
It worked fine.

I wrote a program for measuring context switch time,I implemented ping pong game for measuring context switch time.
I am unable to create 1000 threads even if I set stack size to 32kb. Iam getting 11! error.
What might be the reason.

Thanks.

推荐答案

如果我没记错的话,Linux的线程数没有按进程的限制,而Windows的线程数没有限制.如果我没记错的话,逻辑会说Windows允许的进程中的线程数比Linux允许的线程数小得多.您可能应该查一下以进行验证.
If I remember correctly... Linux doesn''t have a per process limit on number of threads whereas Windows does. If I remember that correctly, logic would say the number of threads in a process allowed in Windows would be a lot smaller than that allowed in Linux. You should probably look that up though to verify.


这篇关于关于pthread创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆