first, the concept of Job (Job)
(1) User angle
We put an application in the business process, from the beginning of the input to the end of the output, the user asked the computer to do all the work on the business process called a job.
The programming process shown in the illustration can be considered an example of a job.
Edit Input--> compile--> link--> perform--> output
(2) System angle
From the point of view of the computer system, the job is a broader concept than the program, which consists of three parts, the program, the data and the job description.
The system controls the program and data in the form of the document through the Operation manual, so that it is operated and executed. In a batch system, a job is the basic unit of a preemption memory, that is, a batch system that processes and data into memory for execution in a job unit.
second, job scheduling algorithm
1. First-come first SERVE,FCFS
The order of entry into the input well is arranged according to the operation. The advantage is that it is simple to implement, with FIFO (first input output,fifo) queue sequence work, the same or balanced operation is more reasonable, the disadvantage is not conducive to the operation of a short time operation.
2. Shortest job Priority method (shortest job FIST,SJF)
(1) Concept
(a) Job I turnaround time ti= job completion time-job submission time
(b) Average turnaround time T=1/n∑ti (weighted average)
(c) Average weighted turnaround time w=1/n∑ti/ti (multiplied by weighting average of weights)
TI is the actual running time of the job.
The shortest job priority method is to select the TI value is small priority, that is, only to consider the running time. The advantage is that short work is given priority, which improves the efficiency of the system. The disadvantage is that long assignments may not be able to queue up for long periods of time as the work continues to enter.
3. Highest response ratio precedence (highest response-ratio Next, Hrn)
The highest response ratio (HRN) is a kind of comprehensive balance of FCFS mode and SJF method. Hrn scheduling policy scheduling takes into account the length of waiting time for each job and the estimated execution time required, from which the response is chosen with the highest execution.
The response ratio or response coefficient r is defined under:
R= (w+t)/t=1+w/t
where T estimates the required execution time for the job, W is the wait time for the job in the fallback status queue.
Its advantage is the FCFS algorithm and the advantages of the SJF algorithm, the disadvantage is that the implementation of complex, each scheduling before the scan of all jobs, compared to later scheduling.
4. Timing Rotation Method
The time slice rotation can be divided into short fixed time slices (such as UNIX operating system time slices of milliseconds to dozens of milliseconds) and a long period of fixed time slices (such as a preemptive multitasking approach for Windows operating systems).
5. Method of Precedence
Work in queue order of precedence. Static and dynamic: Static is in the queue before the calculation of priority, dynamic is in the scheduling process to calculate the priority number. It can be divided into user-given priorities (reflecting user requirements) and system-given priorities, such as the priority of the system given foreground and background (such as batch jobs), and the general foreground (the job that interacts directly with the user) first.
6. Event-driven method
Ms-windows uses the task-driven method, and uses the irregular time slice assignment to accomplish multi-task. Every time something happens (event), it enters the appropriate event scheduler. The system performs the task through an event driver.
7. Scheduling algorithms for different types of job matching
The job scheduling of an operating system is often comprehensive, the main factors to be considered are the running time of CPU, the requirement of memory, the requirement of external setting, the requirement of I/O throughput and waiting time, etc.