0

I have a requirement to measure the system resources on the host vm and compare it with the baseline limits.

the resource module provides with most of the values but I am unable to get below 2 limits from resource module in comparison with ulimit -a

  1. pipe size --> The pipe size in 512-byte blocks
  2. virtual memory --> The maximum amount of virtual memory available to the shell and, on some systems, to its children

I did check this answer and did a mapping between ulimit -a and /usr/include/bits/resource.h which I have pasted below. I could not find any equivalent parameters in /usr/include/bits/resource.h for the above 2 system resources.

I'd like to avoid running ulimit as a subprocess. Is there any alternative in python?

Mapping between ulimit -a and /usr/include/bits/resource.h

Mapping

Ameen Ali Shaikh
  • 409
  • 1
  • 3
  • 10
  • 1
    See [the bash ulimit implemention](https://git.savannah.gnu.org/cgit/bash.git/tree/builtins/ulimit.def) to see how that shell calculates those values. – Shawn Aug 27 '21 at 20:11
  • But to summarize, VM size is stack + data sizes, and pipe size is a compile time value (no idea how to access it from python or I'd post an actual answer) – Shawn Aug 27 '21 at 20:13

0 Answers0