Skip to main content

OS

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

Comments

Popular posts from this blog

Time, Speed and Distance

Time, Speed And Distance  In this post, We will learn about time, speed and distance. Important Formula Distance = Time x Speed Time = Distance/Speed Speed = Distance/time Important Units Distance: meter (m), kilometre (km) Time: Hour (h), second (s) speed: meter/second (m/s), kilometre/hour  (km/h) Important Conversion 1 km = 1000 meter 1 h = 3600 s 1 km/h = (5/18) m/s 1 m/s = (18/5) km/h Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above. 

Joint Entrance Exam (JEE): Probability Syllabus

JEE: Probability Syllabus Probability  is a very interesting and different topic of mathematics which doesn't require your previous knowledge of any other chapters other than permutation and combination.  Following topics are the part of Jee syllabus Addition and multiplication rules of probability Addition and multiplication rules of probability Conditional Probability Bayes Theorem Independence of events Computation of probability of events using permutations and combinations Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Haryana Public Service Commission: HPSC 2018

Haryana Public Service Commission: HPSC 2018 Company Name         :  Haryana Public Service Commission: HPSC 2018 Recruitment Post Name                       :   Civil Judge State                            :  Haryana Salary                           :  Rs   27,700-44,770 Number of Vacancy   :  107 Eligibility                     :  Bachelor's Degree in Law Last Date to Apply     :  30-09-2018 Application Details    :  Notification Apply Online              :  Apply Here Government Jobs In  Haryana Please write comments if you f...

Securities and Exchange Board of India Recruitment 2018

Securities and Exchange Board of India  Company Name SEBI Post Name Assistant Manager State India Salary RS 28150-55600 Number of Vacancy 120 Eligibility Graduation Last Date 07-10-2018 Application Details Job Notification Apply Online Job Application Securities and Exchange Board of India (SEBI) Recruitment 2018    Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.