0
921views
Differentiate the following: i) Process vs Thread ii) Preemptive vs Non-preemptive Scheduling
1 Answer
| written 3.7 years ago by |
Process:
| Process Control Block |
|---|
| Process ID |
| Process state |
| Program Counter |
| CPU Registers |
| CPU Scheduling Algorithm |
| Page Table Info |
| Device Info |
Thread:
| Process | Threads |
|---|---|
| Processes don't share memory | A thread is a sub-part of process. Light-weight process. |
| A process is a program under execution i.e an active program | Threads require less time for context switching as they are lighter than processes |
| Processes require more time for context switching as they are more heavy |
A thread may share some memory with its peerthreads |
| Communication between processes requires more time than between threads |
Communication between threads requires less time than between processes |
| If a process gets blocked, remaining processes cancontinue execution |
If a thread gets blocked, all of its peer threads also get blocked |
| Individual processes are independent of each other | Threads are parts of a process and so are dependent |
| Require more resources than threads | Need less resources than processes |
| Require more time for creation | Require less time for creation |
| Require more time for termination | Require less time for termination |
Preemptive Scheduling
Circumstances:
Non-Preemptive Scheduling
Circumstances:
| Preemptive Scheduling | Non-Preemptive Scheduling |
|---|---|
| CPU is allocated to a process forlimited time. | CPU is allocated to a process till it complete burst time or switches to waiting state. |
| Process can be interruptedin between | Process can not be interrupted in between |
| Low priority process may starve | Process with short burst time may starve |
| Switching the processes frequently increases the overhead |
Doesn't have switching overhead |
| Preemptive scheduling is flexible | Non-Preemptive scheduling is rigid |
| Cost associated | No cost associated |
| Round Robin, Priority Scheduling, Shortest Remaining Time First,etc. |
First Come First serve, Shortest Job First, etc. |