Content-Length: 3094650 | pFad | https://www.scribd.com/presentation/514437324/Lecture-04

3 What Is A Program and Process? | PDF | Scheduling (Computing) | Process (Computing)
0% found this document useful (0 votes)
24 views16 pages

What Is A Program and Process?

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1/ 16

What is a program and process?

 Program – a passive entity and composed of set


of instructions.

 Process – an active entity and it is a program in


execution with PC specifying the address of next
instruction to be executed.
CPU and I/O Bound Processes

Processes can be:


 I/O-bound process – spends more time doing I/O
than computations, many short CPU bursts.

I/O Burst CPU Burst I/O Burst CPU Burst

 CPU-bound process – spends more time doing


computations; few very long CPU bursts.

CPU Burst I/O CPU Burst I/O


Process States
As a process executes, it can be in one of
following states
 new: The process is being created.
 ready: The process is waiting to be assigned to

a processor.
 running: Instructions are being executed.
 waiting: The process is waiting for some event

to occur.
 terminated: The process has finished execution.
Process States
Process Control Block
(PCB)
PCB is a OS data structure, allocated to each process when it
is created. The OS keeps all the data it needs about the
process for its execution in PCB.
 Process state

 Program counter

 CPU registers

 CPU scheduling information

 Memory-management information

 Accounting information

 I/O status information

 Per process file table

 Process ID (PID)

 Parent PID, etc.


Process Control Block (PCB)
CPU Switch From Process
to Process
Context Switch
 When CPU switches to another process, the
system must save the state (context) of the
‘current’ (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; typically in
microseconds
Process Scheduling Queues

 Job queue – set of all processes in the system.

 Ready queue – set of all processes residing in


main memory, ready and waiting to execute.

 Device queues – set of processes waiting for I/O


devices.

 Process migration between the various queues.


Queues in the OS
Queues in a Computer System
Schedulers
 Long term scheduler
 Short term scheduler
 Medium term scheduler
Long Term Scheduler
 Long-term scheduler (or job scheduler) – selects
processes from the job pool to be brought into the
ready queue.
 Long-term scheduler is invoked very infrequently
(seconds, minutes)  (may be slow).
 The long-term scheduler controls the degree of
multiprogramming.
 More processes, smaller percentage of time each
process is executed
Short Term Scheduler
 Short-term scheduler (or CPU scheduler) – selects
which process should be executed next and
allocates it the CPU through the dispatcher.
 Short-term scheduler is invoked very frequently
(milliseconds)  (must be fast).
 Invoked when following events occur
• CPU slice of the current process finishes
• Current process needs to wait for an event
• Clock interrupt
• I/O interrupt
• System call
Medium Term Scheduler
 Also known as swapper
 Selects an in-memory process and swaps it out to
the disk temporarily
 Swapping decision is based on several factors
• Arrival of a higher priority process but no
memory available
• Poor mix of jobs
• Memory request of a process cannot be met
Addition of Medium Term
Scheduling

You might also like









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://www.scribd.com/presentation/514437324/Lecture-04

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy