Instruction cycle is fetch, decode, execute
Cache er small, very fast memory on processor for recently used memory content for quick access
Memory Hierarchy. Fast, small, expensive on top, slow, large, cheap on bottom
Objectives of OS: Conveniance, efficiency, evolution
Multiprogramming: Processes use the same Processor
Batch processing: One program executed before the next one is started
Processes: A program in execution
Resource management: Fairness, Differential responsiveness, effiency
Instruction trace : Sequence of instructions executed for a process
Process states : ready, running, block, suspend.
Process control block: Contains information for OS to control processes
PCB Stack = Identification, State, priority, pc, memory pointers, context data, io status, accounting information.
Kernel mode has access to all, user should be restricted to protect the os.
Process can have one or more threads. Threads are execution units within processes while processes are binaries. Process has one process control block while threads gets it's own space on the stack and control block. Threads share the state and resources of that process
kaflar 11 oog 12
Single buffer - process writes to buffer than has to wait for I/O to write and reverse. Double buffer - Process can write to one buffer and read another, don't have to wait. Circular buffer uses more than 2 buffers.
Blocking i/o - process continues in non blocking, os takes over if it is blocking
Race condition : "loser" makes the last change, affects all.
Mutual exclusion: only one process can access code or data.
Producer puts data in buffer, consumer takes data from buffer.
If there is no data consumer sleeps and producer wakes him when he adds data.
If buffer is full, producer sleeps and consumer wakes him when he takes data.
The conditions that must be satisfied are as follows
1.Any number of readers may simultaneously read the file
2.Only one writer at a time may write to the file, no reader may read it
Monitors must be invoked with a call to a monitor procedure. uses wait and signal, if no process is waiting the signal is lost.
Message passing: direct and indirect.
Mutual exclusion, no preemption, hold and wait, circular wait
Eliminate on of the conditions. Direct eliminates circular waiting, indirect the other 3. Very conservative
Dynamic decision if current resource request will cause deadlock. Bankers algo
Tests for deadlocks, consumes cosiderable cpu time, liberal with resources.
Where process is overlooked by scheduler even though it's ready to run.
Program to big, use overlays, inefficient, internal fragmentation
Chooses the smalles space it can fit in, might lead to swapping,memory might go unused, internal fragmentation
Each process gets exactly what it needs, small holes, external fragmentation, compact
Chooses the block closest in size
Chooses the next block which can hold the process. scan from beginning
Starts for current position, finds block next available large enough block.
Translation lookaside buffer: checks the TLB table and if it's a hit it gets the frame number immediately and can add the offset and find the data it needs else it has to look up the address in the page table.
Page replacement: FIFO, LRU, Optimal, Clock.
Levels of scheduling
Long term, medium term, short term.
Controls what programs are admitted to the system for processing
if process starts in swap out it is added to medium term scheduler
when program becomes a process it is added to the short term scheduler
Preemptive and non preemptive
Preemtive can take resources, non preemptive can not