In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Overview
In a multiprogramming system, there are multiple processes in memory and are either running on the processor or waiting for an event to occur (such as IWeiO completion). When a processor (or group) stays busy by executing one process, other processes are waiting.
The key to multiprogramming is scheduling. According to the execution of the process, the operating system has three types of processor scheduling schemes and an Imax O scheduling scheme.
Long scheduling scheme: determine when to allow a new process to enter the system
Scheduling scheme: responsible for the memory swap function to determine when to fetch part or all of a program into memory.
Short scheduling scheme: determine which ready process will be executed by the processor next time.
Igamo scheduling scheme: determines which process's pending Icantho request will be processed by the available Icantho device
Here, the processor scheduling scheme is summarized, and the short scheduling scheme is the main part, and the Ihammer O scheduling scheme will be summarized in the next summary of the Imax O problem.
Considering the frequency of execution, long schedulers execute relatively less frequently (only roughly deciding whether to accept a new process and which one to accept); moderate scheduling schemes execute slightly more frequently (determining the exchange of processes); short schedulers (dispatchers) execute only the most frequently (accurately determine which process to execute next). The long scheduling and medium scheduling schemes are mainly driven by the performance related to the concurrency of the system, and then the correlation of the three scheduling schemes is given. Due to the additional complexity of the use of multiprocessor pairs, the scheduling situation of a single-processor system is referred here to find the difference between scheduling algorithms more clearly.
Correlation diagram of scheduling scheme
Process status and scheduling transition diagram
Nesting diagram of scheduling scheme
Queue diagram for scheduling
Long-range scheduling
Because it determines which program can be processed in the system, it controls the concurrency of the system.
When the long-range scheduler runs, it creates the corresponding process, which involves two decisions: deciding when the operating system can accept one or more processes, deciding which jobs or jobs to accept and turning them into processes.
Deciding when the operating system accepts one or more processes is usually driven by the concurrency of the system. The more processes, the smaller the percentage of execution events per process (more processes compete for the same amount of processor time). In order to provide suitable processor resources for the current process set, long-range scheduling may limit the system concurrency. When a job terminates or the processor's idle time slice exceeds a certain threshold, it will limit the system concurrency or start the long-range scheduler.
Decisions about which jobs are allowed to enter can be based on a simple first-come-first-served principle, or on tools based on managing system performance (including priority, expected execution time, Imap O requirements).
For the interactive program of the time-sharing system, the user's attempt to connect to the system may produce a process-created request, and the time-sharing users do not just wait in line until the system receives them. Instead, the operating system receives all authorized users until the system is saturated. At this point, the user connects again and gets a message that the operating system is saturated and requires the user to try again.
Medium-range scheduling
Is part of the switching function, which typically depends on the concurrency requirements of the management system, and system management is also a problem in systems that do not use virtual memory. So the swap decision will take into account the storage requirements of the swapping out process.
Short-range scheduling
The main goal is to allocate processor time in a way that optimizes the behavior of several aspects of the system, and to call a short-range scheduler when events that may cause the current process to block or preempt the current running process occur. Events include clock interrupts, Imax O interrupts, operating system calls, signals, and so on.
Design criteria for short-range scheduling
At design time, a series of rules should be established for various scheduling strategies that may be evaluated. The criteria are classified into two dimensions: one is user-oriented or system-oriented, and the other is directly or indirectly related to performance.
User-oriented and system-oriented criteria
User-oriented guidelines: related to the system behavior perceived by the user or process, such as the response time of the interactive system, the amount of time is visible to the user. A threshold can be defined for response time, and the goal of the scheduling mechanism is to maximize the number of users whose average response time is less than or equal to this threshold.
System-oriented guidelines: focus on the effectiveness and efficiency of the use of processors, such as throughput, that is, the speed at which the process is completed. This guideline is of concern to system administrators.
User-oriented principles are very important in all systems, while system-oriented principles are less important in single-user systems. In a single-user system, as long as the response time of the system to the user application is acceptable, it may not be important to achieve high processor utilization or high throughput.
Directly or indirectly related to performance
Criteria directly related to performance are quantitative and usually easy to measure, such as response time and throughput.
Criteria that are not directly related to performance are qualitative and difficult to measure and analyze, such as predictability, that is, services exhibit the same characteristics as they change over time and are independent of other work performed by the system (it can be measured by calculating the changes in the load function, but not as directly as throughput or the corresponding time function on workload).
Interdependent scheduling criteria
The above scheduling criteria can not make them optimal at the same time, such as providing a good response time, the scheduling algorithm may switch frequently between processes, which increases the system overhead and reduces the throughput. Here are some important scheduling criteria.
Scheduling criteria are user-oriented, system-oriented turnaround time, response time, deadline throughput, processor utilization and performance are not directly related to predictability, fairness, mandatory priority, and resource balance.
Turnaround time: the interval between submission and completion of a process, including actual execution time and waiting time for resources, which is an appropriate measure for batch jobs.
Response time: for an interactive process, the interval between the submission of a request and the start of receiving a response. Usually when the process processes the request, it starts to give the user some output, which is a better measure for the user's point of view. This scheduling criterion attempts to achieve a low response time and maximize the number of users interacting with each other in an acceptable time.
Deadline: the deadline for the completion of the process, and the scheduling principle will reduce the implementation of other goals to maximize the percentage of jobs that meet the deadline.
Predictability: regardless of the load of the system, the total time and total overhead of a given job are the same, that is, the turnaround time cannot change too much after the response time. You may need to signal when the system workload wobbles widely or need the system to deal with instability.
Throughput: the largest number of processes completed in each time unit of the room, a measure of how much work can be performed. It mainly depends on the average execution length of a process and is also affected by the scheduling policy (which affects the utilization of the processor).
Processor utilization: the percentage of processors busy is an important criterion for expensive shared systems, but less important for single-user systems and other systems, such as real-time systems.
Fairness: without guidance from users or other systems, the process should be equally right, and no process is hungry.
Mandatory priority: when a process is assigned a priority, the scheduling policy should give priority to the high-priority process.
Balancing resources: the scheduling strategy keeps system resources busy, and priority should be given to processes that use scarce resources less. It is also suitable for long-range scheduling and medium-range scheduling.
Short-range scheduling algorithm
The choice depends on the expected performance and implementation complexity.
The influence of throughput response time overhead on processes according to the decision mode the waiting time of hungry FCFS is the longest, max [w] non-preemption may be very high, especially when the process execution time is very different, the minimum is disadvantageous to short processes. It is disadvantageous to I SPN-intensive processes, no rotation constant time slice, when the time slice is used up, the preemptive time slice is small, the throughput is small, the response time is good for short processes, the least fair treatment is the shortest total service time without SPN, and the min [s] non-preemptive high provides good response time to short processes. It is not conducive to long processes. It is possible that the total service remaining time of min [s] is the shortest. When the service arrives, the high response time is good, and the high response time is not conducive to the long process. It is possible that the ratio of HRRN total turnaround time to total service time is the largest max [(winters) / s] non-preemptive high response time is better than the balance without feedback. See preemption below. When the time slice is used up, it does not emphasize the possibility that the higher level is advantageous to the Imax O-intensive process.
W: process wait time; e: current execution time; s: total service time required by the process, including e
First come, first served FCFS
The process with the longest waiting time is selected, and when a process is stopped, the process with the longest waiting time is taken from the ready queue for execution. For short processes, the effect of executing a long process is better. When a long process executes first, a short process has to wait for the long process to finish, and the normalized turnaround time (turnaround time / service time) of the short process is much more than that of the long process.
Compared with processor-intensive processes, it is not conducive to scheduling for I-base O-intensive processes. When there are both Imax O-intensive and processor-intensive processes, if the processor-intensive program is running at this time, the Imax O-intensive must wait. Some of the IAccord O-intensive processes may be in the IPUP O queue, and when the processor-intensive processes are in the ready queue, the IWeiO device may be idle, even if there are other processes to use. After the execution of the current process, the waiting Imax O-intensive process will quickly pass through the run state and enter the IWeiO queue again, during which the processor is not used for a long time. If processor-intensive processes are blocked, both the processor and the Imax O device will be idle.
Rotating RR
In order to reduce the disadvantage of FCFS to short jobs, a simple method is to adopt the clock-based preemption strategy, and the simplest method is the round robin algorithm. Clock interrupts are generated at a periodic interval, and the currently running process is placed in the ready queue when the interruption occurs, and then the next ready job is selected to run based on the FCFS policy. This technique is also called time slice, and each process is allocated a certain amount of time before it is preempted.
The length of the time slice used in the main design problem is shorter, the shorter operation will be faster through the system. Processing clock interrupts, executing scheduling and dispatching functions at the same time requires processor overhead, so avoid too short time slices. The better idea is that the time slice is slightly longer than the time required for a typical interaction, if it is less, then most of them need at least two time slices; if it is too long, it will degenerate into a FCFS strategy. This strategy is particularly effective in general time-sharing systems or transaction processing systems.
One drawback of the rotation strategy is that it depends on the difference between processor-intensive processes and Imax O secret processes. If both exist, there will be the following situations: after a very short processor time, an Imax O secret process enters the Imax O queue and waits for the completion of the Imax O operation to enter the ready queue; at the same time, a processor-intensive process enters the ready queue after using a full processor time during execution. Therefore, for these two types of processes, the processor time occupied is not equal, the time it takes for an Imax O-intensive process to obtain the processor is different, and the waiting time is affected by the number of ready processes, which reduces the performance of the Imax O-intensive process, the inefficiency of using the Iamp O device, and the great change in the response time.
The improvement to this is the virtual round robin method, which differs from the simple round robin strategy in that when a time slice is not used up and is blocked, it enters a FCFS auxiliary queue when it is ready. When a scheduling decision is made, the auxiliary queue takes precedence over the process of the ready queue and executes on the remaining time slices.
Shortest process first SPN
Another way to reduce FCFS's inherent bias towards long processes is the shortest process first, which is a non-preemptive strategy, and the principle is to choose the process with the shortest expected processing time next time. Short processes take precedence over long processes, so the volatility of the response increases and the predictability decreases.
The difficulty of the SPN strategy is to predict the execution time required for each process. For batch processing, the system requires the programmer to estimate the value and provide it to the operating system. If the value is much lower than the actual value, the job may be terminated early. In a production environment, the same jobs run frequently and their statistics can be collected, and for interactive processes, the operating system can keep a running average for each process.
Minimum remaining time SRT
For the preemption mechanism added by SPN, the scheduler always selects the process with the shortest expected remaining time. When a new process enters the ready queue, it may have less time remaining than the currently running process. So every time a new process enters the ready queue, the scheduler may preempt the currently running process. Like SPN, an estimate of the processing time is needed, and there is the possibility of hunger for a long process.
Because SRT does not favor long processes like FSFC, nor does it generate additional interrupts like RR, it reduces overhead; at the same time, it has to record past service time and increase overhead. In terms of turnaround time, SRT has better performance than SPN because short processes can be selected to run compared to long processes that are running.
Highest response ratio priority HRRN
Normalized turnaround time is the ratio of turnaround time to actual service time (R = (winters) / sforce R is normalized turnaround time, w is waiting time, s is expected service time), which can be used as a performance measure, and the smaller the average of each process and all processes, the better.
The scheduling rule selects the largest ready process of R each time. One feature of this method is that it refers to the execution history of the process. When the preference for the short job is (s is small, the ratio is large), the long process increases the waiting time because it is not served, thus increasing the ratio (large molecule, large ratio), which will eventually be better than the short process and be scheduled.
Like SPN and SRT, the service time needs to be estimated.
Feedback FB
SPN, SRT, and HRRN cannot be used without any information about the relative length of each process. Another way to give priority to short jobs is to lower the priority of long jobs, that is, if you cannot get the remaining execution time, focus on the executed time.
Scheduling is based on the preemption principle by time slice and has a dynamic priority mechanism at the same time. When a process enters the system for the first time, it is placed in the RQ0 (the highest priority ready queue), when it is preempted and ready, it is put into the RQ1 (the priority is lower than the RQ0 ready queue), and so on, it is assigned to the lowest priority ready queue RQN, and the FCFS scheduling strategy is used in this queue. Because a short process is finished quickly, this priority will not be reduced much, while the priority of a long process will be much lower because of the longer execution time.
The simple feedback strategy rotates according to the length of the time slice, with other variants. There is a problem with the simple return strategy, the turnaround time of long processes will continue to increase, and hunger may occur if new processes enter the system frequently. To solve this problem, there are several variants of strategies
Change the preemption times according to the queue, such as one time unit for each process in RO0 queue, 2 time units for RO1, 2 ^ n time units for RON, and so on.
Even if the lower queue is given more time to execute, there is still hunger for long processes. Another way is to increase the priority of a process when it waits for service in the current ready queue for more than a certain amount of time.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.