Granularity of resource limits

In the previous example with dd(1), we saw that we can indeed impose a limit upon the maximum file size. An important question arises: what is the scope or granularity of the resource limit? Is it system-wide?

The short answer: no, it's not system-wide, it's process-wide, implying that the resource limits apply at the granularity of a process and not the system. To clarify this, consider two shellsnothing but the bash processshell A and shell B. We modify the maximum file-size resource limit for shell A (with the usual ulimit -f <new-limit> command), but leave the resource limit for maximum file size for shell B untouched. If now they both use dd (as we did), we would find that the dd  process invoked within shell A would likely die with the 'File size limit exceeded (core dumped)' failure message, whereas the dd process invoked within shell B would likely continue and succeed (provided, of course, there's sufficient disk space available).

This simple experiment proves that the granularity of a resource limit is per process.

When we delve into the inner details of multithreading, we'll revisit the granularity of resource limits and how they apply to individual threads. For the impatient, all resource limits-except for the stack size are shared by all threads within the process
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset