of metorun.to removedfshivammitra.com/assets/images/os_notes/preemptivs vs non.pdf · 2021. 1....
TRANSCRIPT
-
Preemptive vs Nonpreemptive Scheduling
ShorttermischediaPreemptive Scheduling
yeadyqieue.CI
In preemptive scheduling each process gets a slice
of cpu.sk metorun.to
The running process canbe fiercely removedfrom
the CPU underfollowing conditions
Timeslice expires n dy
running ready2 An interrupt occurs on the CPU
A higher priority processenters the ready queue
NEW READY
WAITING READYt
I
-
Nonpreemptifescheduling
In nonpreemptive scheduling therunning process
cannot be forcefully removed from the CPU
A running process holds the Cputill
gt terminates
2 St switches from tat
on its own because of
9 I o request wafork C
µ Ya gforthechild mHet49fthe mutexor the semaphore is occupiedI
I
-
emptive Microsoftwindows3IOt All windowsversion afterwindows
Mac OS Linux1 1 1
Cost of Preemptive scheduling
1 sharing data between processes
when one process is p edata itgets
preemptedr
Gf some otherness triestoreadthis data
it will find this datain inconsistent data
Different mechanisms like spinifex weredeveloped to nataees
I
-
Forehead of guarding shared dataininterrupts
whenever an interrupt happens an interrupt
handleriscalled
What if the same interrupt happenson two
CPU's and the interrupt handler sharesdata
Need to use ex to protect criticalsection
3 Increases the complexidsgnwhat happens when the Kernel is changing
some important data I o queuesand gets
preempted in middle D DD
what if the kernel againtries to modify this
data on behalf of some different process
system d
Syd add