Lecture 2: Virtualization and system calls Flashcards
Layers
Applications
|
Libraries
|
Kernel
|
hardware
What is a process and how they work
It’s a running instance of a program
Gives the machine an illusion that it has the whole machine to itself through the use of Virtual memory addresses
System calls
A system call API is an interface that makes OS services available to user programs
What is an exception?
How does the OS handle it?
an exception is the transfer of control to the os kernel in response to some event
The kernel gets a corresponding exception handler to process the exception
System call numbers
To associate each system call with a number, the kernel uses the system call dispatch table, which is stored in the sys_call_table array
Control flow & altering the control flow
Program state?
System state?
From start to shutdown, the cpu executes a sequence of instructions one at a time.
We can alter the control flow using
- Jumps and Branches
- Call and Return
These react to changes in a program’s state
Not sufficient for changes in system state
So the system needs a mechanism for exception control
Hi-level
- exceptions
low-level
- process context switch
Synchronous and Asynchronous exceptions
Asynchronous: Caused by events external to the processor
- Timer interrupt
- I/O interrupt
Synchronous: Caused by executing an instruction
- Traps: intentional
- Faults: unintentional but recoverable
- Aborts: Unintentional and unrecoverable
Fault examples
Page Fault: User writes to memory location
Invalid Memory reference fault: sends SIGSEGV to the user process, and the user process exits with a segmentation fault (accessing in invalid index in an array)