Job Scheduling
Role and process of job scheduling (advanced scheduling)
Job scheduling, also known as advanced scheduling, is responsible for scheduling jobs from external memory to internal memory, mainly solving the problem of limited system memory. Its main task is to determine which jobs can enter the memory at a specific time, thereby transforming into processes and getting the opportunity to compete for the CPU. The specific roles and processes are as follows:
-
Solving the limitation of memory resources: Due to the limited memory space of the computer, the operating system cannot load all the jobs submitted by all users into the memory at one time. Therefore, advanced scheduling uses a certain algorithm to select which jobs can enter the memory to improve memory utilization and allocate resources reasonably.
-
Job selection from external memory to internal memory: Job scheduling selects one or more jobs in the backup queue of the external memory according to a certain priority or algorithm, allocates memory and other necessary resources, and establishes corresponding process control blocks (PCBs), thereby creating processes for these jobs and making them eligible to participate in CPU scheduling.
-
Establishing and revoking PCB:
-
Job transfer: When a job is selected to enter the memory, the operating system allocates resources for it and establishes a PCB.
-
Job call-out: When a job is completed or ends, it will be removed from the memory, and the PCB will be revoked.
-
Single call-in and call-out: In the advanced scheduling process, each job is only called in once (from external memory to internal memory) and called out once (removed from internal memory after the job is completed) during its life cycle, so the focus of scheduling is on the timing of call-in.
-
Facilitate resource competition: Determine the order in which jobs enter the memory through scheduling, and transform jobs into processes, so that they can participate in resource competition when system resources are limited, ensuring efficient and fair operation of the system.
Analogy
Advanced scheduling is like managing the allocation of public resources, such as the "toilet" metaphor. The queuers outside (jobs in external memory) are waiting to enter, and the system introduces the queuers into the "toilet" (memory) according to certain rules (advanced scheduling algorithm) so that they can "use" resources (CPU).