Week 03 Lecture Chapter 3
Week 03 Lecture Chapter 3
The Process
□ A process is a program in execution
□ A program itself is not a process.
□ The fundamental difference between process and program are:
1. A process is a program in execution, where a program is an
executable file residing on the disk (secondary storage) in a
directory.
2. A process is termed as an ‘active entity’ since it is always
stored in the main memory and disappears if the machine is
power cycled, where A program is termed as a ‘passive entity’
which exists in the secondary storage persistently even if the
machine reboots.
3. Executing multiple instances of the ‘Calculator’ program. Each
of the instances is termed as a process. where (Windows) The
‘Calculator’ program is stored at
“c:\windows\system32\calc.exe”.
Process State
❑ CPU registers.
❑ CPU-Scheduling information.
❑ Memory-management information.
❑ Accounting information.
diagram.
I. The process could issue an I/O request and then be placed in an I/O
queue.
II. The process could create a new child process and wait for the child’s
termination.
III. The process could be removed forcibly from the CPU, as a result of an
interrupt, and be put back in the ready queue.
Schedulers
▪ Often, more processes are submitted than can be executed immediately.
These processes are spooled to a mass-storage device (typically a disk),
where they are kept for later execution.
▪ The long-term scheduler, or job scheduler, selects processes from this
pool and loads them into memory for execution.
❑ The long-term scheduler executes much less frequently; minutes may
separate the creation of one new process and the next, it means it’s
invoked infrequently. Because of the longer interval between
executions, the long-term scheduler can afford to take more time to
decide which process should be selected for execution, it may work
slow (seconds, minutes).
▪ The short-term scheduler, or CPU scheduler, selects from among the
processes that are ready to execute and allocates the CPU to one of them.
❑ It is executed at least once every 100 milliseconds, it means it’s
invoked frequently. Because of the short time between execution, it
must be fast (milliseconds).
Context Switch
It is desirable to:
▪ Maximize CPU utilization.
▪ Maximize throughput.
▪ Minimize turnaround time.
▪ Minimize waiting time.
▪ Minimize response time.