What is a process in Linux?
An instance of a running program with its own memory, registers, and system resources.
What data does a Process Control Block (PCB) contain?
PID, PPID, process state, CPU registers, memory info, open files, signals, and scheduling data.
What are the main process states in Linux?
R (Running), S (Sleeping), D (Uninterruptible Sleep), T (Stopped), Z (Zombie).
Which process states contribute to CPU load average?
R (Running) and D (Uninterruptible Sleep).
What system call creates a new process?
fork()
What does fork() return to parent and child?
Parent: PID of child. Child: 0. Returns -1 on failure.
What optimization does Copy-on-Write provide?
Parent and child share memory pages until one writes, minimizing copy overhead.
What system call replaces the current process image with a new program?
exec() family (e.g., execve()).
What is the difference between fork() and vfork()?
vfork() shares the parent’s address space and suspends the parent until child calls exec() or exit().
What system call underlies fork() and thread creation?
clone()
What is the difference between clone() flags CLONE_VM and CLONE_FILES?
CLONE_VM shares memory; CLONE_FILES shares open file descriptors.
What system call allows a parent to wait for its child process to exit?
wait(), waitpid(), or wait4().
What is a zombie process?
A terminated process not yet reaped by its parent; remains in the process table but holds no resources.
Can’t be killed, parent must call wait() or be killed and PID reaps zombie.
What is an orphan process?
A child process whose parent terminated; adopted by init (PID 1).
What is the role of init (PID 1)?
First userspace process, starts services, adopts orphan processes.
What are the main IPC (Inter-Process Communication) mechanisms?
Pipes, Named Pipes (FIFOs), Shared Memory, Message Queues, Sockets, Signals.
How are anonymous pipes typically used?
For unidirectional communication between parent and child created with fork().
What is a named pipe (FIFO)?
A filesystem object for bidirectional communication between unrelated processes.
What is shared memory used for?
Fast IPC via memory regions accessible by multiple processes; requires synchronization.
What is a message queue used for?
Structured message-based communication between processes.
What is the difference between Unix Domain Sockets and TCP Sockets?
Unix sockets communicate locally via filesystem; TCP sockets communicate over networks.
What are signals in Linux?
Asynchronous notifications sent to processes to indicate events or control actions.
Which signals cannot be caught, blocked, or ignored?
SIGKILL and SIGSTOP.
What signal is sent by Ctrl+C?
SIGINT (signal 2).