CPU Scheduling, Scheduling Criteria, Optimization Criteria

Explain  CPU Scheduling, Scheduling Criteria, Optimization Criteria In Operating System
In This Topic & Blog Having Any Query Then Post your Comment and Suggestion Below

CPU Scheduling

• Basic Concepts
• Scheduling Criteria
• Scheduling Algorithms
• Multiple-Processor Scheduling
• Real-Time Scheduling
• Algorithm Evaluation

Basic Concepts
• Maximum CPU utilization obtained with
multiprogramming
• CPU–I/O Burst Cycle – Process execution
consists of a cycle of CPU execution and I/O
wait.
• CPU burst distribution

CPU Scheduler
• Selects from among the processes in memory
that are ready to execute, and allocates the
CPU to one of them.
• CPU scheduling decisions may take place when
a process:
1. Switches from running to waiting state.
2. Switches from running to ready state.
3. Switches from waiting to ready.
4. Terminates.
• Scheduling under 1 and 4 is nonpreemptive.
• All other scheduling is preemptive.

Dispatcher
• Dispatcher module gives control of the CPU to
the process selected by the short-term
scheduler; this involves:
– switching context
– switching to user mode
– jumping to the proper location in the user program
to restart that program
• Dispatch latency – time it takes for the
dispatcher to stop one process and start
another running.

Scheduling Criteria

• CPU utilization – keep the CPU as busy as
possible
• Throughput – # of processes that complete
their execution per time unit
• Turnaround time – amount of time to execute
a particular process
• Waiting time – amount of time a process has
been waiting in the ready queue
• Response time – amount of time it takes from
when a request was submitted until the first
response is produced, not output (for timesharing
environment)

Optimization Criteria

• Max CPU utilization
• Max throughput
• Min turnaround time
• Min waiting time
• Min response time

Scheduling Criteria
• CPU utilization – keep the CPU as busy as possible
• Throughput – # of processes that complete their
execution per time unit
• Turnaround time – amount of time to execute a
particular process
• Waiting time – amount of time a process has been
waiting in the ready queue
• Response time – amount of time it takes from when a
request was submitted until the first response is
produced, not output (for time-sharing environment)

 Short-term scheduler is invoked very frequently
(milliseconds)  (must be fast).
 Long-term scheduler is invoked very infrequently
(seconds, minutes)  (may be slow).
 The long-term scheduler controls the degree of
multiprogramming.
 Processes can be described as either:
 I/O-bound process – spends more time doing I/O than
computations, many short CPU bursts.
 CPU-bound process – spends more time doing
computations; few very long CPU bursts.

Context Switch
 When CPU switches to another process, the
system must save the state of the old process
and load the saved state for the new process.
 Context-switch time is overhead; the system
does no useful work while switching.
 Time dependent on hardware support.

Process Creation
• Parent process create children processes, which, in
turn create other processes, forming a tree of
processes.
• Resource sharing
– Parent and children share all resources.
– Children share subset of parent’s resources.
– Parent and child share no resources.
• Execution
– Parent and children execute concurrently.
– Parent waits until children terminate.
• Address space
– Child duplicate of parent.
– Child has a program loaded into it.
• UNIX examples
– fork system call creates new process
– exec system call used after a fork to replace the
process’ memory space with a new program.

Labels: