User vs kernel space
A process is executing either in user space or in kernel space.
When executing in user space, the process can or cannot do certain things according to its privileges.
A process switches to kernel space by calling a
syscall.
Apparently user space is also called user mode, kernel space is also called kernel mode.
Process ID (PID)
Each process is identified by a numerical id, the so called process id, sometimes abbreviated as PID.
Process IDs are unique per system at a given time, but an ID might be reused after a process has terminated.
Displaying details about a given process
The shell utility
ps
allows to print the details of a process given its id:
$ ps p 894
PID TTY STAT TIME COMMAND
894 pts/0 S 0:00 -bash
Process 1
The first process that the kernel starts is the process with PID = 1.
This process is the direct or indirect parent for all other processes.
By default, the kernel tries to start
/sbin/init
as this first process. Historically, this is the init process of
System V which in more recent times is replaced with upstart or
systemd.
See also
nproc
reports the number of available
CPUs to the current process.
prtstat
prints statistics about a process.
ps
reports a snapshot of the current processes. With
pstree, the processes are shown as a tree.
pidof
finds a process's PID.
pgrep
finds processes by their name and attributes.
pstack
prints a stack trace.