Home > Common Problem > body text

The job scheduler selects jobs from the queue and puts them into operation.

青灯夜游
Release: 2022-07-28 15:38:19
Original
6853 people have browsed it

Job scheduling selects jobs from the queue in the "backup" state and puts them into operation. From being handed over to the computer system to exiting the system after execution, a job generally goes through four states: submission, backup, execution and completion. The backup state means that after all the information of the job is entered into the external memory, a job control block is established for the job entering the system, and it is added to the backup job queue to wait for scheduling by the job scheduler; when the job is selected by the job scheduler, and After allocating the necessary resources and establishing a set of corresponding processes, the job enters the running state.

The job scheduler selects jobs from the queue and puts them into operation.

The operating environment of this tutorial: Windows 7 system, Dell G3 computer.

The main function of job scheduling is to review whether the system can meet the resource requirements of user jobs based on the information in the job control block, and to select certain jobs from the external storage backup queue according to a certain algorithm. memory, create processes and allocate necessary resources for them. Then insert the newly created process into the ready queue and prepare for execution. Therefore, job scheduling is sometimes called admission scheduling.

Job status

Jobs generally go through four stages from entering the system to running to completion, including entry, containment, operation, and completion. Correspondingly, a job generally goes through four states: submission, backup, execution and completion from being handed over to the computer system to exiting the system after execution.

  • Entry state: that is, the submission state, the process in which the job enters the external memory (also called the input well) from the input device; the information of the job in the submission state is entering the system.

  • Backup state: When all the information of the job is entered into the external memory, the system creates a job control block (JCB) for the job.

    After the operator inputs the job into the direct access backup accessor, he creates a job control block for the job entering the system, and adds it to the backup job queue, waiting for scheduling by the job scheduler. This process is also called job registration.

  • Running status: The job is selected by the job scheduler and the necessary resources are allocated. After a set of corresponding processes is established, the job enters the running status. It is divided into three states: ready state, execution state, and blocking state.

    A backup job is selected by the job scheduler, allocates necessary resources and enters the memory. After the job scheduler also establishes a corresponding process for it, the job changes from the backup state to the execution state.

  • Completion status: When the job ends normally or terminates due to an error, the job enters the completion phase. Generally speaking, the job scheduler needs to select the appropriate job from the queue in the standby state and put it into operation.

The steps for job scheduling are as follows:

  • (1) Establish a JCB control table based on JCB attributes and record each job a working state;

  • (2) Use the selected scheduling algorithm to select one or more jobs from the backup jobs and put them into operation;

  • (3) Make preparations for the selected job before running, including creating processes and allocating system resources to the corresponding processes:

  • (4) After the job is finished running Aftercare work. For example, status registration, resource recycling, output processing, and job cancellation.

Commonly used job scheduling algorithms

Commonly used job scheduling algorithms include first come, first served, shortest job first method, and the one with the highest response ratio first. and the precedence method.

  • (1) First come, first served (FCFS). Scheduling jobs in the order they arrive is not conducive to short jobs.

  • (2) Short jobs first (SJF). Jobs are scheduled according to their estimated running time, and jobs with a short estimated running time are scheduled first. It is not conducive to long jobs and may leave a job with a long estimated running time unserviced.

  • (3) The one with the higher response ratio takes precedence (HRN). Combining the above two, considering both the estimated running time of the job and the waiting time of the job, the response ratio is: HRN = (estimated running time waiting time) / estimated running time.

  • (4) Priority scheduling. According to the priority level of the job, the one with higher priority is scheduled first.

In addition, we need to understand several important concepts.

1. Job Turnaround Time Job turnaround time is the time between job submission and job completion. The turnaround time Ti of job i can be expressed as follows: Ti=Tei-Tsi where Tei is the completion time of job i and Tsi is the submission time of job i.

2. Average turnaround time Average turnaround time is the average of the turnaround times for multiple jobs. The average turnaround time of n jobs can be expressed by the following formula: T=(T1 T2...Tn)/n

3. Weighted turnaround time Weighted turnaround time is the ratio of job turnaround time to the actual running time of the job. The weighted turnaround time Wi of job i can be expressed as follows: Wi=Ti/Tri, where Ti is the turnaround time of job i, and Tri is the actual running time of job i.

4. Average Weighted Turnaround Time The average weighted turnaround time is the average of the weighted turnaround times for multiple operations.

For more related knowledge, please visit the FAQ column!

The above is the detailed content of The job scheduler selects jobs from the queue and puts them into operation.. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template