Sie sind auf Seite 1von 14

3.

1 OS System view
Process Concept

Some Important Terms


Program inactive unit, such as a file stored on a disk.
To an operating system, a program or job is a unit of work that has been submitted by user. Job is usually associated with batch systems.

Process (task) active entity, which requires a set of resources, including a processor and special registers to perform its function.
A single instance of an executable program.
Understanding Operating Systems 2

Process manager responsibility


Generally an operating system must : i. allocate resources to processes - The responsibility of determining how to allocate processor time among all the ready processes is known as scheduling i. enable processes to share and exchange information ii. protect the resources of each process from other processes iii. enable synchronization among processes

Process manager responsibility


Practically, the process manager creates the process abstraction and provides facilities so that a process can create, destroy, synchronize, and protect other processes The kernel is responsible for creating, scheduling and deleting processes and often for inter-process communication.

keeps track of each process in memory. determines the state of each process: whether it is running, ready to run, or waiting for some event, such as I/O to be completed, in order to proceed. maintains tables that determine the current program counter, register values, assigned files and I/O resources, and other parameters for each process in memory. coordinates and manages message handling and process synchronization.

Process Control Block (PCB)


Process Control Block (PCB) -- data structure that contains basic info about the job
Process identification Process status (HOLD, READY, RUNNING, WAITING) Process state (process status word, register contents, main memory info, resources, process priority) Accounting (CPU time, total amount of time, I/O operations, number input records read, etc.)
Understanding Operating Systems 6

Process Control Block


Each process is represented in the operating system by a process control block (PCB) also called a task control block.. It contains many pieces of information associated with a specific process. PCB will be created by job scheduler when a process is put into hold(new) state
Understanding Operating Systems 7

Job Scheduling vs. Process Scheduling


Processor Manager has 2 sub-managers: 1. Job Scheduler
in charge of job scheduling.

2. Process Scheduler
in charge of process scheduling.

Understanding Operating Systems

Job Scheduler
High-level scheduler. Selects jobs from a queue of incoming jobs. Places them in process queue (batch or interactive), based on each jobs characteristics. Goal is to put jobs in a sequence that uses all systems resources as fully as possible. Strives for balanced mix of jobs with large I/O interaction and jobs with lots of computation.
Tries to keep most system components busy most of time.
Understanding Operating Systems 9

Process Scheduler
Low-level scheduler assigns the CPU to execute processes of those jobs placed on ready queue by Job Scheduler.

After a job has been placed on the READY queue by Job Scheduler, Process Scheduler that takes over.
Determines which jobs will get CPU, when, and for how long. Decides when processing should be interrupted. Determines queues job should be moved to during execution. Recognizes when a job has concluded and should be terminated.
10

Understanding Operating Systems

Processor Manager : Middle-Level Scheduler


In a highly interactive environment theres a third layer
called middle-level scheduler.

Removes active jobs from memory to reduce degree of multiprogramming and allows jobs to be completed faster.

Understanding Operating Systems

11

Job and Process Status


Hold(New)

Admitted
Interrupt Exit

Finished

Ready
Job pool I/O or event completion Waiting Handled by Process Scheduler Handled by Job Scheduler

Running
Scheduler dispatch I/O or event wait

12

Transition Among Process States


HOLD to READY : Job Scheduler using a predefined policy. READY to RUNNING : Process Scheduler using some predefined algorithm RUNNING back to READY : Process Scheduler according to some predefined time limit or other criterion. RUNNING to WAITING : Process Scheduler and is initiated by an instruction in the job (I/O request). WAITING to READY : Process Scheduler and is initiated by signal from I/O device manager that I/O request has been satisfied and job can continue. RUNNING to FINISHED : Process Scheduler or Job Scheduler.

Understanding Operating Systems

13

How Does Processor Manager Allocate CPU(s) to Jobs?


Process Manager performs job scheduling, process scheduling and interrupt management. In single-tasking, processor is busy only when user is executing a jobat all other times it is idle.
Processor management is simple.

In multiprogramming environment, processor must be allocated to each job in a fair and efficient manner.
Requires scheduling policy and a scheduling algorithm. Eg. FCFS, SJF, SRTF, RR etc.
Understanding Operating Systems 14

Das könnte Ihnen auch gefallen