Lecture 8

Lecture 8 PowerPoint PPT Presentation


  • 109 Views
  • Uploaded on
  • Presentation posted in: General

Lecture Highlights. This lecture provides the summary of learnt concepts from a perspective of parametric optimization of the operating system functions we learnt in the course of the semester.. What is an operating system. An operating system is simply a system application which manages user app

Download Presentation

Lecture 8

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


1. Lecture 8 Course Summary from the Perspective of Parametric Optimization of some of the Critical Operating System Functions

2. Lecture Highlights This lecture provides the summary of learnt concepts from a perspective of parametric optimization of the operating system functions we learnt in the course of the semester.

3. What is an operating system An operating system is simply a system application which manages user applications and their interaction with the system hardware. An operating is a program that acts as an intermediary between a user of a computer and the computer hardware. Operating system is a resource allocator. Much of the operating system theory concentrates on optimal use of computing resources.

4. Purpose and Goals of an operating system The purpose of an operating system is to provide an environment in which a user can execute programs The two goals: Make the computer system convenient to use Use the computer hardware in an efficient manner

5. Some critical functions of the OS The development of operating system over the past 40 years has evolved from batch systems to time shared operating systems. Spooling and multiprogramming were some important concepts in the development of the latter systems In these time-sharing operating systems: several jobs must be kept simultaneously in memory which needs some form of memory management The requisition of an on-line file management which reside on different discs thus needing disc management The need for concurrent execution mechanism requiring sophisticated CPU scheduling schemes The need to ensure orderly execution demanding job synchronization and deadlock handling

6. Processes and Process Control Block At the heart of the operating system is the process mix. A process is a program in execution. 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, ready, running, waiting or terminated state. Each process is represented in the operating system by its own process block. The following slide shows a typical PCB.

7. Processes and Process Control Block

8. Performance Measures Quantifying performance is essential to optimization. Some of the common parameters used to benchmark performance include: CPU Utilization Turnaround Time Waiting Time Throughput Response Time A brief description of each is include in the ensuing slides.

9. Performance Measures CPU 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

10. Performance Measures Turnaround 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.

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

12. Performance Measures Throughput 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.

13. Performance Measures Response 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.

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

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

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

17. Evaluation Techniques Analytic 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.

18. Evaluation Techniques Implementation 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.

19. Evaluation Techniques Simulation 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

20. Why We Chose The Simulation Method 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.

21. Purpose of this approach of study This study presents an alternative approach to the study of operating systems design by way of parametrically optimizing critical operating functions. This entails detailed discussion of the four tasks of: CPU scheduling, synchronization & deadlock handling, memory management and disc scheduling in terms of involved parameters using the simulation technique for analysis. The performance measures benchmark system performance and finally an integration of the four tasks into an optimal operating system using the right permutation of design parameters is discussed.

22. General outline of method of data collection Each of the proposed four tasks are discussed with emphasis on the involved parameters The parameters are discussed in terms of their interaction with the operating system function under study and their resultant effect on the system performance Simulation technique is used to evaluate system performance Evaluation of system performance against these parameters is conducted by analyzing a number of sample runs of the respective simulated modules.

23. CPU Scheduling An Introduction An operating system must select processes for execution in some fashion. CPU scheduling deals with the problem of deciding which of the processes in the ready queue is to be allocated the CPU. The selection process is carried out by an appropriate scheduling algorithm.

24. CPU Scheduling Scheduling Algorithms Some commonly used scheduling algorithms: First In First Out (FIFO) Shortest Job First (SJF) without preemption Preemptive SJF Priority based without preemption Preemptive Priority base Round robin Multilevel Feedback Queue

25. CPU Scheduling Multi-level Feedback Queue A multi-level feedback queue involves having multiple queues with different levels of priority and different scheduling algorithms for each. The figure on the following slide depicts a multi-level feedback queue.

26. CPU Scheduling Multi-level Feedback Queue

27. CPU Scheduling Multi-level Feedback Queue As depicted in the diagram, different kinds of processes are assigned to queues with different scheduling algorithms. The idea is to separate processes with different CPU-burst characteristics and their relative priorities. Thus, we see that system jobs are assigned to the highest priority queue with round robin scheduling. On the other hand, multimedia tasks are assigned to the lowest priority queue. Moreover, the queue uses FIFO scheduling which is well-suited for processes with short CPU-burst characteristics.

28. CPU Scheduling Multi-level Feedback Queue Processes are assigned to a queue depending on their importance. Each queue has a different scheduling algorithm that schedules processes for the queue. To prevent starvation, we utilize the concept of aging. Aging means that processes are upgraded to the next queue after they spend a predetermined amount of time in their original queue. This algorithm, though optimal, is most complicated and high context switching is involved.

29. CPU Scheduling ?-value and initial time estimates Many algorithms use execution time of a process to determine what job is processed next. Since it is impossible to know the execution time of a process before it begins execution, this value has to be estimated. ?, a first degree filter is used to estimate the execution time of a process.

30. CPU Scheduling Estimating execution time Estimated execution time is obtained using the following formula: zn = ?zn-1 + (1 - ?) tn-1 where, z is estimated execution time t is the actual time ? is the first degree filter and 0???1 The following example provides a more complete picture

31. CPU Scheduling Estimating execution time Here, ? = 0.5 z0 = 10 Then by formula, z1 = ? z0 + (1-?) t0 = (0.5)(10)+(1-0.5)(6) = 8 and similarly z2, z3….z5 are calculated.

32. CPU Scheduling Estimating execution time: Effect of ? The value of ? affects the estimation process. ? = 0 implies that zn does not depend on zn-1 and is equal to tn-1 ? = 1 implies that zn does not depend on tn-1 and is equal to zn-1 Consequently, it is more favorable to start off with a random value of ? and use an updating scheme as described in the next slide.

33. CPU Scheduling Estimating execution time: ?-update Steps of ?-updating scheme Start with random value of ? (here, 0.5) Obtain the sum of square difference I.e. f(?) Differentiate f(?) and find the new value of ? The following slide shows these steps for our example.

34. CPU Scheduling Estimating execution time: ?-update In the above example, at the time of estimating execution time of P3, we update ? as follows. The sum of square differences is given by, SSD = (2+4?)2 + (4?2+2?-2)2 =16?4 + 16?3 + 4?2 + 8? + 8 And, d/dx [SSD] = 0 gives us, 8?3 + 6?2 + ? + 1 = 0 (Equation 1) Solving Equation 1, we get ? = 0.7916. Now, z3 = ?z2 + (1-?) t2 Substituting values, we have z3 = (0.7916) 6 + (1-0.7916) 6 = 6

35. CPU Scheduling Parameters Involved Round Robin Queue Time Slot FIFO, Priority and SJF Queue Aging Thresholds Preemptive vs. Non-Preemptive Scheduling (2 switches in priority and SJF queues) Context Switching Time ?-values and initial execution time estimates

36. CPU Scheduling Effect of round robin time slot Small round robin quantum value lowers system performance with increased context switching time. Large quantum values result in FIFO behavior with effective CPU utilization, lower turnaround and waiting times as also the potential of starvation. Finding an optimal time slot value becomes imperative for maximum CPU utilization with lowered starvation problem.

37. CPU Scheduling Effect of aging thresholds A very large value of aging thresholds makes the waiting and turnaround times unacceptable. These are signs of processes nearing starvation. On the other hand, a very small value makes it equivalent to one round robin queue. Zhao, in his study, enumerates the aging parameters of 5, 10 and 25 for the SJF, priority-based and FIFO queues respectively as the optimal aging thresholds for the specified process mix (process size – 100KB to 3MB; estimated execution time – 5 to 35ms; priority – 1 to 4; memory size – 16MB; disc drive configuration – 8surfaces, 64sectors and 1000tracks)

38. CPU Scheduling Effect of preemption choice Preemption undoubtedly increases the number of context switches and increased number of context switches inversely affects the efficiency of the system. However, preemptive scheduling has been shown to decrease waiting and turnaround time measures in certain instances. In SJF scheduling, the advantage of choosing preemption over non-preemption is largely dependent on the CPU burst time predictions that in itself is a difficult proposition.

39. CPU Scheduling Effect of context switching time An increasing value of context switching time inversely affects the system performance in an almost linear fashion. The context switching time tends to effect system performance inversely since as the context switching time increases so does the average turnaround and average waiting time. The increase of the above pulls down the CPU utilization.

40. CPU Scheduling Effect of ?-values and initial execution time estimates There is no proven trend for this parameter. In one of the studies, for the given process mix, it is reported that the turnaround time obtained from predicted burst time is significantly lower than the one obtained by randomly generated burst time estimates. [Courtsey: Su’s project report]

41. CPU Scheduling Simulation Specifications The scheduler consists of 4 linear Q's: The first Q is FIFO, second Q is priority-based, third Q is SJF.and the fourth (highest Priority) is round robin.  Feed back occurs through aging, aging parameters differ, i.e., each Q has a different aging threshold (time) before a process can migrate to a higher priority Q. (should be a variable parameter for each Q).  Processes are assigned to one of the queues upon entry. A process can migrate between the various scheduling queues based on the aging parameter of the queue it was initially assigned.

42. CPU Scheduling Simulation Specifications: Independent Variables Some of the independent variables of this module are: Round robin time quantum Preemptive switches for SJF and priority-based queues Aging parameters for SJF, priority-based and FIFO queues Context switching time Initial time estimates and ? values

43. CPU Scheduling Simulation Specifications: Dependent Variables The dependent variables of the module are the performance measures: Average Turnaround Time Average Waiting Time CPU utilization CPU throughput

44. CPU Scheduling Simulation Specifications To optimize any of the independent variables, we keep every other parameter fixed and vary the studied parameter. Optimization of the round robin time slot and the effect of ? update scheme is attempted here to serve as a model. A complete walkthrough of a sample run for the CPU scheduling module is available at www.bridgeport.edu/~sobh/SampleRun1.doc

45. CPU Scheduling Simulation Results and Discussion The tabulated data and the corresponding charts on the following slides illustrate the effect of the round robin time slot over the various performance measures. While throughput is observed to be inversely proportional, the other three performance measures seem to be directly proportional In other words, with increasing the time slot the round robin queue moves towards the behavior of a FIFO queue with high average turnaround times and average waiting times. The throughput decreases but the percentage CPU utilization improves at a steady rate.

46. CPU Scheduling Simulation Results and Discussion

47. CPU Scheduling Simulation Results and Discussion

48. CPU Scheduling Simulation Results and Discussion Since the round robin is the highest priority queue in the multilevel feedback queue scheduler, it has the greatest influence over the scheduler performance. With CPU utilization of 80% and throughput of 0.024, time slot value of 4 time units comes out to be the optimal value in this simulation for the specified process mix.

49. CPU Scheduling Simulation Results and Discussion The next set of tabulated data illustrates the effect of ? updating on the system performance. The table compares the performance measures as the value of round robin time slot is varied with ? updated at regular intervals. As evident from the data, ? updating did not affect system performance in our case. The result is specific for our particular process mix.

50. CPU Scheduling Simulation Results and Discussion

51. CPU Scheduling Conclusions To summarize: It is the optimal value of the round robin time quantum along with smallest possible context switching time that tends to maximize performance in context of CPU scheduling in our simulation. ?-updating did not tend to affect performance.

52. Synchronization and Deadlock Handling An Introduction Concurrent access to shared data can result in data inconsistency. To ensure orderly execution of processes , the operating system provides mechanisms for job synchronization and communication. A deadlock state is a state of indefinite wait by one or more processes for an event that can be triggered only by one of the waiting processes. Operating system also provides mechanisms to ensure that jobs do not get stuck in a deadlock, forever waiting for each other.

53. Synchronization and Deadlock Handling Introduction to synchronization Synchronization problems arise because sections of code that constitute the critical sections overlap and do not run atomically. A critical section is part of a process that accesses shared resources. Important points to note about critical sections are: Critical sections of code must be run atomically Mutual exclusion must be ensured of more than one critical section

54. Synchronization and Deadlock Handling Introduction to synchronization The previously stated conditions are ensured by using the process of Sleep and Wakeup as follows: Pieces of code that block a process that attempts to run its critical section while the critical section of another process is being executed. The process is then unblocked when the other process’s critical section completes execution. The above can be implemented by using semaphores, monitors and message passing. (The table on the next slide shows a comparison between the three synchronization methods)

55. Synchronization and Deadlock Handling Comparison of synchronization methods

56. Synchronization and Deadlock Handling Introduction to deadlocks A deadlock state is a state of indefinite wait by one or more processes for an event that can be triggered only by one of the waiting processes. Such an event is commonly termed as a resource. The resource could be tangible such as an I/O resource or intangible e.g. shared data. The figure on the next slide gives a visual representation of a deadlock where process 1 is holding resource 2 and requesting resource 1 and process 2 is holding resource 1 and requesting resource 2.

57. Synchronization and Deadlock Handling A visual representation of a deadlock

58. Synchronization and Deadlock Handling Deadlock: Four necessary conditions The four necessary conditions for a deadlock to occur are: Mutual exclusion of resources Inability of a resource to be used by more than one process Hold-and-wait A process holds a resource while waiting for another one No pre-emption The system is incapable of grabbing a resource from a process Circular Wait

59. Synchronization and Deadlock Handling Four methods for handling deadlocks The four method for dealing with the deadlock problem are: Prevention Detection and Recovery Avoidance Ignoring the condition Ignoring deadlocks is by far the most widely used method.

60. Synchronization and Deadlock Handling Deadlock Prevention Deadlock prevention is a set of methods for ensuring that atleast one of the necessary conditions cannot hold. Mutual Exclusion – this cannot be stopped since it is the nature of the resource Hold and Wait – this can be stopped by never assigning a resource to a process unless all the other needed resources are available. However, it suffers from possible starvation of processes. Moreover, resource utilization may be low, since many of the resources may be allocated but unused for a long period.

61. Synchronization and Deadlock Handling Deadlock Prevention No preemption – If a process that is holding some resources requests another resource that cannot be immediately allocated to it, then all resources currently being held are preempted to stop this condition. As evident, it also suffers from potential starvation. Circular Wait – One way to ensure that the circular-wait condition never holds is to impose a total ordering of all resource types, and to require that each process requests resources in an increasing order of enumeration. This method, however, turns out to be expensive in terms of time complexity.

62. Synchronization and Deadlock Handling Deadlock Detection and Recovery In this environment, the system must provide: An algorithm that examines the state of the system to determine whether a deadlock has occurred An algorithm to recover from the deadlock However, it is important to realize that detection and recovery scheme requires overhead that includes not only the run-time costs of maintaining the necessary information and executing the detection algorithm, but also the potential losses inherent in recovering from deadlock.

63. Synchronization and Deadlock Handling Deadlock Detection and Recovery A deadlock detection and recovery algorithm involves the following steps: Reduce P-R graph to wait-for graph Find cycles in the graph Determine non-redundant cycles Determine minimum number of preemptions

64. Synchronization and Deadlock Handling Deadlock Avoidance A deadlock avoidance algorithm dynamically examines the resource allocation state to ensure that there can never be a circular-wait condition. The resource allocation state is defined by the number of available and allocated resources, and the maximum demands of the processes.

65. Synchronization and Deadlock Handling Deadlock Avoidance: Safe/Unsafe states A state is safe is the system can allocate resources to each process in some order and still avoid a deadlock. More formally, a system is in a safe state only if there exists a safe sequence. If no safe sequence exists, then the state is said to be unsafe.

66. Synchronization and Deadlock Handling Deadlock Avoidance: An Example

67. Synchronization and Deadlock Handling Deadlock Avoidance: An Example Now we need to decide if it is a safe state. At this time, it is a safe state since the safe sequence <P1, P3, P4, P0, P5> exists. Suppose now that P4 requests an instance of the resource. We pretend that this request has been fulfilled and arrive at the new state shown in the table on next slide.

68. Synchronization and Deadlock Handling Deadlock Avoidance: An Example Now we need to determine if this new system state is safe. Since the safe sequence <P3, P1, P4, P0, P2> exists, thus, the state is safe and the request of P4 can be granted.

69. Synchronization and Deadlock Handling Deadlock Avoidance: An Example However, if P2 requests an instance of the resource and we pretend that the request has been granted, then we land with the following configuration:

70. Synchronization and Deadlock Handling Deadlock Avoidance: An Example This state, however is an unsafe state since there is no sequence in which the instances of the resource may be granted such that the needs of all resources are met. Hence, the request of P2 is not granted. In a real system: There are multiple resources, each with one of more instances. Thus, implementing this algorithm in a real system would entail maintaining the table of resources for each resource. Likewise, there could be multiple requests at a given time instance for the resources present, and a deadlock avoidance algorithm would have to determine whether each of the requests would put the state in a safe or unsafe condition. It is evident that this algorithm proves to be an expensive one.

71. Synchronization and Deadlock Handling Deadlock Avoidance: Parameters Involved The parameters worthy of study in this module are: Total number of processes Total number of available resources Maximum number of resources required by the processes

72. Synchronization and Deadlock Handling Deadlock Avoidance: Effect of Involved Parameters Effect of total number of processes An increase in the number of processes will increase the number of requests for resources. Effect of total number of available resources More the number of available resources, more requests can be granted since for the same requirement there are more resources available. Effect of maximum number of resources required by the processes This parameter is directly linked to the number of requests and thus, determines the demand for the resources required. More the resources required, there is more probability of declined requests.

73. Synchronization and Deadlock Handling Simulation Specifications The deadlock avoidance module uses one resource type. Input: Table of resources, current usage and maximum usage Resource request by one of the processes Output: Granted or rejected request depending on whether the same generates a safe or unsafe state in terms of deadlock.

74. Synchronization and Deadlock Handling Simulation Specifications: Independent Variables The independent variables of this module are: The total number of processes The total number of resources The maximum resource requisitions of the process

75. Synchronization and Deadlock Handling Simulation Specifications: Dependent Variables Dependent variable of this module is the rejection rate/denial rate. It is the percentage of rejected or denied requests over the total number of requests. A higher rejection rate is a sign of poor system performance

76. Synchronization and Deadlock Handling Simulation Specifications The effect of each independent variable is studied on the dependent variable of rejection/denial rate separately while keeping the others fixed. Rejection/denial rate over time is also studied. Sample runs of the module with brief parameter-wise analysis are available at www.bridgeport.edu/~sobh/SampleRun2.doc

77. Synchronization and Deadlock Handling Simulation Results and Discussion Rejection Rate versus Total Number of Processes Fixed Parameters for this part: Total Number of Resources: 6 Maximum Resources per process: Process: 1 2 3 4 5 6 7 Resources: 5 4 5 4 5 4 5 The statistics shows a trend of increasing rejection rate as the number of processes increases with everything else kept constant. The number of requests made also increases and influences the same too. The tabulated data and corresponding chart is included on the next slide.

78. Synchronization and Deadlock Handling Simulation Results and Discussion

79. Synchronization and Deadlock Handling Simulation Results and Discussion Rejection Rate versus Total Number of Resources Fixed Parameters for this part: Total Number of Processes: 4 Maximum Resources per process: Process: 1 2 3 4 Resources: 5 4 5 4 The statistics clearly indicate that as the number of available resources increases, more requests are successfully granted. The increase in the number of granted requests make the rejection rate move down steadily. In other words, an increase in the total number of resources tends to affect the rejection rate in a linear fashion. The tabulated data and corresponding chart is included on the next slide.

80. Synchronization and Deadlock Handling Simulation Results and Discussion

81. Synchronization and Deadlock Handling Simulation Results and Discussion Rejection Rate versus Maximum Number of Resources Per Process Fixed Parameters for this part: Total Number of Processes: 4 Total Number of Resources: 6 The statistics indicate that as the number of maximum resources needed for a process decreases so does the rejection rate. The total number of requests made is directly proportional to the maximum resources need for the process. A decrease in the latter decreases the former and consequently decreases the rejection rate in a linear manner. The tabulated data and corresponding chart is included on the next slide.

82. Synchronization and Deadlock Handling Simulation Results and Discussion

83. Synchronization and Deadlock Handling Simulation Results and Discussion Rejection Rate over Time Fixed Parameters for this part: Total Number of Processes: 5 Total Number of Resources: 10 Maximum Resources per process: Process: 1 2 3 4 5 Resources: 7 5 9 2 4

84. Synchronization and Deadlock Handling Simulation Results and Discussion

85. Synchronization and Deadlock Handling Conclusions To summarize, The rejection rate is controlled by the dynamic mix of the number of processes, the number of available requests as well as the maximum resource requirement per process. In addition, another crucial determining factor is the order in which the requests are made. More available resources and fewer resource requests improve performance in a linear manner.

86. Synchronization and Deadlock Handling Conclusions However, if the number of maximum resource requirement per process exceeds the number of available resources, deadlock is inevitable. On the other hand, if the number of resources available is at least equal to the sum of the maximum resource requirement per process, the system can boast of a null rejection rate. The rejection rate over time curve closely resembles a normal curve.

87. Memory Management An Introduction Memory management primarily deals with space multiplexing. All the processes need to be scheduled in such a way that all the users get the illusion that their processes reside on the RAM. The job of the memory manager: keep track of which parts of memory are in use and which parts are not in use to allocate memory to processes when they need it and deallocate it when they are done to manage swapping between main memory and disk when main memory is not big enough to hold all the processes.

88. Memory Management Three Related Problems Three problems related to memory management are: The synchronization problem The redundancy problem The fragmentation problem

89. Memory Management Synchronization Problem Spooling enables the transfer of process while another process is in execution. It aims at preventing the CPU from being idle, thus, managing CPU utilization more efficiently. The processes that are being transferred to the main memory can be of different sizes. When trying to transfer a very big process, it is possible that the transfer time exceeds the combined execution time of the processes in the RAM. This results in the CPU being idle which was the problem for which spooling was invented. The above problem is termed as the synchronization problem. The reason behind it is that the variance in process sizes does not guarantee synchronization.

90. Memory Management Redundancy Problem Usually the combined size of all processes is much bigger than the RAM size and for this reason processes are swapped in and out continuously. One issue regarding this is: What is the use of transferring the entire process when only part of the code is executed in a given time slot? This problem is termed as the redundancy problem.

91. Memory Management Fragmentation Problem Fragmentation is encountered when the free memory space is broken into little pieces as processes are loaded and removed from memory. Fragmentation is of two types: External fragmentation Internal fragmentation

92. Memory Management Fragmentation – Internal Fragmentation Consider a hole of 18,464 bytes as shown in the figure. Suppose that the next process requests 18,462 bytes. If we allocate exactly the requested block, we are left with a hole of 2 bytes. The overhead to keep track of this hole will be substantially larger than the hole itself. The general approach is to allocate very small holes as part of the larger request.

93. Memory Management Fragmentation – Internal Fragmentation As illustrated in the previous slide, the allocated memory may be slightly larger then the requested memory. The difference between these two numbers is internal fragmentation – memory that is internal to a partition, but is not being used. In other words, unused memory within allocated memory is called internal fragmentation.

94. Memory Management Fragmentation – Internal Fragmentation Consider a hole of 18,464 bytes as shown in the figure. Suppose that the next process requests 18,462 bytes. If we allocate exactly the requested block, we are left with a hole of 2 bytes. The overhead to keep track of this hole will be substantially larger than the hole itself. The general approach is to allocate very small holes as part of the larger request.

95. Memory Management Fragmentation – External Fragmentation External fragmentation exists when enough total memory space exists to satisfy a request, but it is not contiguous; storage is fragmented into a large number of small holes. Referring to the figure of the scheduling example on the next slide, two such cases can be observed.

96. Memory Management Fragmentation – External Fragmentation

97. Memory Management Fragmentation – External Fragmentation From the figure on the last slide, we see In part (a), there is a total external fragmentation of 260K, a space that is too small to satisfy the requests of either of the two remaining processes, P4 and P5. In part (c), however, there is a total external fragmentation of 560K. This space would be large enough to run process P5, except that this free memory is not contiguous. It is fragmented into two pieces, neither one of which is large enough, by itself, to satisfy the memory request of process P5.

98. Memory Management Fragmentation – External Fragmentation This fragmentation problem can be severe. In the worst case, there could be a block of free (wasted) memory between every two processes. If all this memory were in one big free block, a few more processes could be run. Depending on the total amount of memory storage and the average process size, external fragmentation may be either a minor or major problem.

99. Memory Management Compaction One solution to the problem of external fragmentation is compaction. The goal is to shuffle the memory contents to place all free memory together in one large block. The simplest compaction algorithm is to move all processes toward one end of the memory; all holes in the other direction, producing one large hole of available memory. This scheme can be quite expensive. The figure on the following slide shows different ways to compact memory. Selecting an optimal compaction strategy is quite difficult.

100. Memory Management Compaction

101. Memory Management Compaction As mentioned earlier, compaction is an expensive scheme. The following example gives a more concrete idea of the same. Given the following: RAM size = 128 MB Access speed of 1byte of RAM = 10ns Each byte will need to be accessed twice during compaction. Thus, Compaction time = 2 x 10 x 10-9 x 128 x 106 = 2560 x 10-3 s = 2560ms ? 3s Supposing we are using RR scheduling with time quantum of 2ms, the compaction time is equivalent to 1280 time slots.

102. Memory Management Compaction Compaction is usually defined by the following two thresholds: Memory hole size threshold: If the sizes of all the holes are at most a predefined hole size, then the main memory undergoes compaction. This predefined hole size is termed as the hole size threshold. e.g. If we have two holes of size ‘x’ and size ‘y’ respectively and the hole threshold is 4KB, then compaction is done provided x<= 4KB and y<= 4KB Total hole percentage: The total hole percentage refers to the percentage of total hole size over memory size. Only if it exceeds the designated threshold is compaction undertaken. e.g. taking the two holes with size ‘x’ and size ‘y’ respectively, total hole percentage threshold equal to 6%, then for a RAM size of 32MB, compaction is done only if (x+y) >= 6% of 32MB.

103. Memory Management Paging Another possible solution to the external fragmentation problem is to permit the physical address space of a process to be noncontiguous, thus allowing a process to be allocated physical memory wherever the latter is available. One way of implementing this solution is through the use of a paging scheme. Paging is discussed in details a little later.

104. Memory Management Memory Placement Algorithms A fitting algorithm determines the selection of a free hole from the set of available holes. First-fit, best-fit, and worst-fit are the most common strategies used to select a free hole. First-fit: Allocate the first hole that is big enough. Searching can start either at the beginning of the set of holes or where the previous first-fit search is ended. Searching stops as soon as a large enough free hole is found. Best-fit: Allocate the smallest hole that is big enough. The entire list needs to be searched, unless the list is kept ordered by size. This strategy produces the smallest leftover hole.

105. Memory Management Memory Placement Algorithms Worst-fit: Allocate the largest hole. Again, the entire list has to be searched, unless it is sorted by size. This strategy produces the largest leftover hole, which may be more useful than the smaller leftover hole from a best-fit approach. If memory is lost due to internal fragmentation, the choice is between first fit and best fit. A worst fit strategy truly makes internal fragmentation worse. If memory is lost due to external fragmentation, careful consideration should be given to a worst-fit strategy.

106. Memory Management Continuous Memory Allocation Scheme The continuous memory allocation scheme entails loading of processes into memory in a sequential order. When a process is removed from main memory, new processes are loaded if there is a hole big enough to hold it. This algorithm is easy to implement, however, it suffers from the drawback of external fragmentation. Compaction, consequently, becomes an inevitable part of the scheme.

107. Memory Management Parameters Involved Memory size RAM access time Disc access time Compaction Algorithms Compaction thresholds Memory hole-size threshold Total hole percentage Memory placement algorithms Round robin time slot

108. Memory Management Effect of Involved Parameters Effect of Memory Size: As anticipated, greater the amount of memory available, the higher would be the system performance. Effect of Compaction Algorithms: Choosing an optimal compaction algorithm is critical in minimizing compaction cost. However, selecting an optimal compaction strategy is quite difficult.

109. Memory Management Effect of Involved Parameters Effect of RAM and disc access times: RAM access time and disc access time together define the transfer rate in a system. Higher transfer rate means less time it takes to move processes from main memory to secondary memory and vice-versa thus increasing the efficiency of the operating system. Since compaction involves accessing the entire RAM twice, a lower RAM access time will translate to lower compaction times.

110. Memory Management Effect of Involved Parameters Effect of Compaction Thresholds: Optimal values of hole size threshold largely depend on the size of the processes since it is these processes that have to be fit in the holes. Thresholds that lead to frequent compaction can bring down performance at an accelerating rate since compaction is quite expensive in terms of time. Threshold values also play a key role in determining state of fragmentation present. Its effect on system performance is not very straightforward and has seldom been the focus of studies in this field.

111. Memory Management Effect of Involved Parameters Effect of Memory Placement Algorithms: Simulations have shown that both first-fit and best-fit are better than worst-fit in terms of decreasing both time and storage utilization. Neither first-fit nor best fit is clearly best in terms of storage utilization, but first-fit is generally faster.

112. Memory Management Effect of Involved Parameters Effect of Round Robin Time Slot: As depicted in the figures on the next slide, best choice for the value of time slot would be corresponding to the transfer time for a single process. For example, if most of the processes required 2ms to be transferred, then a time slot of 2ms would be ideal. Hence, while one process completes execution, another can be transferred. However, the transfer times for the processes in consideration are seldom a normal or uniform distribution. The reason for the non-uniform distribution is that there are many different types of processes in a system. The variance as depicted in the figure is too much in a real system and makes the choice of time slot a difficult proposition to decide upon.

113. Memory Management Effect of Involved Parameters

114. Memory Management Simulation Specifications The attempted simulation implements a memory manager system. The implemented system uses a continuous memory allocation scheme. This simulation uses no concept of paging whatsoever. Round robin mechanism is the scheme for process scheduling. A walkthrough of a sample run for this module is available at www.bridgeport.edu/~sobh/SampleRun3.doc

115. Memory Management Simulation Specifications: Independent Variables Fixed parameters: Memory Size (32 MB) Disc access time (1ms (estimate for latency and seek times) + (job size (in bytes)/500000) ms) Compaction threshold (6% and hole size = 50KB) RAM Access Time (14ns) Variable parameters: Fitting algorithm (a variable parameter – First Fit, Best Fit, Worst Fit) Round Robin Time Slot (a variable parameter, multiple of 1ms)

116. Memory Management Simulation Specifications: Independent Variables In addition to the above enumerated parameters, The process sizes range from 20KB to 2MB (multiple of 10KB) The process execution times vary from between 2 ms to 10 ms (multiple of 1ms). The disc size is taken as 500MB and is half filled with jobs at the beginning of the simulation.

117. Memory Management Simulation Specifications: Dependent Variables The dependent variables of the module are the performance measures: Average Turnaround Time Average Waiting Time CPU utilization CPU throughput Percentage of compaction time against total time (to quantify compaction costs)

118. Memory Management Simulation Results and Discussion Round robin time quantum The trends of increasing throughput and increasing turnaround and waiting times are in keeping with round robin scheduling moving towards FIFO behavior with increased time quantum. However, we observe that the CPU utilization is declining with increase in time slot values. This can be attributed to the expense of compaction. Analyzing the fragmentation percentage, it looks like a time slot value of 2 time units is particularly favorable to the same. The corresponding table and chart is included on the ensuing slides.

119. Memory Management Simulation Results and Discussion

120. Memory Management Simulation Results and Discussion

121. Memory Management Simulation Results and Discussion Comparing Memory Placement Algorithms For our particular process mix, best-fit and worst-fit memory placement algorithms gave identical results. None of the memory placement algorithms emerged as a clear winner. However, best-fit and worst-fit algorithms seemed to give more stable fragmentation percentage in the simulations. The aspect of first-fit being faster did not surface in the results due to the nature of the implementation. In the implementation, the worst-fit and best-fit algorithms scan the hole list in one simulated time unit itself. In reality, however, scanning entire hole list by best-fit and worst-fit would make them slower that first-fit, which needs to scan the hole list only as far as it takes to find the first hole that is large enough.

122. Memory Management Simulation Results and Discussion

123. Memory Management Simulation Results and Discussion

124. Memory Management Simulation Results and Discussion Fragmentation percentage in a given time window over the entire length of the simulation was also studied. The entire simulation was divided into twenty equal time windows and the fragmentation percentage computed for each of the time windows. The trend was studied for four different values of round robin time slot. Since our total hole size percentage threshold was specified as 6%, time frames with fragmentation percentage values higher than that were candidates for compaction [see figure on next slide].

125. Memory Management Simulation Results and Discussion

126. Memory Management Simulation Results and Discussion However, compaction was undertaken in any of the above candidate frames only if the hole size threshold specification was also met. Looking at figure on the last slide, we can say that while compaction (if done) for time slot values of 3 and 4 was done in time frames 6 and 7, that for time slot value of 5 was undertaken in the latter half of the simulation.

127. Memory Management Conclusions To summarize, Two time units emerged as the optimal time quantum value but none of the memory placement algorithms could be termed as optimal. Studying the fragmentation percentage over time gave us the probable time windows where compaction was undertaken.

128. Memory Management Introduction to Paging Scheme Paging entails division of physical memory into many small equal-sized frames. Logical memory is also broken into blocks of the same size called pages. When a process is to be executed, some of its pages are loaded into any available memory frames. In a paging scheme, external fragmentation can be totally eliminated. Paging requires more than one memory access to get to the data. In the paging scheme, there is the overhead of storing and updating page tables.

129. Memory Management Paging Hardware & Page Tables In paging: Every address generated by the CPU is divided into two parts: A page number (p) A page offset (d) The page number is used as an index into a page table. The page table contains the base address of each page in physical memory. This base address is combined with the page offset to define the physical memory address.

130. Memory Management Paging Example 64 MB i.e. 226 byte memory size can be represented by 26 bits. Similarly 2 KB page needs 211 bits Thus, for the page table, we need 15 bits to represent ‘p’ and 15 bits to represent ‘f ’ Since we have 215 pages (64MB/2KB) we’ll have 215 entries in the page table Thus, Size of page table = 215 x 30 bits = 212 x 30 bytes ? 123KB

131. Memory Management Paging Example In the previous example, if the page size were 1KB, then a 16 bit page number and 10 bit would be needed to address the 64MB RAM. In this case, Size of page table = 216 x 32 bits = 256KB Consequently, it can be said that a smaller page size results in larger sized page tables and the page table size becomes an overhead itself.

132. Memory Management Paging and Fragmentation In a paging scheme, we have no external fragmentation. However, we may have internal fragmentation as illustrated below: If page size is 2KB and we have a process with size 72,766 bytes, then the process will need 35pages plus 1086bytes. It would be allocated 36 pages with internal fragmentation of 2048 – 1086 = 962 bytes In worst case, a process would need n pages plus 1byte. It would be allocated n + 1 pages, resulting in an internal fragmentation of almost an entire frame. If process size is independent of page size, we expect internal fragmentation to average one-half page per process

133. Memory Management Paging and Fragmentation A large page size causes a lot of internal fragmentation. On the other hand, a small page size requires a large amount of memory space to be allocated for page tables. One simple solution to the problem of large size page tables is to divide the page table into smaller pieces. One way is to use a two-level paging scheme, in which the page table itself is also paged. However, multilevel paging comes with its own cost – an added memory access for each added level of paging.

134. Memory Management Anticipation and Page Replacement Algorithms Anticipation and page replacement deals with algorithms to determine the logic behind replacing pages in main memory. A good page replacement algorithm has a low page-fault rate. (accessing a page not brought into main memory causes a page-fault)

135. Memory Management Anticipation and Page Replacement Algorithms Some common page replacement algorithms are: Time Stamp Algorithms FIFO A FIFO replacement algorithm associates with each page the time when that page was brought into memory. When a page must be replaced, the oldest is chosen. LRU Least Recently Used (LRU) algorithm associates with each page the time of that page’s last use. When a page must be replaced, LRU chooses the page that has not been used for the longest time.

136. Memory Management Anticipation and Page Replacement Algorithms Count Based Algorithms LFU The least frequently used (LFU) algorithm requires that the page with the smallest count be replaced. The reason for this selection is that an actively used page should have a large reference count. MFU The most frequently used (MFU) algorithm requires that the page with the largest count be replaced. The reason for this selection is that the page with the smallest count was probably just brought in and has yet to be used.

137. Memory Management Paging versus Continuous Allocation Scheme

138. Memory Management Paging Scheme: Parameters Involved The new parameters involved in this memory management scheme are: Page Size Page Replacement Algorithm

139. Memory Management Paging Scheme: Effect of Parameters Involved Effect of Page Size A large page size causes a lot of internal fragmentation. This means that, with a large page size, the paging scheme tends to degenerate to a continuous memory allocation scheme. On the other hand, a small page size requires large amounts of memory space to be allocated for page tables. Finding an optimal page size for a system is not easy as it is very subjective dependent on the process mix and the pattern of access.

140. Memory Management Paging Scheme: Effect of Parameters Involved Effect of Page Replacement Algorithms Least-recently used, first-in-first-out, least-frequently used and random replacement are four of the more common schemes in use. The LRU is often used as a page-replacement algorithm and is considered to be quite good. However, an LRU page-replacement algorithm may require substantial hardware assistance.

141. Memory Management Paging Scheme: Implementation Specifics Though paging was not attempted as part of this study, the implementation specifics of Zhao’s study are included here to illustrate one sample implementation. Zhao simulated an operating system with a multilevel feedback queue scheduler, demand paging scheme for memory management and a disc scheduler. A set of generic processes was created by a random generator.

142. Memory Management Paging Scheme: Implementation Specifics Ranges were set for various PCB parameters as follows: Process size: 100KB to 3MB Estimated execution time: 5 to 35ms Priority: 1 to 4 Other specifications included: A single level paging scheme was implemented. Memory size – 16MB Disc driver configuration: 8 surfaces, 64 sectors and 1000 tracks

143. Memory Management Paging Scheme: Implementation Specifics Independent variables: Four page replacement algorithms: LRU, LFU, FIFO, random replacement Page size Dependent variables: Average turnaround time Replacement percentage The replacement ratio percentage quantifies page replacements. It is the ratio of the number of page replacements to the total number of page accesses.

144. Memory Management Paging Scheme: Implementation Results The following table shows tabulated data for replacement ratios against page replacement algorithms.

145. Memory Management Paging Scheme: Implementation Results After having found the optimal values of all studied parameters except page size in his work, Zhao used those optimal values for 1000 simulations each for a page size of 4KB and 8KB. The latter emerged as a better choice. In his work, Zhao concludes that 8KB page size and the LRU replacement algorithms constitute the parametric optimization in context to paging parameters for the specified process mix.

146. Introduction t Disc Scheduling An Introduction Disk systems are the major secondary-storage I/O device on most computers. One of the functions of the memory manager is to manage swapping between main memory and disk when main memory is not big enough to hold all the processes. The disk, i.e. the secondary storage device, at the same time needs effective management in terms of disc structure and capacity, the disc writing mechanism and the scheduling algorithm choice.

147. Disc Scheduling An Introduction Requests for disk I/O are generated both by the file system and by virtual-memory systems. Since most jobs depend heavily on the disc for program loading and input and output files, it is important that disk service be as fast as possible. The operating system can improve on the average disk service time by scheduling the requests for disc access.

148. Disc Scheduling Disc Structure To access a sector – surface, track and sector need to be specified i.e. information on the disc is referenced by a multipart address, which includes the drive number, the surface, the track, and the sector. All the tracks on one drive that can be accessed without the heads being moved (the equivalent tracks on the different surfaces) constitute a cylinder.

149. Disc Scheduling Details of disc speed The disk movement is composed of three parts. The three distinct physical operations, each with its own cost, are: seek time rotational delay/latency time transfer time.

150. Disc Scheduling Disc Speed: Seek Time To access a block on the disk the system must first move the head to the appropriate track or cylinder. This head movement is called a seek, and the time to complete it is seek time. The amount of time spent seeking during a disc access depends on how far the arm has to move (more explanation follows on the next slide).

151. Disc Scheduling Disc Speed: Seek Time If we are accessing a file sequentially and the file is packed into several consecutive cylinders, seeking needs to be done only after all the tracks on a cylinder have been processed, and then the read/write head needs to move the width of only one track (minimum seek time/ track-to-track seek time). At the other extreme, if we are alternately accessing sectors from two files that are stored at opposite extremes on a disk, seeking is very expensive (could be full stroke/ max seek time). Consequently, if we were to write to an empty disc, it is more efficient to do the writing cylinder wise as it reduces seek time.

152. Disc Scheduling Disc Speed: Seek Time Seeking is likely to be more costly in a multi-user environment, where several processes are contending for use of the disk at one time, than in a single-user environment, where disk usage is dedicated to one process. This is so because in a multi-user environment the different users might be seeking files at different locations. Since it is usually impossible to know exactly how many tracks will be traversed in a seek, we usually try to determine the average seek time required for a particular operation. If the starting and ending positions for each access is random, it turns out that the average seek traverses one-third of the total number of cylinders that the read/write head ranges over.

153. Disc Scheduling Disc Speed: Latency Time / Rotational Delay Once the head is at the right track, it must wait until the desired block rotates under the read-write head. This delay is the latency time. Hard discs usually rotate at about 5000 rpm, which is one revolution per 12ms. On average, the rotational delay is half a revolution, or about 6ms. As in the case of seeking, these averages apply only when the read/write head moves from some random place on the disc surface to the target track. In many circumstances, rotational delay can be much less than the average.

154. Disc Scheduling Disc Speed: Transfer Time Finally, the actual transfer of the data between the disc and main memory can take place. This last part is transfer time.

155. Disc Scheduling Summary of disc speed The total time to service a disk request is the sum of the seek time, latency time, and transfer time. For most disks the seek time dominates, so reducing the mean seek time can improve the system performance substantially. Thus, the primary concern of disc scheduling algorithms is to minimize seek and latency times.

156. Disc Scheduling Disc Scheduling Algorithms Some of the common disc scheduling algorithms include: FCFS SSTF SCAN C-SCAN LOOK C-LOOK

157. Disc Scheduling Parameters Involved Disc access time (seek time, latency time and transfer time) Disc configuration Disc scheduling algorithm Disc writing mechanism (where to rewrite processes after processing them in RAM) Memory Size RAM Access Time Compaction thresholds – Memory hole-size threshold and total hole percentage Memory placement algorithms Round robin time slot

158. Disc Scheduling Effect of Disc Access Time The lower is the value of this parameter, the better is the system performance. As discussed earlier, seek time, latency time and transfer time together give the disc access time. Since seek is the most expensive of the three operations, lowering seek time is crucial to system efficiency.

159. Disc Scheduling Effect of Disc Configuration Disk configuration relates to the structural organization of the disc into tracks and sectors. Disc surfaces and tracks are determined by hardware specifications. However, some operating systems allow the user to choose the sector size that influences the number of sectors per track. It is an entire sector that is read or written when transfer occurs. The number of tracks equals the number of cylinders. Reading and writing on one cylinder reduces the seek time considerably. This property determines efficiency of many computing algorithms and determines inter-record and intra-record fragmentation in terms of database operations It also affects system performance in operations like disc defragmentation ( a rewriting mechanism).

160. Disc Scheduling Effect of Disc Scheduling Algorithm This is the parameter that primarily determines the possible minimization of seek and latency times. While FCFS algorithm is easy to program and is intrinsically fair, however, it may not provide the best service. SSTF scheduling substantially improves the average service time but suffers from the inherent problem of starvation of certain processes in case of continuing/dynamic flow of requests.

161. Disc Scheduling Effect of Disc Scheduling Algorithm The SCAN, C-SCAN, LOOK and C-LOOK belong to the more efficient genre of disk scheduling algorithms. These are however, complicated in their respective implementations and are more appropriate for systems that place a heavy load on the disk. With any scheduling algorithm, however, performance depends heavily on the number and types of requests. In particular, if the queue seldom has more than one outstanding request, then all scheduling algorithms are effectively equivalent. In this case, FCFS scheduling is also a reasonable algorithm.

162. Disc Scheduling Effect of Disk Writing Mechanism In terms of disk writing mechanism, there is a choice between writing back to where the process was initially read from and writing back to the closest cylinder to the disk head where there is an empty sector. While the former is straightforward to implement in no way does it attempt an optimization of seek time. The latter choice, however, results in increased overhead in terms of updating the location of the process every time it is written back to the disk.

163. Disc Scheduling Simulation Specifications The attempted simulation implements a memory manager system that includes disc scheduling. The implemented system uses a continuous memory allocation scheme. Round robin mechanism is the scheme for process scheduling. A walkthrough of a sample run for this module is available at www.bridgeport.edu/~sobh/SampleRun4.doc

164. Disc Scheduling Simulation Specifications: Independent Variables Fixed parameters: Disc configuration (8 surfaces and 300tracks/surface) Disc writing mechanism (processes are written at the same place they are read from) Memory Size (32 MB) Compaction threshold (6% and hole size = 50KB) RAM Access Time (14ns) Variable parameters: Disc access time (seek + latency + (job size (in bytes)/500000) ms where seek time and latency time are variable parameters) Disc scheduling algorithm (FIFO or SSTF) Fitting algorithm (First Fit or Best Fit) Round Robin Time Slot (multiple of 1ms)

165. Disc Scheduling Simulation Specifications: Independent Variables In addition to the above enumerated parameters, The process sizes range from 20KB to 2MB (multiple of 10KB) The process execution times vary from between 2 ms to 10 ms (multiple of 1ms). The disc size is taken as 600MB and is half filled with jobs at the beginning of the simulation. The jobs are written cylinder-wise on the disc.

166. Disc Scheduling Simulation Specifications: Dependent Variables The dependent variables of the module are the performance measures: Average Turnaround Time Average Waiting Time CPU utilization CPU throughput Percentage seek time Percentage latency time The last two parameters are calculated as a percentage of total time and are added to quantify the effect of seek time and latency time on system performance.

167. Disc Scheduling Simulation Results and Discussion Algorithm Combinations The fixed parameters, collected data and corresponding graph is included in the next set of slides. SSTF surely outperforms FIFO in all respects. However, what is interesting to note is that while First Fit algorithm seems to be markedly more efficient in terms of throughput, average turnaround and average waiting time; the best- fit algorithm tends to outshine percentage CPU utilization and percentage seek time. The higher CPU utilization percentage can be explained as a function of lowered seek time.

168. Disc Scheduling Sample tabulated data from simulation

169. Disc Scheduling Corresponding graph for table on previous slide

170. Disc Scheduling Simulation Results and Discussion Average Seek Time The fixed parameters, collected data and corresponding graph is included in the next set of slides. Measures of seek time include track-to-track, full stroke and average seek time. It is the last that has been used. It is the time (in ms) that the head takes to cover half of the total tracks. It tends to vary between 8 to 10ms. State of the art machines boast of a seek time of 4ms [7]. This explains the average seek time range under scrutiny.

171. Disc Scheduling Simulation Results and Discussion Average Seek Time Higher average seek times relate to higher seek time % which pulls down the % CPU utilization. As a special note, the total latency time is unchanged (e.g. in all cases it was 2748ms in case of SSTF-First Fit). It is the increasing seek time that pulls down the % latency time. It should not be misunderstood that higher average seek times improve latency times. The variable parameter tends to show little if any effect on the other performance measures.

172. Disc Scheduling Sample tabulated data from simulation

173. Disc Scheduling Corresponding graph for table on previous slide

174. Disc Scheduling Sample tabulated data from simulation

175. Disc Scheduling Corresponding graph for table on previous slide

176. Disc Scheduling Simulation Results and Discussion Average Latency Time The fixed parameters, collected data and corresponding graph is included in the next set of slides. Latency time is objectively measured as average latency time which is time taken for half rotation of the disc platters. Measured in ms, average latency time is derived by the spindle speed. Typical average latency times vary from 2ms to 8ms [7]. For this reason, the average latency time was varied as depicted.

177. Disc Scheduling Simulation Results and Discussion Average Latency Time Similar to the effect of average seek time discussed earlier, the average latency time tends to affect CPU utilization. Higher average latency times relate to higher latency time percentage that pulls down the % CPU utilization. As a special note, the total seek time is unchanged (e.g. in all cases it was 7047ms in case of FIFO-First Fit and 1094 in case of SSTF-First Fit). It is the increasing latency time that pulls down the % seek time. It is important to understand this fact for the associated risk of misinterpreting that higher latency rates improve seek times.  The variable parameter tends to show little if any effect on the other performance measures.

178. Disc Scheduling Sample tabulated data from simulation

179. Disc Scheduling Corresponding graph for table on previous slide

180. Disc Scheduling Sample tabulated data from simulation

181. Disc Scheduling Corresponding graph for table on previous slide

182. Disc Scheduling Simulation Results and Discussion Round Robin Time Slot The fixed parameters, collected data and corresponding graph is included in the next set of slides. Increasing the time slot markedly increases the CPU utilization and throughput, and decreases the average turnaround and average waiting time. All these are indicative of the FIFO behavior. Though performance measures tend to make increased time slot look like a very lucrative proposal, associated disadvantages of possible starvation of processes apply. As the context switch decreases with increasing time quantum, so does the percentage seek and latency times. All this collectively increases the % CPU utilization

183. Disc Scheduling Sample tabulated data from simulation

184. Disc Scheduling Corresponding graph for table on previous slide

185. Disc Scheduling Sample tabulated data from simulation

186. Disc Scheduling Corresponding graph for table on previous slide

187. Disc Scheduling Simulation Results and Discussion Sector Size The fixed parameters, collected data and corresponding graph is included in the next set of slides. This parameter was studied for the SSTF-First Fit algorithm combination and due to lack of interesting results, further data was not collected. The parameter of sector size was varied over the range of 1KB to 8KB and showed little effect on any of the performance measures. It can be explained by the fact that sector size does not affect disc allocation markedly and has no say in transfer rate. Moreover, process sizes varied from 20KB to 2MB in multiples of 20KB.

188. Disc Scheduling Sample tabulated data from simulation

189. Disc Scheduling Corresponding graph for table on previous slide

190. Disc Scheduling Conclusions To summarize, The SSTF-First Fit algorithm emerges to be the optimal algorithm combination. With the optimal value of round robin time quantum and minimal possible values of average seek time and average latency time, the system performance tends to be maximized. The sector size however, tends to show little if any effect.

191. Integration of the modules into an Optimal Operating System The results of some such attempts: Zhao’s work: He attempted a simulation of an operating system using multiple level feedback queue for CPU scheduling, paging for memory management and use of FIFO disc scheduling algorithm under disc management. The study identified round robin slot time, aging parameters, page replacement algorithms and page size to be some of the more critical parameters deriving system performance. Su’s work: In her work on parametric optimization of an operating system studied the parameters of CPU scheduling algorithms, prediction of burst time and round robin quantum in context of system performance. The study used Fourier Amplitude Sensitivity Test (FAST) analysis to identify the most important parameters that contribute to system performance.

192. Integration of the modules into an Optimal Operating System Execution time and number of processes were identified to be the most important factors contributing to the performance of the model system. Round robin time quantum, process size and process priority followed close suit. In terms of parametric optimization, FIFO, priority-base and SJF scheduling fared better as compared to multilevel feedback queue and round robin queue; the impact of round robin quantum was found significant only when the value was small; and performance of SJF and multilevel feedback queues was found to be largely dependent on the prediction of burst time.

193. Integrated Perspective of this study The study started with an in-depth discussion of four critical operating system functions namely CPU scheduling, synchronization and deadlock handling, memory management and disc scheduling. We started with CPU scheduling as it is the most elementary and closest to the concept of process and process-mix. Next, we discussed the topic of process synchronization and deadlock handling. As we moved to the memory management module, our simulation integrated CPU scheduling with memory management. The CPU scheduling algorithm chosen, however, was round robin algorithm instead of the multi-level feedback queue.

194. Integrated Perspective of this study Next, as we moved to disc scheduling, we built on our implementation from memory management module by integrating disc scheduling into the same. In other words, our implementation as discussed under the disc scheduling module can also be viewed as an operating system that uses round robin algorithm for CPU scheduling, continuous memory allocation scheme for memory management and has a disc scheduling mechanism.

195. Integrated Perspective of this study The parameters of this integrated system are, hereby, enumerated: Time slot for the round robin queue Aging thresholds for FIFO, priority-based and SJF queues ?-values and initial execution time estimates for the FIFO, SJF and priority-based queues. Choice of preemption for the SJF and Priority based queues. Context Switching Time Memory size RAM access time

196. Integrated Perspective of this study Compaction algorithm Compaction thresholds – Memory hole-size threshold and total hole percentage Memory placement algorithms – first-fit, best-fit, worst-fit Disc access time (seek time, latency time and transfer time) Disc configuration Disc scheduling algorithm – FIFO, SSTF, LOOK, C-LOOK, SCAN, C-SCAN Disc writing mechanism

197. Integrated Perspective of this study Next comes the issue of optimizing the system and coming up with the right permutation of design parameters to achieve excellent performance measures. Every simulated module generates a random process mix. Assuming that there are six parameters in a specific module and each parameter can take ten possible values, the total number of possible permutations becomes one million (10x10x10x10x10x10). Furthermore, these one million permutations are applicable to the particular process mix only.

198. Integrated Perspective of this study Thus, only the optimal values for the parameters that have been studied as variable independent parameters in the course of this study are enumerated: round robin time – 4ms ?-updating scheme – no effect memory placement algorithm – best fit, disc scheduling algorithm – SSTF average seek time – 4ms average latency time – 2ms sector size – no effect

199. Integrated Perspective of this study The following are the values of the fixed independent variables: RAM size – 32MB Compaction thresholds – 6% and hole size = 50KB RAM access time – 14ns Disc configuration – 8 surfaces, 300 tracks/surface disc access time – (seek + latency + job size (in bytes)/50000) ms The above stated optimal values are pertinent to our particular process mix only.

200. Purpose of this study and the course At this point, it is appropriate to reiterate that the purpose of this study as of this course has been to present an alternative approach in studying operating systems design. By using parametric optimization, it is intended that during the course the students get a clear concept of operating systems functions and design rather than implementing a real system.

  • Login