Kernel abstractions Flashcards
What is dual mode operation and which modes do we have?
Dual mode operation is a way to have two different modes to execute on the CPU
Kernel mode is the mode that has all priveleges “god mode” and does everything.
User mode is the mode that has limited privileges. These privileges are granted by the OS kernel.
On the x86, the user/kernel mode are stored in the EFLAGS register.
What is a process?
A process is an instance of a program, running with limited rights
When does a mode switch happen from user to kernel mode and vice versa?
A switch from user to kernel happens in following situations:
- interrupts
- exceptions
- systems calls
A switch from kernel to user happens in following situations:
- new process/new thread start
- return from interrupt, exception or system call
- process/thread switch
- user-level upcall (UNIX signal)
What is an interrupt?
An interrupt is an asynchronous signal to the processor that some external event has occured that may require attention.
What is a system call and how do they work?
A system call is any procedure provided by the kernel that can be called from user-level.
Often implemented by using a trap instruction. A trap instruction changes the processors mode from user to kernel and starts executing in the kernel at a pre-defined handler.
What is the process control block and what is its role in the OS?
Process control block is a data structure that stores information about a process. it stores the following information:
- process state (whether the process is running, waiting, etc)
- process id and parent process id
- CPU registers and program counter
- CPU-scheduling information
- memory-management information
- accounting information (user and kernel cpu time comsumed, account numbers, etc)
- I/O status information (Devices allocated, open file tables, etc)