Hardware => Operating system => Application
OS Provide
- Hardware Abstraction
- Resource management
Abstraction: B/W Application and hardware
- Easy program writing
- Reusable functionality
- Portable
Resource management
- Multiple app but limited resource
- Manage CPU, Memory, Network, Secondary Memory etc
---------------
CPU
Each have a unique address
- Memory addrs
- IO Addrs
- Memory Mapped IO addrs
Memory addrs
32 bit process
Range: 0- 2^32-1
----------------
Process
Stack
Heap
Data
Text
System call use to access resources of kernel mode
------------------
Sharing the CPU - Multi-programming and multi-tasking - Sharing in multi-processor environments * Race conditions and synchronization * Scheduling * Isolation of the OS and user programs * Security mechanisms * Access control * Security assessment
-------------------
CPU Vs RAM
- RAM hold data CPU compute on data
Memory Management
- Fragmentation: Under utilization
- Finding Right fit (First fit, Right fit)
- Deallocation: Merge smaller block when process free memory
Modern OS manage above using
- Virtual memory
- Segmentation
-----------
Virtual Memory (Memory Management technique)
- RAM split into fixed size partition called frames
- Page frames typically 4KBs
Split Process into equal block size
Block size = page frame size
Allocate block into page frame
Page table: to maintain map of page and block
- Need not to be contiguous
- Need to lookup page table to access memory
TLV Caches
- Process block are on user space
- Page table are in kernel space
Demand paging:?
Page fault trap?
Replacement polices
- First in first out
- Last recently used
- least frequent useed
Swap in & swap out
Dirty Bit
Present BIT
protection Bit
PAGE TABLE
block | Page frame | P | D | protection Bit
MMU and Virtual memory mapping
---------------------------
Segmentation
Segment Descriptor table
------------------------
Process: program in execution
Process table
block | page frame
Kernel metadata
- Kernel stack
- user stack
PID: process unique id
process state
- new
- ready
- Block
- running
Queue of ready process
Process tree
init.d
Zombies: process terminated but PCB exist
Orphan: parent exit but child running
- Intentional
- daemons
ELF executable
----------------------------
Event
- Interrupt
- Trap
- Exception
IDTR: Interrupt Descriptor table
CPU Context switching
Multitasking
-------------------------------
CPU Scheduler
- FCFS (First come first serve)
- The Convoy Effect
Simple
Fair: all job execute
Waiting time depend
short process stuck
2. SJF (Shortest job first)
- Min average waiting time
Not predictable
starvation
3. SRTF
4. Round robin
Data struct: FIFO (Queue)
Critical process:
Priority based scheduling
starvation
Multilevel queue
------------
Multiprocessor scheduling
- Global queue
- Each cpu has own queue
Load balance
- Pull migration
- Push migration
------------------------------
Inter process communication
- Shared memory
Signal
- Async unidirectional
Synchronization
Race condition
- Critical section
Critical section
- Mutual exec
- Progress
- No starvation
Locks
Unlock
Critical section solution
Deadlock
Bakery Algorithm
Synchronization N > 2 process
Use to solve critical section problem
Hardware lock
spinlock
Mutexes
Thundering herd problem
priority inversion
priority inheritance
Semaphore
Producer-Consumer problem
Buffer
P c
Dinning philosopher problem
Deadlock
Handle deadlock
Thread
Process can have multiple thread
Thread can have its own stack section, register
Light weight
Efficient communication b/w entities
Efficient context switching
pthread lib
User thread
Kernel thread
Thread pool
OS Provide
- Hardware Abstraction
- Resource management
Abstraction: B/W Application and hardware
- Easy program writing
- Reusable functionality
- Portable
Resource management
- Multiple app but limited resource
- Manage CPU, Memory, Network, Secondary Memory etc
---------------
CPU
Each have a unique address
- Memory addrs
- IO Addrs
- Memory Mapped IO addrs
Memory addrs
32 bit process
Range: 0- 2^32-1
----------------
Process
Stack
Heap
Data
Text
System call use to access resources of kernel mode
------------------
Sharing the CPU - Multi-programming and multi-tasking - Sharing in multi-processor environments * Race conditions and synchronization * Scheduling * Isolation of the OS and user programs * Security mechanisms * Access control * Security assessment
-------------------
CPU Vs RAM
- RAM hold data CPU compute on data
Memory Management
- Fragmentation: Under utilization
- Finding Right fit (First fit, Right fit)
- Deallocation: Merge smaller block when process free memory
Modern OS manage above using
- Virtual memory
- Segmentation
-----------
Virtual Memory (Memory Management technique)
- RAM split into fixed size partition called frames
- Page frames typically 4KBs
Split Process into equal block size
Block size = page frame size
Allocate block into page frame
Page table: to maintain map of page and block
- Need not to be contiguous
- Need to lookup page table to access memory
TLV Caches
- Process block are on user space
- Page table are in kernel space
Demand paging:?
Page fault trap?
Replacement polices
- First in first out
- Last recently used
- least frequent useed
Swap in & swap out
Dirty Bit
Present BIT
protection Bit
PAGE TABLE
block | Page frame | P | D | protection Bit
MMU and Virtual memory mapping
---------------------------
Segmentation
Segment Descriptor table
------------------------
Process: program in execution
Process table
block | page frame
Kernel metadata
- Kernel stack
- user stack
PID: process unique id
process state
- new
- ready
- Block
- running
Queue of ready process
Process tree
init.d
Zombies: process terminated but PCB exist
Orphan: parent exit but child running
- Intentional
- daemons
ELF executable
----------------------------
Event
- Interrupt
- Trap
- Exception
IDTR: Interrupt Descriptor table
CPU Context switching
Multitasking
-------------------------------
CPU Scheduler
- FCFS (First come first serve)
- The Convoy Effect
Simple
Fair: all job execute
Waiting time depend
short process stuck
2. SJF (Shortest job first)
- Min average waiting time
Not predictable
starvation
3. SRTF
4. Round robin
Data struct: FIFO (Queue)
Critical process:
Priority based scheduling
starvation
Multilevel queue
------------
Multiprocessor scheduling
- Global queue
- Each cpu has own queue
Load balance
- Pull migration
- Push migration
------------------------------
Inter process communication
- Shared memory
Signal
- Async unidirectional
Synchronization
Race condition
- Critical section
Critical section
- Mutual exec
- Progress
- No starvation
Locks
Unlock
Critical section solution
Deadlock
Bakery Algorithm
Synchronization N > 2 process
Use to solve critical section problem
Hardware lock
spinlock
Mutexes
Thundering herd problem
priority inversion
priority inheritance
Semaphore
Producer-Consumer problem
Buffer
P c
Dinning philosopher problem
Deadlock
Handle deadlock
Thread
Process can have multiple thread
Thread can have its own stack section, register
Light weight
Efficient communication b/w entities
Efficient context switching
pthread lib
User thread
Kernel thread
Thread pool
Comments
Post a Comment