Lecture
Task scheduling is one of the key concepts in multitasking and multiprocessing in both general-purpose and real-time operating systems. Planning involves prioritizing processes in the priority queue. The program code that performs this task is called the scheduler (English task switcher , scheduler ).
The most important goal of scheduling tasks is the most complete CPU load. Performance - the number of processes that complete execution per unit of time. The wait time is the time the process waits in the ready queue. Response time is the time that passes from the beginning of the request to the first response to the request.
In real-time computing environments, for example, on mobile devices intended for automatic control in the industry (for example, robotics), the task scheduler must ensure that the processes are processed during specified time intervals (response time); This is critical for maintaining the correct operation of the real-time system.
Operating systems can include up to three different types of schedulers: a long-term scheduler (or execution authorization scheduler), a medium-term scheduler, and a short-term scheduler (also known as a dispatcher ). The names themselves already describe the relative frequency with which the scheduler performs its functions.
The long-term scheduler decides which tasks or processes will be added to the queue of processes that are ready for execution; that is, when an attempt is made to start a process, the long-term scheduler either adds a new process to a queue of ready-made processes (allows for execution), or postpones this action. Thus, the long-term scheduler decides which processes will be executed simultaneously, thereby controlling the degree of parallelism and the proportion between the processes intensively performing I / O and the processes intensively using the processor. Typically, desktop computers do not use a long-term scheduler and new processes are allowed to run automatically. But this scheduler is very important for real-time systems, since if the system is overloaded with concurrently running processes, the response time of the system may become longer than what is required, which is unacceptable.
In all systems with virtual memory, the medium-term scheduler temporarily moves (unloads) the processes from the main memory to the secondary memory (for example, to the hard disk), and vice versa. These actions are called swapping or swapping. The medium-term scheduler may decide to unload the process from the main memory if:
The process will be returned to main memory when the necessary amount of free memory is available or when the process exits standby mode (in this case, the scheduler unloads another process from the main memory to release the main memory).
In many modern systems that support the mapping of a virtual address space to a secondary memory other than the paging file, the medium-term scheduler can simultaneously play the role of a long-term scheduler, viewing new processes as processes that have been unloaded from main memory. Thus, the system can load program code into main memory only when the process needs it to execute (this is called load on demand or “lazy load”).
The scheduler at this level decides which of the ready-made and memory-loaded processes will be started on the CPU after the interruption (by time, I / O operation, calling the operating system, or other signal). Decisions at this level have to be made very often (at least every time period). Also, the scheduler may or may not support preemptive multitasking (that is, be able to interrupt the execution of a process).
A dispatcher is another component of the planning system. This is the module that transfers processor control to the process that was selected at the short-term scheduling level. Its tasks include context switching, switching to user mode, and jumping to the right place in the user program to start or continue its execution. The main requirement for the dispatcher is speed, since he performs each process switch.
Comments
To leave a comment
Operating Systems and System Programming
Terms: Operating Systems and System Programming