Python resource library resource limit symbolic constants














































Python resource library resource limit symbolic constants



Resource Library Python:

This module in python provides basic mechanisms for measuring and controlling system resources utilized by a program. And the symbolic constants are used to specify particular system resources and to request usage information about either the current process or its children. If there is a syscall failure, the OSError is raised.

As stated in my previous article, some more symbolic constants related to resource limits are defined below:

resource.RLIMIT_VMEM:
This gives the largest of the mapped memory which the process may occupy.

resource.RLIMIT_AS:
This gives the maximum area in bytes of the address space which may be taken by the process.

resource.RLIMIT_MSGQUEUE:
This gives the number of bytes that can be allotted for the POSIX Message Queues.
POSIX message queues are the means by which the processes exchange data in the form of messages to accomplish their tasks. They enable the processes to synchronise their reads and writes to speed up processes.

resource.RLIMIT_NICE:
The ceiling of the nice level of a process. 
The priority of the process is often called the nice vale of the process. The range of the nice value of these processes are generally from -20 to 20 on most Unix like operating systems. Nice value controls the CPU time assigned to the process and not the utilization of memory and I/O devices.

resource.RLIMIT_RTPRIO:
This gives the ceiling of the real-time priority.
Real-Time priority is the highest priority class available to a process. It is used to manage the real time device operations mostly in kernel mode. For example: Mouse or Keyboard inputs may be set on real time as code for such device extends Real Time Priority.

resource.RLIMIT_RTTIME:
This gives the time limit in microseconds on CPU time that a process can spend under real time scheduling without making a blocking syscall.

resource.RLIMIT_SIGPENDING:
This gives the number of signals which the process may queue.
A signal is a notification to a process that an event has occurred. Signals are sometimes described as software interrupts, because in most cases, they interrupt the normal flow of execution of a program and their arrival is unpredictable. It can be sent by Kernel or a Process.
After a signal is generated due to some event, it does not directly get delivered to a process, and the signal remains in an intermediate state called to a pending state. To ensure that a signal does not arrive during execution of some critical section, a process can add signal to its process’s signal mask, which is a set of signals whose delivery is currently blocked. Process’s signal mask is a per process attribute. If a signal is generated when it is blocked, it remains in pending state until later it is unblocked.

resource.RLIMIT_SBSIZE:
The socket buffer is the structure used to address and manage a packet over the entire time this packet is being processed in the kernel. When an application passes data to a socket, then the socket creates an appropriate socket buffer structure and stores the payload data address in the variables of this structure.
This gives the maximum size in bytes of the socket buffer usage for this user. This limits the amount of the network memory, and hence the amount of mbufs, that this user may hold at any time.

resource.RLIMIT_SWAP:
This gives the maximum size in bytes of the swap space that may be reserved of used by all of its user's id's processes. And this limit is enforced bit 1 of the vm.overcommit is set.
Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in the memory are moved to the swap space. While the swap space can help machines with a small amount of RAM, it should not be considered a replacement for RAM.

resource.RLIMIT_NPTS:
this return the maximum amount of pseudo terminals in the system

resource.RLIMIT_KQUEUES:
This gives the maximum number of Kqueues this user is allowed to create.
Kqueue is a scalable event notification interface and it provides efficient input and output event pipelines between the kernel and userland. Kqueue not only handles file descriptor events but is also used for various other notifications such as file modification monitoring, signals, asynchronous I/O events (AIO), child process state change monitoring, and timers which support nanosecond resolution, furthermore kqueue provides a way to use user-defined events in addition to the ones provided by the kernel.


More Articles of Arkaja Sharan:

Name Views Likes
Python codecs Library Error Handling schemes module functions 75 0
Python codecs Library Error Handler register_error and lookup_error functions 68 0
Python codecs Library Error Handlers 75 0
Python codecs Library open and EncodedFile functions 66 0
Python codecs Library iterencode and iterdecode functions 85 0
Python codecs Library register and unregister functions 62 0
Python codecs Library getreader and getwriter functions 77 0
Python codecs Library getincrementalencoder and getincrementaldecoder 62 0
Python codecs Library getencoder and getdecoder functions 69 0
Python Introduction to codecs Library 95 0
Python fcntl Library flock and lockf functions 76 0
Python fcntl Library fcntl and ioctl functions 87 0
Python Resource Library resource usage functions 87 0
Python Resource Library resource usage symbolic constants 71 0
Python Resource Library Resource Limit Functions 84 0
Python resource library resource limit symbolic constants 79 0
Python Introduction to Resource Library 68 0
Python stringprep Library in_table_d1 and in_table_d2 functions 75 0
Python stringprep Library in_table_c8 and in_table_c9 functions 79 0
Python stringprep Library in_table_c5 in_table_c6 and in_table_c7 functions 68 0
Python stringprep Library in_table_c3 and in_table_c4 functions 75 0
Python stringprep library in_table_c21 in_table_c22 and in_table_c21_c22 76 0
Python stringprep library functions in_table_c11 in_table_c12 and in_table_c11_c12 76 0
Python Introduction to stringprep Library 79 0
Python unicodedata library is_normalized unidata_version and ucd_3_2_0 74 0
Python Unicodedata Library functions normalize and decomposition 127 0
Python Unicodedata Library functions east_asian_width and mirrored 79 1
Python Unicodedata Library category bidirectional and combining functions 113 0
Introduction to Unicodedata library lookup and name functions 76 0
Unicode Library decimal digit and numeric functions 77 0
Introduction to Unicode Data library 0 0

Comments