我一次可以打开多少个文件? [英] How many files can i have opened at once?

查看:71
本文介绍了我一次可以打开多少个文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在典型的OS上,我可以使用标准C盘IO一次打开多少文件?



我试图读取一些应该告诉它的常量,但是在Windows XP 32位只有20左右。似乎可以在30个以上的系统上正常工作,但是我尚未对其进行广泛的测试。支持这一点,那将很棒。它不需要支持XP,但应该支持Linux,Win7和Windows Server的最新版本。



另一种方法是编写自己的小型文件系统,

解决方案

在Linux上,这取决于可用文件描述符的数量。
您可以使用 ulimit -n 设置/显示每个外壳的可用FD数量。



请参阅以下说明,以了解如何检查(或更改)该值

此IBM支持文章建议在Windows上该数字为512,并且您可以在注册表中进行更改(按照文章中的说明)


由于 open()将fd返回为 int -整数限制的大小也为上限。
(与INT_MAX无关)


On a typical OS how many files can i have opened at once using standard C disc IO?

I tried to read some constant that should tell it, but on Windows XP 32 bit that was a measly 20 or something. It seemed to work fine with over 30 though, but i haven't tested it extensively.

I need about 400 files opened at once at max, so if most modern OS's support that, it would be awesome. It doesn't need to support XP but should support Linux, Win7 and recent versions of Windows server.

The alternative is to write my own mini file system which i want to avoid if possible.

解决方案

On Linux, this is dependent on the amount of available file descriptors. You can use ulimit -n to set / show the number of available FD's per shell.

See these instructions to how to check (or change) the value of available total FD:s in Linux.

This IBM support article suggests that on Windows the number is 512, and you can change it in the registry (as instructed in the article)

As open() returns the fd as int - size of int limits also the upper limit. (irrelevant as INT_MAX is a lot)

这篇关于我一次可以打开多少个文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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