Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

32
Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques

Transcript of Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Page 1: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Lecture 2

Process Concepts, Performance Measures and

Evaluation Techniques

Page 2: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Lecture Highlights What is a process Process Control Block Process states and process life

cycle Performance Measures Evaluation Techniques

Page 3: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

What is a process A process is a pre-written set of

ordered instructions which when executed causes the computer to behave in a manner determined by the code

A process is a program/part of machine code in execution

New process are spawned either by a user or by other processes.

Page 4: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Process and the operating system

When a new process is created, the operating system typically does the following: Assigns the process a unique process id (PID) Allocates a chunk of memory from the

available heap for the process Initializes a new PCB (Process Control Block) Adds the process to appropriate scheduling

queues Other maintenance tasks

Page 5: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Process Control Block (PCB)

A PCB is a data structure which stores certain information about each process. A typical PCB looks as follows: Process ID (PID) Time of Arrival (TOA) Execution Time Priority/ Process Type Size (Location in memory) Program Counter Registers/Threads Needed Resources

Page 6: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

PCB components Process ID

The system assigns each process a unique identifier which is used by other processes for scheduling, communication and any other purpose.

Page 7: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

PCB components Time of Arrival

The system keeps track of the time a process enters the process queue for scheduling purposes.

Page 8: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

PCB components Execution Time

This parameter is used by scheduling algorithms which order processes by the amount of time they need to complete execution. Mathematical formulae are used to calculate the estimated execution time of a process.

Page 9: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

PCB components Priority

Some processes, such as system processes, have a higher priority than others and the operating system uses this priority during scheduling and memory management.

Page 10: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

PCB components Size

It is the size of the process in bytes. This parameter indicates the memory location of a process also.

Page 11: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

PCB components Program Counter

The program counter value stores the address of the next instruction to be executed.

Page 12: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

PCB components Registers/Threads

This PCB parameter saves the state of different registers used by that particular process.

Page 13: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

PCB components Needed Resources

This PCB parameter indicates the quantities of system resources needed by that particular process.

Page 14: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Process StatesThe state of a process is defined in part by its current activity. As it executes, it changes state. Each process may be in one of the following states: New: The process is being created Running: Instructions are being executed Waiting: The process is waiting for some event

to occur Ready: The process is waiting to be assigned to

a processor Terminated: The process has finished execution

Page 15: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Process Life Cycle

waiting

ready running

newadmitted

interrupted

I/O or event wait

I/O or event completion

scheduler dispatch

exit

terminated

Page 16: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Uploading/Downloading PCBs

Process P0 operating system Process P1 Interrupt or system

call

Save state into PCB0

Save state into PCB1

Reload state from PCB0

Reload state from PCB1

Interrupt or system call

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

idle

idle

idle

executing

executing

executing

.

.

.

.

CONTEXT SWITCH

CONTEXT SWITCH

Page 17: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Performance MeasuresIt is important to quantify performance so that it can be measured. Commonly used performance measures: CPU Utilization Turnaround time Waiting time Throughput Response time

Before we discuss the individual performance measures, we need to understand the related concepts of context switching and starvation.

Page 18: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Performance MeasuresRelated Concept - Context Switch Switching the CPU to another process

requires saving the state of the old process and loading the state of the new process. This task is known as a context switch. (it is labeled in the diagram uploading/downloading PCBs)

Increased context switching affects performance adversely because the CPU spends more time switching between tasks than it does with the tasks itself.

Page 19: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Performance MeasuresRelated Concept - Starvation

This is the situation where a process waits endlessly for CPU attention.

As a result of starvation, the starved process may never complete its designated task.

Page 20: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Performance MeasuresCPU Utilization

It is the ratio of time that the CPU is doing actual processing to the total CPU time observed.

This is a true measure of performance since it measures efficiency of the system. An idle CPU has 0% CPU utilization since it offers null performance per unit cost. The higher the CPU utilization, the better the efficiency of the system

Page 21: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Performance MeasuresTurnaround Time

The time between a process’s arrival into the system and its completion.

Two related parameters that can be studied include average turnaround time and maximum turnaround time.

The turnaround time includes the context switching times and execution times.

The turnaround time is inversely related to the system performance i.e. lower turnaround times imply better system performance.

Page 22: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Performance Measures Waiting Time

Waiting time is the sum of the periods spent waiting in the ready queue.

Mathematically, it is the difference between the turnaround time and execution time.

It inversely affects system performance. It has two related forms: average waiting

time and maximum waiting time. As a point of interest, the CPU scheduling

algorithm does not affect the execution time of a process but surely determines the waiting time.

Page 23: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Performance MeasuresThroughput

The average number of processes completed per unit time.

Higher throughput is generally considered as indicative of increased performance.

However, it should not be the sole performance criterion taken into account because throughput does not take into account loss of performance caused by starvation.

Page 24: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Performance MeasuresResponse Time

The time difference between submission of the process and the first I/O operation is termed response time.

It affects performance inversely. However, it is not considered to be

a reasonable measure and is rarely used.

Page 25: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Evaluation Techniques

When developing an operating system or the modules thereof, evaluation of its performance is needed before it is installed for real usage. Evaluation provides useful clues to which algorithms would best serve the cases of application.

Page 26: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Evaluation TechniquesThree Common Techniques

All evaluation techniques can be classified into the following three types:

Analytic method Implementation in real time

systems Simulation Method

Page 27: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Evaluation TechniquesAnalytic Method

In the analytic method, a mathematical formula is developed to represent a computing system. This method provides clear and intuitive evaluation of system performance, and is most useful to a specific algorithm. However, it is too simple to examine a complex and near-real system.

Page 28: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Evaluation TechniquesImplementation in real-time

systems

Another way is to implement an operating system in a real machine. This method produces a complete and accurate evaluation.

A disadvantage with it is its dramatic cost.

Also evaluation is dependent on the environment of machine in which evaluation is carried out.

Page 29: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Evaluation TechniquesSimulation Method

Simulation is a method that uses programming technique to develop a model of a real system.

Implementation of the model with prescribed jobs shows how the system works.

Furthermore, the model contains a number of algorithms, variables, and parameters.

Changing the above factors in simulation, one is able to know how the system performance would be affected and, therefore, to predict possible changes in performance of the real system.

This method has a balanced complexity and cost. It was viewed as the most potentially powerful and flexible of the evaluation techniques

Page 30: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Simulation Method The evaluation technique used in this

course

The simulation method entails development of a model of a real system which contains a number of algorithms, variables and parameters. Changing these factors in simulation enables one to know its affect on system performance. This method, thus, is best suited for our purpose of studying the operating systems design.

Page 31: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Lecture Summary What is a process Process Control Block Process states and process life cycle Performance Measures Evaluation Techniques Justification of simulation method as

the chosen technique for this course

Page 32: Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.

Preview of next lectureThe following topics shall be covered in the next lecture:

Introduction to CPU scheduling What is CPU scheduling Related Concepts of Starvation, Context

Switching and Preemption Scheduling Algorithms Parameters Involved Parameter-Performance Relationships Some Sample Results