Python Resource Library resource usage symbolic constants














































Python Resource Library resource usage symbolic constants



Resource Library Python

This module in python provides basic mechanisms for measuring and controlling system resources utilized by a program. And 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.

Any program can be converted to a process when it is executed. Thus a program becomes a process when it is executed. A process can have threads. A thread is a lightweight of process and is a basic unit of CPU utilization which consists of a program counter, a stack, and a set of registers. Thread has the ability to share an address space and all of its data among themselves. 



A process contains a number of resources like address space, open files, accounting information, etc. In addition to these resources, a process is also having a thread of control. For example, program counter, register contents, stack.
The idea of threads is to allow multiple threads of control to execute within one process. This is often called multithreading and threads are also known as lightweight processes.
Since threads in the same process share state and stack, switching between them is less expensive than switching between separate processes.
Individual threads within the same process are not completely independent but they are cooperating and all are from the same process.
The shared resources make it easier between threads to use each other’s resources. A new thread in the same process is created by a library routine like thread_create. Similarly, thread_exit terminates a thread.

The following symbols are useful in using the resource library resource usage functions, which provides the resource usage information about the processes. These will help to know about the resources used by the process and its child processes.

resource.RUSAGE_SELF:
This is passed to getrusage() to request the resources consumed by the calling process which is the sum of the resources used by all the threads in the process.

resource.RUSAGE_CHILDREN:
This is passed to getrusage() to request the resources consumed by the child processes, which have been terminated and waited for.

resource.RUSAGE_BOTH:
This is passed to getrusage() to request the resources consumed by both the current process and the child processes. This may or may not be available on the systems.

resource.RUSAGE_THREAD:
This is passed to getrusage() to request the resources consumed by the current thread. Again this may or may not be available on the systems.


More Articles of Arkaja Sharan:

Name Views Likes
Python codecs Library Error Handling schemes module functions 52 0
Python codecs Library Error Handler register_error and lookup_error functions 51 0
Python codecs Library Error Handlers 50 0
Python codecs Library open and EncodedFile functions 48 0
Python codecs Library iterencode and iterdecode functions 53 0
Python codecs Library register and unregister functions 44 0
Python codecs Library getreader and getwriter functions 52 0
Python codecs Library getincrementalencoder and getincrementaldecoder 42 0
Python codecs Library getencoder and getdecoder functions 47 0
Python Introduction to codecs Library 68 0
Python fcntl Library flock and lockf functions 49 0
Python fcntl Library fcntl and ioctl functions 66 0
Python Resource Library resource usage functions 64 0
Python Resource Library resource usage symbolic constants 53 0
Python Resource Library Resource Limit Functions 62 0
Python resource library resource limit symbolic constants 59 0
Python Introduction to Resource Library 45 0
Python stringprep Library in_table_d1 and in_table_d2 functions 51 0
Python stringprep Library in_table_c8 and in_table_c9 functions 57 0
Python stringprep Library in_table_c5 in_table_c6 and in_table_c7 functions 48 0
Python stringprep Library in_table_c3 and in_table_c4 functions 50 0
Python stringprep library in_table_c21 in_table_c22 and in_table_c21_c22 44 0
Python stringprep library functions in_table_c11 in_table_c12 and in_table_c11_c12 53 0
Python Introduction to stringprep Library 53 0
Python unicodedata library is_normalized unidata_version and ucd_3_2_0 52 0
Python Unicodedata Library functions normalize and decomposition 101 0
Python Unicodedata Library functions east_asian_width and mirrored 53 1
Python Unicodedata Library category bidirectional and combining functions 87 0
Introduction to Unicodedata library lookup and name functions 52 0
Unicode Library decimal digit and numeric functions 55 0
Introduction to Unicode Data library 0 0

Comments