Definitioner Flashcards
What is stored in the Process Control Block?
Process scheduling state, structuring information, privileges, state, pid, program counter, CPU registers, information of page table.
What is PCB role?
Used and modified by OS utilties (scheduling, memory, I/O resource access). The set of PCBs defines the current state of the operating system.
What is the process control block?
Is a data structure in the operating system kernel contraining information needed to manage the scheduling of a particular process.
Where is PCB stored?
In some OS it is stored in the beginning of the kernel stack of the process. (within the OS kernel).
What is context switch?
Is the process of storing the state of a process, so that it can be restored and execution resumed from the same point later. It is essential to virtualization of CPU.
What information is stored and recieved when performing a context swithc between threads?
No TLB flush is necessary, they share same adress space.
What happens during a context switch?
The processimage (registers of the process, PC) is stored in PCB. A handle to the PCB is added to a queue of processes that are ready to run. It restored the PCB of next process scheduled to run. PC from that PCV is loaded and execution can continue.
What makes context switch costly?
TLB flushes,
Thread control blocks
No need to switch page tables (same address space).
Thread-local storage
The stack of the relevant thread.
Parallelism
Do work on multiple CPU using threading, one thread per CPU
Race condition
Arises if multiple threads of execution enter the critical section at roughly the same time; both attempt to update the shared data strucutre, Results is nondeterministic
Critical section
Code that can result in race condition. Piece of code that accesses a shared resource, usually a variable or data structure.
Mutual exclusion
Guarantees one thread at a time executing within critical section.
Atomically
As a unit, all or none.
Condition variable
To wait for a condition to become true, is an explicit queue that threads can put themself on when conditions are not met, another thread can wake that thread by signaling that condition.
Semaphore
A semaphore used as a lock is called a binary semaphore. Is a powerful and flexible primitive for writing concurrent programs. Simple and utility.
Spin-waiting
Endlessly checks the value of flag
Preemptive scheduler
One that will interupt a thread via a timer.
Yield:
A system call that moves the caller from running state to ready state (process deschedules itself)
Priority inversion:
A thread of higher priority tries to acquire an lock that is already lock, it will do it indefiently.
Two-phase lock:
Uses a spinlock, if not lock is acquired during first spin phase, a sacond phase is entered, where the caller is put to sleep, and only woken up when the lock becomes free later.
Compare-and-swap
Test whether the value at the address is equal to expeted, then update memory location with the new value, if not do nothing.
Overlap
Avoid blocking program due to slow I/O.