Operating Systems
Processes, threads and system calls
What a process is, how it differs from a thread, and how a program asks the kernel for something.
In two minutes
One idea to a line
A process is a program in execution with its own address space; a thread is a path of execution inside a process that shares its code, heap and open files.
Each thread has its own stack, registers and program counter. A process switch costs more than a thread switch because the address space changes.
A system call moves the CPU from user mode to kernel mode through a trap; the kernel does the work and returns.
Process states: new, ready, running, waiting (blocked), terminated. Only one process per core is running at a time.
fork() makes a copy of the calling process and returns twice: 0 in the child and the child's id in the parent.
Slips people make here
Interviewers know them too
Saying threads have separate heaps: they share it.
Thinking a blocked process is in the ready queue: it waits for an event first.
Counting a fork() child as sharing variables with its parent: it gets a copy.
Your practice here
Not started
10 written questions, and 1 kind of calculation that change every time
No answers yet