Chapter # 2
Process Management
Process Management Concept of threads Flows of execution are also called threads. A process can have single or multiple threads.
Classification of operating system
Single Process, Single-Threaded
Multi-Process, Single- Threaded
Multi-Process, Multi-Threaded
Heavy weight process and Light weight process
ď‚— Heavy weight process A uni-threaded (single thread) process is a heavy weight process.
ď‚— Light weight process The whole process will run and finish in one execution. However, if a process has multiple threads, then it will complete in many executions. Each of these threads is a light weight process.
Process Scheduling Long term Scheduler
AKA
Job Scheduling
Creates new processes Medium term Scheduler
AKA
Swapper
Transfers processes between disk and memory Short term Scheduler
AKA Dispatcher
Loads and unloads a job on/from CPU
Process State Short term scheduling
Blocked, Waiting for an I/O
Ready, Not running but ready
Running, Loaded on CPU and executing
Terminated, zombie, ended execution
Medium term scheduling
Swapped-Blocked, waiting for I/O on disk Swapped – Ready, ready and on disk
Long term scheduling
Held/new, infant
Process state transition diagram
Process state transition diagram
Held Conditions:
Ready
Process state transition diagram
Held Conditions:
Ready
Process state transition diagram
Held
Ready
Conditions: The process will now be considered to be loaded on CPU by the dispatcher according to its algorithm in effect.
Process state trnsition diagram Seven-State Model
Process Creation
Held
Held
Swapped-Ready
Swapped-Blocked
Ready
Swapped-Blocked
Running Ready (Time Slice Concept)
Ready
Running
Blocked
Running
Terminated
Any State
Swapped-Ready or Held
Ready
Ready Blocked
Swapped-Ready or Blocked
Swapped-Blocked
Swapped-Ready or Blocked
Running
Terminated
Ready
Scheduling Criteria 1.
CPU Utilization
2. Balanced Utilization 3. Throughput 4. Turnaround time 5. Wait time 6. Response time 7.
Predictability
8. Fairness 9. Priorities
CPU Scheduling Algorithms Preemptive Vs. Non Preemptive Preemptive, the dispatcher can unload a runnig process from CPU and store it somewhere in favor of another process due to changing system conditions or activity of the process itself.
CPU Scheduling Algorithms Preemptive Vs. Non Preemptive Non Preemptive, the dispatcher cannot unload a runnig process from CPU.
CPU Scheduling Algorithms
1. First-Come First-Served (non-preemptive) 2. Shortest Job First (non-preemptive) en+1 = αtn + (1 – α)en 3. Shortest Remaining time (preemptive) 4. Round Robin (preemptive) interval timer 5. Priority (non-preemptive or preemptive) –
Memory Usage
–
I/O Frequency
–
User executing the process
–
Usage cost
–
Dynamic changing of priorities
6. Multilevel Feedback Queues
Multi-Level Feedback Queues
Multi-Level Feedback Queues The major options of MFQs can be summarized as
The Number of Queues
The time-slice associated with each queue
The selection algorithms used to select a process from within each queue
The condition(s) that will cause a process to sink a lower-level queue
The condition(s) that will cause a process to rise to a higher-level queue
Whether arrival of a process into a higher-level queue will preempt a process from a lower-level queue
The mechanism for determining which queue a new process enters into
PCB Process Control Bank Stores all needed info about a process Created at the time the process is created Used by the OS itself
Process Attributes Run state and scheduling Memory Management Hardware State
Context-Switch
Signaling Access Control Input and Output Other
Process Id
Parent Process Id
Child Process Id
Process group id(s)
User id
Effective user id
Group id(s)
Effective Group id(s)
Account id
Priority level
Elapsed CPU time
Start time
Scheduled start time
Maximum CPU time
Memory Allocation
Command
Terminal
Termination Status
Process Supervisor Calls Two Initial Settings for information in PCB
Concept of the system call
Process creation and execution
Concept of fork and exec
Exit Supervisor call Wait call Cascading termination
Abort Call