Os Study Material
Os Study Material
L-1.1
os-Interface between user and hardware
Primary goals of OS
convenience
throughput(best is linux)
throughPut- The number of task executed per unit time.
Funtionality of OS
Resource management
Process management
Storage management
Memory management
Security and Privacy
L-1.2
Types of Operating System
Batch-Giving similar kind of jobs to the system.Cpu executes only one job at a
time which was a disadvantage.
Fortran created by ibm to reduce the work of operator(the people used to run
commands for people).
IBSYS709X(1960).
L-1.3
*Multiprogrammed-(Non-preemptive(means Cpu execute the whole process at once
until or unless the job itself goes for some work like I/O work).
Secondary Memory tries to push as many operation in the RAM.)
L-1.4
Real Time Os-Avoid Delays
1. Hard Real Time
2. Soft Real Time
L-1.5
See at Timing-20:00 on Gate Smashers.
L-1.6
u-user r-read 4
g-group w-write 2
o-other x-execute 1
Chmod-Change mod
It has 9 values,first 3 for user,then 3 for group and last 3 for others.
then the 3 values denote 1-read,2-write,3-execute in same order.
if there is value present on the place then the person has that permission.
lseek-Command is used to move the read/write position.
SEEK_CUR-Current value + given value
SEEK_SET-Set to current value
SEEK_END-Last value - current value
L-1.7
Watch at Timing=9:00 at Gate Smashers.
L-1.8
Fork-makes child process along with parent process.
child has its own id which is 0 and parent process has some +ve number id
Total time execution runs=pow(2,n) where n is number of forks
Total child processes run=pow(2,n)-1
L-1.9
Question Related to fork.
L-1.10
Difference Between User Mode Vs Kernel Mode
we work on user mode (Mode bit 1). when we execute a process it makes a call to
kernel mode(Mode bit 0) to access hardware.
L-1.11
Process | Threads
System calls involved |There is no system call(user lvl)
OS treats different process differently|All User lvl threads treated as
| single task for OS.
Different process have different copies|threads share same copies of code
of data,files code. | and data.
Content Switching in slower(as the OS |Content switching is faster
has to store values) |
Blocking Process will not block another|blocking a thread will block
| entire process.
L-1.12
User lvl thread | kernel level thread
-user lvl thread are managed by |kernel level threads are managed
user level library | by OS system calls
-user level threads are typically fast |kernel level threads are slower
-context switching is faster |context switching is slower
-if one user lvl thread perform blocking|one kernel level thread blocked
operation then entire operation gets | no affect on others
blocked |
L-2.1
Scheduling Algorithms
Pre-Emptive | Non Pre-Emptive
*-SRTF(Shortest Remaining time first) |-FCFS(First Come First Serve)
|
-LRTF(Longest Remaining time first) |-SJF(Shortest Job First)
|
*-Round Robin |-LJF(Longest Job First)
|
-Priority based(sometimes it can |-HRRN(Highest Response Ratio Next)
also be a part of Non-pre-emptive) |
|-Multilevel Queue
L-2.2
Arrival Time-Time at which process enter ready queue
Burst Time-Time required by process to execute on cpu
Completion Time-Time at which process completes its execution
TurnAround Time- {Completion Time- Arrival Time}
Waiting Time- {Turn Around Time- Burst Time}
Response Time-Time at which process first gets CPU - Arrival Time
L-2.3
FCFS-First Come First Serve
It checks arrival time
See At 9:52
L-2.4
SJF-Shortest Job First
It checks burst time
See At 8:32
L-2.5
SRTF(SJF With Pre-Emption)-Shortest Remaining Time First
It checks Burst Time
See At 13:14
L-2.6
Question on SRTF
L-2.7
RR-Round Robin
It checks Time Quantam
PCB(Process Control Block)-Saves The context of the process while context
switching(When one process leaves the running state).
Que-Number of Context Switching?
count the lines between gantt chart , Not first not last
See at 14:59
L-2.8
PPS-Pre-emptive priority scheduling
It checks Priority
See At 9:10
L-2.9
Example of Mix Burst Time
See At 13:00
L-2.10
Multi Level Queue Scheduling
disadvantage:lower priority processes will face starvation if higher priority
process are greater.
to overcome this we use MultiLevel feedback queue scheduling.
L-2.11
MultiLevel Feedback queue scheduling
it is used to overcome starvation.
lower priority queue gives feddback(upgrade) so that it's turn come fast.
L-3.1
Process Synchronization
:-Types
1. serial-One task at a time.
2. parallel-Time sharing environment(Multi task at same time).
:-Types of Processes
1.Cooperative Process-the processes that share
something(variable,memory,code,resources).
2.Independent Processes.
L-3.2
Producer Consumer Problem
//See at 25:11
L-3.3
Printer-Spooler Problem
See at 1:34 to check where all printer program goes and what are the commands to do
it.
Watch at 4:15 for Case 1.(When there is one process)
Watch at 10:50 for case 2.(when there are 2 processes).
L-3.4
Critical Section-It is a part of the program where shared resources
are accessed by various processes(Cooperative Processes).
//Watch at 8:49 to see what we do to stop Race Condition
Synchronization mechanism
4 Condition
1. Mutual Exclusion-if p1 is in Critical section then p2 cannot enter CS.
2. Progress-when there is no process in CS.and p1 is interested and p2 is not but
p2 is stopping p1 to enter.that means progress is not happening.
3. Bounded Wait-after few turns of p1 continuosly p2 also gets a chance to enter
in CS.
4. No assumption related to Hardware and speed-Should not get affected by speed
of System and should also be portable.
3.critical section
//exit code
4.lock=0
Case 2- when p1 gets preempt after perfoming 1.then p2 will come and enter the
cs.then p1 comes again
but this time it will enter in the cs without performing 1 as he has done it
already.then mutual exclusion is Gone.
L-3.8 SemaPhore
"Semaphore is an integer variable which is used in a mutual exclusive manner
by various Concurrent cooperative processes in order to achieve Synchronization"
//Processes Used
entry- p() , Down , Wait
exit - v() , up , signal,post,release
//Watch at 13:30
Binary Semaphore