SIGXCPU

From Wikipedia, the free encyclopedia

Jump to: navigation, search
SIGXCPU
Description CPU time limit exceeded (4.2BSD)
Default action Abnormal termination of the process
SA_SIGINFO macros
None

On POSIX-compliant platforms, SIGXCPU is a signal, which is delivered to and can be caught by computer programs when they have used up the CPU for a duration that exceeds a certain predetermined user-settable value.[1][2] In source code, SIGXCPU is a symbolic constant defined in the header file signal.h. Symbolic signal names are used because signal numbers can vary across platforms.

[edit] Etymology

SIG is a common prefix for signal names. XCPU is an abbreviation for exceeded CPU time.

[edit] Usage

SIGXCPU is sent when the total time spent by the processor executing the process's instructions exceeds the allowed value, as determined by the user through the setrlimit or fcntl system calls (which can be invoked directly or through a shell builtin command). This is not the same as total elapsed time, as some of the time since the process started will have been spent waiting on I/O and servicing other processes.

By default, SIGXCPU will result in program termination. And the POSIX standard further states that if this behavior is changed, namely, "if the process is catching or ignoring SIGXCPU, or all threads belonging to that process are blocking SIGXCPU, [then] the behavior is unspecified" by POSIX.[1] Nevertheless, individual operating systems, like Linux, usually define the act of catching or ignoring SIGXCPU as legitimate. Under this setting, the usage model of this signal is typically such that its arrival indicates to the receiving process that the process has reached a CPU consumption "soft limit", soon be followed by a system-wide "hard limit": When the latter is reached, the process will be delivered a SIGKILL signal that cannot be ignored or caught, and would therefore immediately terminate the process.

Thus, the arrival of a SIGXCPU signal provides the receiving process a chance to quickly save any intermediate results and to exit gracefully, before it is terminated by the operating system for good. This kind of a mechanism is especially important in supercomputers, where parallel programs run for long periods of time and use up immense computational resources. And indeed, supercomputer resource managers, like the IBM LoadLeveler, make explicit use of SIGXCPU exactly for this purpose.[3]

Other uses are possible. For example, on some operating systems, the Boehm garbage collector uses SIGXCPU and SIGPWR to synchronize cross-thread garbage collection.[citation needed]

[edit] References

  1. ^ a b (html)getrlimit, setrlimit - control maximum resource consumption,POSIX system call specification, The Open Group, 2001-2004, http://www.opengroup.org/onlinepubs/009695399/functions/getrlimit.html, retrieved on 2008-09-10 
  2. ^ (html)signal.h, POSIX header file specification, The Open Group, 2001-2004, http://www.opengroup.org/onlinepubs/009695399/basedefs/signal.h.html, retrieved on 2008-09-10 
  3. ^ (pdf)IBM LoadLeveler for AIX 5L, "Using and Administrating" (Version 3, Release 2), IBM, 2003, p. 344, http://www.sdsc.edu/us/resources/datastar/docs/ll_usg_and_admin_v3r2.pdf, retrieved on 2008-09-10 
Personal tools
Languages