1. What is a long-term scheduling? How it is differ from short-term scheduling? A process migrates between the various scheduling queues through out its lifetime. The operating system must select for scheduling purposes, processes from these queues in some fashion. The selection process is carried out by the appropriate scheduler. In a batch system, often more processes are submitted that can be executed immediately. These processes are spooled to a mass storage device, where they are kept. Long-term scheduler The long term scheduler or job scheduler selects processes from this spool and loads them in to memory for execution.The long-term scheduler decides which jobs or processes are to be admitted to the ready queue; that is, when an attempt is made to execute a program, its admission to the set of currently executing processes is either authorized or delayed by the long-term scheduler. Long-term scheduling is also important in large-scale systems such as batch processing systems, computer clusters, supercomputers and render farms. In these cases, special purpose job scheduler software is typically used to assist these functions, in addition to any underlying admission scheduling support in the operating system. Simple policies for long term scheduling are:
- Simple First Come First Served (FCFS): it’s essentially a FIFO scheme. All job requests (e.g. a submission of a batch program, or a user trying to log in a time shared system) are honored up to a fixed system load limit; further requests being refused tout court, or enquired for later processing.
- Priority schemes. Note that in the context of long term scheduling “priority” has a different meaning than in dispatching: here it affects the choice of a program to be entered the system as a process, there the choice of which ready process should be executed.
The primary distinction between these two schedulers is the frequency of their execution. The short-term scheduler must select a new process for the CPU frequently. A process may execute for only a few milliseconds before waiting for an I/O request. Often the short-term scheduler executes at least once every 100 milliseconds. Because of the brief time between executions, the short term scheduler must be fast. If it takes 10 milliseconds to decide to execute a process for 100 milliseconds, then 10/(100+10)=9 percent of the CPU is being used (or wasted )simply for scheduling the work. The long-term scheduler on other hand executes much less frequently. There may be minutes between the creations of new processes in the system. The long-term scheduler controls the degree of multiprogramming-the number of processes in memory. If the degree of multiprogramming is stable, then the average rate of process creation must be equal to the average departure rate of processes leaving the system. Thus the long-term scheduler may need to be invoked only when a process leaves the system. Because of the longer interval between executions, the long-term scheduler can afford to take more time to select a process for execution. The long-term scheduler must take a careful selection. In general, most processes can be desired as either I/O bound or CPU bound. An I/O-bound process spends more of its time doing I/O that it spends during computations. A CPU-bound process, on other hand generates I/O requests infrequently, using more of its time doing computation that an I/O bound process uses. The long-term scheduler should select a good process mix of I/O –bound and CPU bound processes. If all processes are I/O bound, the ready queue will almost always be empty, and the short-term scheduler will have little to do. If all processes are CPU bound, the I/O waiting queue will almost always be empty, devices will go unused, and again the system will be unbalanced. The system with the best performance will have a combination of CPU-bound and I/O –bound processes. On some systems, the long-term scheduler may be absent or minimal. For example, time-sharing systems such as UNIX often have no long-term scheduler, but simply put every new process in memory for the short-term scheduler. The stability of these systems depends either on a physical limitation such as the number of available terminals) or on self adjusting nature of human users. If the performance declines to unacceptable levels, some users will simply quit. REFERENCE - OPERATING SYSTEM CONCEPTS- SILBERSCHATZ GALVIN GAGNE