What is the windows equivalent of the unix command " ulimit -n" ?
Basically, i want to set the maximum fd limit via command prompt.
I don't believe that current Windows O/S have a limit on the total number of file descriptors, but the MS runtime library (msvcrt.dll) has a per process limit of 2048, albeit as far as I know that's not enforced by the O/S.
It can allegedly be increased only by building your own version of the MS runtime library from source.
hmm... I may have been wrong before - setmaxstdio (see here) - but it is per-process, not system wide.
I may be wrong, but I didn't think there was a limit to set in Windows... but unless you can say how this relates to programming, I expect this answer will be closed soon.
If you are in the "IT Pro" area (rather than development), then there is a sister-site, serverfault.com - coming soon for this type of question.
Related
The documentation of cmd.exe tells us there is a 8191 character limit to a cmd.exe command line. Powershell may have the same issue (but anyway I think it is not compatible with cmd syntax).
The Windows OS technical limit is "much" higher, at 32767 caracters or so (see CreateProcessA documentation).
Are there compatible alternative shells to cmd.exe that increase the command line length limit above 8191 characters ?
Note 1: I am not asking about a terminal emulator (GUI) problem: this is a shell problem.
Note 2: I believe this question is not a duplicate because it is focused on a precise limitation of cmd.exe. Also I could not post my Yori answer on this or this questions because they are closed.
Have a look at Yori. There is no such limit in Yori. Yori is open-source.
Yori is a CMD replacement shell that supports backquotes, job control, and improves tab completion, file matching, aliases, command history, and more. It includes a handful of native Win32 tools that implement commonly needed tasks which can be used with any shell.
You might be interested in Take Command from jpsoftware, abbreviated TCC. There is no such limit in TCC.
There is no limit to the size of a TCC command line (other than that imposed by Windows or the amount of RAM in the system).
Can't find a way to do this, every version of MacOS use a different version and Mojave still very recent, so can't find anything.
Programmatically, you can use getrlimit() and setrlimit() to adjust the number of file descriptors the process can open. The relevant resource identifier is RLIMIT_NOFILE.
As noted in the man page, RLIMIT_NOFILE works somewhat differently than other resources. getrlimit() might indicate that the hard limit is RLIM_INFINITY (unlimited), but the kernel actually imposes a limit of OPEN_MAX (currently 10240). So, treat that as the maximum that you can set using setrlimit().
To do this for a program whose code you don't control, you can adjust the limit in a shell before launching that program from that shell. In bash and other sh-derived shells, you can use the ulimit built-in command for that. For example, ulimit -Sn 10240.
i am using windows and i want to Set the maximum number of simultaneously existing ports to 65536. in Erlang docs it says:
ERLAG doc here , visit for syntax
+Q Number|legacy
Sets the maximum number of simultaneously existing ports for this system if a Number is passed as value. Valid range for
Number is [1024-134217727]
On Windows the default value is set to 8196 because the normal OS
limitations are set higher than most machines can handle.
If legacy is passed as value, the legacy algorithm for allocation of
port identifiers will be used. Using the legacy algorithm, identifiers
will be allocated in a strictly increasing fashion until largest
possible identifier has been reached. Note that this algorithm suffers
from performance issues and can under certain circumstances be
extremely expensive. The legacy algoritm is deprecated, and the legacy
option is scheduled for removal in OTP-R18.
i used below syntax but it gives me syntax error, whats wrong ?
Since my reputation doesnt allow me to just comment, I'll just answer...
If you dont like to start the erlang VM through a batch script or the command window, you can create a link to the werl.exe and edit the Command it executes by right clicking and changing the Properties of said link. For example:
Default link Target: "C:\Program Files (x86)\erl5.10.4\bin\werl.exe"
Would become: "C:\Program Files (x86)\erl5.10.4\bin\werl.exe" +Q 65536
This also allows for different configurations for different projects/applications.
Another way would be, to use .bat scripts instead of a link.
I'm currently trying to get information about the CPU load and RAM usage out of an PowerPC with QNX running on it. The idea is to write that information in a text file with a time stamp over a certain amount of time, but this ain't my problem here once I have the information as a "standard value". My programm will be in C++ and I already did this kind of program for Windows (via PDH API). Maybe you have page like this but for QNX? Probably I'm looking for the wrong keywords.
Can you help me with this problem? Any kind of direction would be most welcome as I'm new to QNX and this kind of programming. Thanks a lot!
You will work with the /proc filesystem.
From the command line you can check the size of the memory space of the process that has process ID = 1234 by:
ls -l /proc/1234/as
"as" stands for "address space" and the size of this virtual file will indicate a good estimate of the memory used by the process in question, 1236992 bytes in this example:
-rw-r--r-- 1 root root 1236992 Aug 21 21:25 as
To get the same value programmatically you will need to use the stat() function on the /proc/PID/as file.
You can refer the following page in the documentation for a more detailed explanation of the same:
http://www.qnx.com/developers/docs/660/index.jsp?topic=%2Fcom.qnx.doc.neutrino.cookbook%2Ftopic%2Fs3_procfs_pid_directories.html
In order to get the CPU time (system/user) used by the process you can use the DCMD_PROC_INFO devctly() on the /proc/PID/as file. You will need to refer the "utime" and "stime" members of the debug_process_t structure passed to the devctl().
You can find a detailed explanation and sample code on the following page in the QNX documentation:
http://www.qnx.com/developers/docs/660/index.jsp?topic=%2Fcom.qnx.doc.neutrino.cookbook%2Ftopic%2Fs3_procfs_DCMD_PROC_INFO.html
It's a little strange I know,
but I want to limit a program (for example the winrar app) resource usage.
The reason:
I have an old laptop, with overheating problem, so if I want to do a calculate intensive task (compress a >10GB folder), my laptop overheats and turns off.
The question:
Is it possible to limit an application's resource/CPU usage? For example, can I set somehow, that winrar can only use my CPU's 50%?
I use windows 8.1,
but answer for other OS is welcome.
See Are there solutions that can limit the CPU usage of a process? for general answer.
WinRAR itself has the command line switch -ri, see in help of WinRAR the page with title:
Switch -RI<p>[:<s>] - set priority and sleep time
For example using a command line like
WinRAR.exe a -ri1:100 Backup.rar *
results in compressing all files in current working directory with default settings using lowest task priority and with 100 ms sleep time between each read or write operation.