在Windows 7 64位中增加文件句柄的数量 [英] Increasing no of file handles in Windows 7 64 bit

查看:480
本文介绍了在Windows 7 64位中增加文件句柄的数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个同时运行10000个线程的应用程序.每个线程打开相同的文件.问题是,每当我启动具有10K线程的应用程序时,应用程序都会在创建500个线程(文件句柄)后终止.调整 ulimit 选项后​​,我在Linux上尝试了相同的应用程序,并且运行良好.在Windows中可以打开进程的文件句柄是否有任何限制?我一直在使用Google搜索,所能做的就是更改 C \ Windows \ System32 ... config.nt 文件中的条目.

I have an application that has 10000 threads running at a time. Each thread opens the same file. The problem is whenever I launch the application with 10K threads, the application terminates after creating 500 threads(file handles). I have tried the same application on Linux and is running fine after I tweaked the ulimit option. Is there any limit on the file handles a process can open in Windows? I have been googling and all I get is to change the entries in config.nt file in C\Windows\System32....

但是我发现对于64位操作系统,该文件不存在.有什么方法可以更改Windows中的限制?

But I found out that the said file does not exist for 64 bit OS. Is there any way that I can change the limit in Windows?

我的操作系统是WINDOWS 7 64位.

My OS is WINDOWS 7 64 bit.

推荐答案

要查看在给定时间打开的应用程序的句柄总数(不仅仅是文件句柄):手柄限制.

https://technet.microsoft.com/zh-CN下载Process Explorer我们/sysinternals/processexplorer.aspx 确保设置适当的刷新速度. 打开它,然后转到视图"->选择列"->在过程性能"选项卡上按,然后单击处理计数".

Download Process Explorer from https://technet.microsoft.com/en-us/sysinternals/processexplorer.aspx Make sure to set appropiate refresh speed. Open it and go to View -> Select Columns -> press on the tab "Process Performance"and click on "Handle Count".

对于Windows 7 x64位,进程可以同时打开16.711.680句柄. 如果您想自己检查限值,请阅读以下内容. 通过使用Windows Internals Book中的工具进行检查( https://technet.microsoft. com/en-us/sysinternals/bb963901.aspx ).工具的名称为TestLimit,您可以在页面下部的书籍工具"标题下找到它.

For Windows 7 x64 bit, a process can have 16.711.680 handles opened simultaneously. If you want to check limits for yourself then read below. Check that by using a tool from Windows Internals Book (https://technet.microsoft.com/en-us/sysinternals/bb963901.aspx). Tool's name is TestLimit and you will find it in the lower part of the page under the Book Tools header.

据我所知,没有办法提高Windows操作系统的限制,而且我也看过.

There are no ways to increase this limit for Windows Operating Systems as far as I know, and I looked also.

正如其他人所述,请考虑一种最小化大量线程的方法. 也许您的应用程序关闭了文件,但没有关闭句柄. 我的建议是如果您确实需要使用非常大的句柄数,请在每次句柄数约为16m时开始一个新的过程.

As others stated, think of a method to minimize the large number of threads. Maybe your application closes the file, but not the handle. My advice, if you really need using very large handle count, start a new process every time handle count is about 16m.

这篇关于在Windows 7 64位中增加文件句柄的数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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