In addition to processes calling kill(2)
, some signals are sent by the kernel (or sometimes by the process itself) in various circumstances:
- Terminal drivers send signals corresponding to various events:
- Key press notifications:
SIGINT
(please go back to the main loop) on Ctrl+C,
SIGQUIT
(please quit immediately) on Ctrl+\,
SIGTSTP
(please suspend) on Ctrl+Z. The keys can be changed with the stty
command.
SIGTTIN
and SIGTTOU
are sent when a background process tries to read or write to its controlling terminal.
SIGWINCH
is sent to signal that the size of the terminal window has changed.
SIGHUP
is sent to signal that the terminal has disappeared (historically because your modem had hung up, nowadays usually because you've closed the terminal emulator window).
- Some processor traps can generate a signal. The details are architecture and system dependent; here are typical examples:
SIGBUS
for an unaligned access memory;
SIGSEGV
for an access to an unmapped page;
SIGILL
for an illegal instruction (bad opcode);
SIGFPE
for a floating-point instruction with bad arguments (e.g. sqrt(-1)
).
- A number of signals notify the target process that some system event has occured:
SIGALRM
notifies that a timer set by the process has expired. Timers can be set with alarm
, setitimer
and others.
SIGCHLD
notifies a process that one of its children has died.
SIGPIPE
is generated when a process tries to write to a pipe when the reading end has been closed (the idea is that if you run foo | bar
and bar
exits, foo
gets killed by a SIGPIPE
).
SIGPOLL
(also called SIGIO
) notifies the process that a pollable event has occured. POSIX specifies pollable events registered through the I_SETSIG
ioctl
. Many systems allow pollable events on any file descriptor, set via the O_ASYNC
fcntl
flag. A related signal is SIGURG
, which notifies of urgent data on a device (registered via the I_SETSIG
ioctl
) or socket.
- On some systems,
SIGPWR
is sent to all processes when the UPS signals that a power failure is imminent.
These lists are not exhaustive. Standard signals are defined in signal.h
.
Most signals can be caught and handled (or ignored) by the application. The only two portable signals that cannot be caught are SIGKILL
(just die) and STOP
(stop execution).
SIGSEGV
(segmentation fault) and its cousin SIGBUS
(bus error) can be caught, but it's a bad idea unless you really know what you're doing. A common application for catching them is printing a stack trace or other debug information. A more advanced application is to implement some kind of in-process memory management, or to trap bad instructions in virtual machine engines.
Finally, let me mention something that isn't a signal. When you press Ctrl+D at the beginning of a line in a program that's reading input from the terminal, this tells the program that the end of the input file is reached. This isn't a signal: it's transmitted via the input/output API. Like Ctrl+C and friends, the key can be configured with stty
.
Clean pages are pages that have not been modified since they were mapped (typically, text sections from shared libraries are only read from disk (when necessary), never modified, so they'll be in shared, clean pages).
Dirty pages are pages that are not clean (i.e. have been modified).
Private pages are available only to that process, shared pages are mapped by other processes*.
RSS is the total number of pages, shared or not, currently mapped into the process. So Shared_Clean
+ Shared_Dirty
would be the shared part of the RSS (i.e. the part of RSS that is also mapped into other processes), and Private_Clean
+ Private_Dirty
the private part of RSS (i.e. only mapped in this process).
PSS (proportional share size) is as you describe. Private pages are summed up as is, and each shared mapping's size is divided by the number of processes that share it.
So if a process had 100k private pages, 500k pages shared with one other process, and 500k shared with four other processes, the PSS would be:
100k + (500k / 2) + (500k / 5) = 450k
Further readings:
Regarding process-wide sums:
*Note that a "share-able" page is counted as a private mapping until it is actually shared. i.e. if there is only one process currently using libfoo
, that library's text section will appear in the process's private mappings. It will be accounted in the shared mappings (and removed from the private ones) only if/when another process starts using that library.
+The values don't add up exactly for all processes. Not exactly sure why... sorry.
Best Answer
According to the manual page of
sigpending
:So, it is meant the signals (sigterm, sigkill, sigstop, ...) that are waiting until the process comes out of the
D
(uninterruptible sleep) state. Usually a process is in that state when it is waiting for I/O. That sleep can't be interrupted. Even sigkill (kill -9
) can't and the kernel waits until the process wakes up (the signal is pending for delivery so long).For the other unclear values, I would take a look in the manual page of
limits.conf
.