updated 9mo ago
Working With Unix Processes
Every process running on your system has a unique process identifier, hereby referred to as 'pid'.
from Working With Unix Processes by Jesse Storimer
Any resource that your process opens gets a unique number identifying it. This is how the kernel keeps track of any resources that your process is using.
from Working With Unix Processes by Jesse Storimer
The takeaway here is that system calls allow your user-space programs to interact indirectly with the hardware of your computer, via the kernel.
from Working With Unix Processes by Jesse Storimer
We'll continue on the subject of file descriptors. Using Ruby we can ask directly for the maximum number of allowed file descriptors: p Process.getrlimit(:NOFILE) On my machine this snippet outputs: [2560, 9223372036854775807] We used a method called Process.getrlimit and asked for the maximum number of open files using the symbol :NOFILE. It retur
... See morefrom Working With Unix Processes by Jesse Storimer
The VAR=value syntax is the bash way of setting environment variables. The same thing can be accomplished in Ruby using the ENV constant.
from Working With Unix Processes by Jesse Storimer
Note that the hard limit on my system for the number of file descriptors is a ridiculously large integer. Is it even possible to open that many? Likely not, I'm sure you'd run into hardware constraints before that many resources
from Working With Unix Processes by Jesse Storimer
In much the same way as pids represent running processes, file descriptors represent open files.
from Working With Unix Processes by Jesse Storimer
What's the difference? Glad you asked. The soft limit isn't really a limit. Meaning that if you exceed the soft limit (in this case by opening more than 2560 resources at once) an exception will be raised, but you can always change that limit if you want
from Working With Unix Processes by Jesse Storimer
In the last chapter we looked at the fact that open resources are represented by file descriptors. You may have noticed that when resources aren't being closed the file descriptor numbers continue to increase. It begs the question: how many file descriptors can one process have? The answer depends on your system configuration, but the important poi
... See morefrom Working With Unix Processes by Jesse Storimer
Ruby's Process.ppid maps to getppid(2).
from Working With Unix Processes by Jesse Storimer