maximum number of mutexes per process/thread in windows

跟風遠走 提交于 2019-12-19 04:25:13

问题


Is there a limit in the maximum number of mutexes per process/thread in a Asp.net application?

Just in case the target operating systems are: Windows XP Pro, server 2003/2008 and Windows 7 in the near future. Usually the website is deployed in an App Pool.


回答1:


I'm going to go out on a limb here and venture the possibility that you're probably (not necessarily) doing something wrong.

Raymond Chen said it best but, if you're worried about the maximum number of mutexes, you're probably protecting your resources at too fine a granularity.

Certainly there will be a maximum number even if it's dictated by available memory rather than a constant. However, I can't see any valid situation in which you would need so many mutexes that you would hit a limit.

I'm not saying it's not possible since I have no idea what the architecture of your application is. But I would be very surprised if there wasn't a better way to do it.

Perhaps if you step back and tell us the "what I want" rather than the "how I did it", we could offer better advice.




回答2:


The limit is essentially the same as the limit on the number of handles a process can have. It's quite a big number: 16,777,216. Of course, the real limit is much lower, and depends on how much non-paged pool you have available, which isn't that big.

If you're worried about the limit, there's something wrong with your program. Keep in mind that critical sections usually delay the creation of any kernel objects, which means you can have a large number of them if there are few contentions.



来源:https://stackoverflow.com/questions/3714935/maximum-number-of-mutexes-per-process-thread-in-windows

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!