Process Management Flashcards
What is a process?
Process is a running program.
What does process include?
Binary, instance of VM, open files, one or more threads, associated user …
What is a thread?
Thread is a unit of activity inside a process.
What does each thread have?
Its own stack, registers and instruction pointer.
How do we call a unique value assigned to each process?
Process id.
What is the first process started after booting?
The init process.
What is the pid of init process?
1.
What are some of the prefered locations of init process?
/sbin/init, /bin/init, /etc/init
How does the kernel behave if it can not find the init process?
It halts the system.
What is the default maximum value that can be assigned as process id?
32768.
How can we change the default maximum value for process id?
By modifying /proc/sys/kernel/pid_max.
How does kernel allocate process ids?
In a linear fashion.
What is a parent process?
A process that starts a new process.
What is a child process?
Process spawned by some parent process.
What does child inherit from parent in terms of resource management?
Parents user and group ownerships.
What are the two steps to run a new process programatically?
Call to fork() followed by one of exec* calls to load the new binary.
What does exec* function do?
Loads a binary image into memory by replacing currently loaded image of the running process.
In a function execvp, what does v and p represent?
V denotes that a function accepts an array of arguments while p denotes that “file” argument is part of user path.
How does exec behave on failure?
It returns -1 and sets an errno.
What does fork do?
Creates a new process as a near duplicate of its parent.
What does fork return to the child process?
0.
What does fork return to parent process?
Pid of the child process.
What is mean by copy-on-write (COW)?
Instead of duplicating parent resources to child process, both processes share the same resources until the moment one of the process tries to modify the resources. On first modification the process is given a resource duplicate.
What is a zombie process?
Zombie is a process which is no longer running but can be found in a process table because the parent is waiting for the result of its execution.