October 2010
Intermediate to advanced
1552 pages
45h 39m
English
Each process consumes system resources such as memory and CPU time. This chapter looks at resource-related system calls. We begin with the getrusage() system call, which allows a process to monitor the resources that it has used or that its children have used. We then look at the setrlimit() and getrlimit() system calls, which can be used to change and retrieve limits on the calling process’s consumption of various resources.
The getrusage() system call retrieves statistics about various system resources used by the calling process or by all of its children.
#include <sys/resource.h>int getrusage(int who, struct rusage *res_usage);
Returns 0 on success, or –1 on error
The who argument specifies ...
Read now
Unlock full access