Peter Mawhorter
malloc
Reference(Prof. Herbst’s slides from a previous semester)
How can you close a program that’s stuck in an infinite loop?
A process keeps track of the context of a program, including:
At the kernel’s discretion, a context switch may happen: saves the current context, then loads a new context and starts running from there.
A process may also receive signals which change its status.
Signals are sent via the kernel, triggered by keyboard shortcuts and/or other processes.
SIGINT
, SIGKILL
, and yes,
SIGSEGV
).SIGTSTP
)A process can define a signal handler via the
signal
function to do something special (but this is
tricky).
fork
creates a new process.
Call it once and it returns twice: once to the parent (with the
child PID) and once in a new child process (with 0 as the value).exec
replaces the running
program by loading a new one from a file (gets fresh memory &
registers).getpid
returns the current
process’ ID.getppid
returns the parent
process’ ID.waitpid
pauses this process
until the target process finishes.man
(“manual”) to look at documentation, e.g.:man getpid
ps
to see processes, or
top
for an interactive
display.