1 / 32

Lecture 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. What is a process.

trudy
Download Presentation

Lecture 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. Lecture Highlights • What is a process • Process Control Block • Process states and process life cycle • Performance Measures • Evaluation Techniques

  3. 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.

  4. 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

  5. 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

  6. 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.

  7. PCB components Time of Arrival The system keeps track of the time a process enters the process queue for scheduling purposes.

  8. 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.

  9. 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.

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

  11. PCB components Program Counter The program counter value stores the address of the next instruction to be executed.

  12. PCB components Registers/Threads This PCB parameter saves the state of different registers used by that particular process.

  13. PCB components Needed Resources This PCB parameter indicates the quantities of system resources needed by that particular process.

  14. Process States The 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

  15. terminated new admitted interrupted exit ready running scheduler dispatch I/O or event completion I/O or event wait waiting Process Life Cycle

  16. CONTEXT SWITCH CONTEXT SWITCH Uploading/Downloading PCBs Process P0 operating system Process P1 Interrupt or system call executing . . . . . . . . . . . . . Save state into PCB0 . . . . . . . idle Reload state from PCB1 executing idle Interrupt or system call Save state into PCB1 . . . . . . . idle Reload state from PCB0 executing

  17. Performance Measures It 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.

  18. 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.

  19. 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.

  20. 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

  21. 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.

  22. 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.

  23. 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.

  24. 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.

  25. 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.

  26. Evaluation TechniquesThree Common Techniques All evaluation techniques can be classified into the following three types: • Analytic method • Implementation in real time systems • Simulation Method

  27. 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.

  28. 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.

  29. 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

  30. 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.

  31. 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

  32. Preview of next lecture The 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

More Related