1/72
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
SIGINT/SIGKILL
terminate process
SIGSEGV
terminate process and generate core dump
SIGCHLD
ignore signal
SIGSTOP
Stop process
SIGCONT
continue process
raise()
send signal to self (kinda like a function call)
kill()
send signal to other process
alarm()/setitimer()
set timer for self and receives signal (SIGALRM/SIGVTALRM) when timer is up
sigprocmask()
examine or change signal( blocking signals)
sigpending()
examine pending blocked signals (blocking signals)
sigaction()
map signal handler to signal
pause()
suspend self until signal is received
malloc()/free()
dynamic memory allocation
When heap is full
it syscall to kernel to request for more space
sbrk()/brk()
linear increase of data segment
mmap()
map pages of memory in process and can map file contents
preprocessor(cpp)
transform program before compilation
compiler(cc)
compiles a program into assembly code
assembler(as)
compiles assembly code into relocatable object file
linker(ld)
links object files into an executable
API( application programming interface)
interface between pieces of code
UAPI(User API)
syscall interface between pieces of code
HAL(hardware abstraction layer)
interface inside kernel between arch-independent code and arch-dependent code
IS(instruction set architecture)
list of processor instructions
ABI(application binary interface )
interface between code and processor
Monolithic kernel
entire kernel code linked together in a single large executable
what are the pros and cons of Monolithic kernel
great performance but increased potential for instability like crashes
microkernel
communicates with services using message passing
what are the pros and cons of micro-kernel
great fault isolation but inefficient
Hybrid kernel
Trusted OS services implemented in kernel and Non-trusted OS services implemented as regular user- space processes
Kernel mode
Execution with full privileges on the hardware
what are some executions that kernel mode can do
Read/write to any memory location, Access to any I/O device, Read/write to any disk sector, Send/receive any packet
User mode
limited privileges on the hardware
native execution
Run unprivileged code directly on the CPU and is very fast execution
Memory protection
Prevent process from overwriting kernel's or other processes' memory
Timer interrupts
Prevent running process from hogging hardware and Kernel periodically regains control on CPU
Mode switch
From user mode to kernel mode, and vice-versa
Privileged instructions
Instructions only available to code running in kernel mode and processor traps(mod switching) if user code tries to execute privileged instruction
hardware timer
periodically interrupts the processor
what does it mean when a transition must be atomic?
one unbreakable logical step
Trap vector
provides limited number of entry points into the kernel
Kernel stack
kernel has it’s own stack, located in kernel memory and different from process’ stack. Also one kernel stack per process.
context saving
kernel stack is used to save associated process context
process
is the abstraction used by the OS to execute programs
features of a process
Protection against other processes,
Isolation from OS/kernel
Intuitive and easy-to-use interface (syscalls)
Portable, hides implementation details
Can be instantiated many times
Efficient and reasonable easy to implement
Address space
Each process has its own memory address space
Environment
Defined in PCB, Determines all the specific characteristics of a process
Execution flow
Single sequential execution stream, Statements executed in order, Can only be at one location in the code at a time, Can only be (slightly) disrupted by signals
what is the scheduler in charge of
determining which process should run
cooperative
process can hold onto cpu during long cpu bursts
preemptive
process can be forcefully suspended even during long CPU bursts
Process state: ready
after fork is called and is ready to execute. will be in this state until it’s elected to run by scheduler
Process state: running
the process is now executing instructions. (3 things can happen)
submission time
time at which a process is created
Turnaround time
total time between process submission and completion
Response time
time between process submission and first execution or first response
Waiting time
total time spent in the ready queue
FCFS (or FIFO)
takes the first process that arrives
SJF
Shortest Job First . takes the shortest process to execute. Optimal scheduling but requires to know task lengths in advance
Preemptive SJF
Also known as SRTF (Shortest Remaining Time First). New shorter jobs can interrupt longer jobs
Round-robin (RR)
asks run only for a (short) time slice at a time
Relies on preemption (via timer interrupts) and prevents starving
starvation
when a process is unable to run because of another process’ runtime
concurrency
the composition of independently executing tasks and is opposite to sequential execution
Types of concurrency
CPU burst and I/O burst
CPU virtualization
Processes interleaved on same CPU
I/O concurrency
I/O bursts overlapped with CPU bursts
Each task runs almost as fast as if it had its
own computer
Total completion time reduced
CPU parallelism
Requires multiple CPUs
Processes running at the SAME TIME simultaneously
Speedup
speedup
decrease it the time it takes for a process to run. Ideally linear, often sublinear due to bottle necks. Could be superlinear.
Process concurrency limitations
quite heavy for the OS to fork a process, Slow context switch, Difficulty to communicate between processes
Threads
Single execution sequence that represents a separately scheduled task. Usually one or more threads per process
PCB
Process Control Block. has the PID, Owner, priority, current working directory, active thread, pointers to thread control blocks,
TCB
Thread Control Block. has the tack pointer, PC, thread state, register values, pointer to PCB
context switch
change from one process to another