You are on page 1of 3

Tutorial 12

Mohammad Firdaus Bin Ahad

DME03 Intake 6

1. Process is program instance that has been loaded into main memory and
managed by OS. Process in running state works with Registers and Call
stack.
2. OS maintains a data structure called Process Block Control (PCB) for each
process.
3. Process State:
New
Initial state. Process is first created.
Ready
Process is ready for execution.
Running
Once the process has been assigned by OS scheduler,
process is in running state.
Blocked/Waiting
The process is waiting for an event or I/O before proceeding.
Terminated
Process has finished execution.
4. Lack of process synchronization can cause a Deadlock or Starvation.
5. Example of Deadlock:
Process 1 tries to get ownership of the drive but is told to wait for
Process 2 to release it.
Process 2 tries to get ownership of the drive but is told to wait for
Process 1 to release it.

6. Condition of Deadlock:
Mutual Exclusion: Each resource is either currently assigned to
exactly one process or is available.
Hold and Wait: A process holding a resource is permitted to request
a new resource.
No Preemption: Resource cannot be forcibly taken away. A process
must release its resource voluntarily.
7. Aims of Process Scheduling:
Dispatcher
Performs context switching.
Scheduler
Selects the next process from those in main memory (Shortterm Scheduler).
Swapper
Manages transfer of processes between main memory and
secondary storage (Medium-term Scheduler).

Tutorial 12

Mohammad Firdaus Bin Ahad

DME03 Intake 6

Tutorial 12

Mohammad Firdaus Bin Ahad

DME03 Intake 6

8. Pre-emptive
Processes scheduled fairly.
Performs time-sharing.
If quantum is too long Poor response time.
Non Pre-emptive
Runs the process in the order they arrive.
Removes a process from the processor only if it is blocked.
Monopolizes CPU time.
9. P1(5ms), P2(20ms), P3(10ms)

P1

0
25

P3

P2

15

You might also like