Scheduler used for "swapping out" or "swapping in"- Medium-term scheduling

Q.  OS: Which scheduler performs the "swapping out" or "swapping in"?
- Published on 22 Jun 15

a. Long-term scheduling
b. Medium-term scheduling
c. Short-term scheduling
d. None of the above.

ANSWER: Medium-term scheduling
 

    Discussion

  • Nirja Shah   -Posted on 25 Nov 15
    Process scheduler
    It is a part of the operating system that decides which process runs at a certain point in time.
    It comes with a ability to pause a running process, move it to the back of the running queue and start a new process; such type of scheduler is known as preemptive scheduler, otherwise it is a cooperative scheduler.

    Long-term scheduling
    - This scheduler is also known as admission scheduler.
    - It decides as to which jobs or processes are to be admitted to the ready queue (in main memory); 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.
    - It dictates what processes are to run on a system, and the degree of concurrency to be supported at any one time – whether many or few processes are to be executed concurrently, and how the split between I/O-intensive and CPU-intensive processes is to be handled.
    - It is also responsible for controlling the degree of multiprogramming.

    Medium-term scheduling
    - This scheduler temporarily removes the processes from main memory and places them in secondary memory (such as a hard disk drive) or vice-versa, which is also commonly referred to as "swapping out" or "swapping in" (also incorrectly as "paging out" or "paging in").
    - They decide to swap out a process which has not been active for some time, or a process which has a low priority, or a process which is page faulting frequently, or a process which is taking up a large amount of memory in order to free up main memory for other processes, swapping the process back in later when more memory is available, or when the process has been unblocked and is no longer waiting for a resource.
    - In most of the systems today (those that support mapping virtual address space to secondary storage other than the swap file), this scheduler performs the role of the long-term scheduler, by treating binaries as "swapped out processes" upon their execution.
    - In this way, when a segment of the binary is required it can be swapped in on demand, or "lazy loaded".

    Short-term scheduling
    - It is also known as the CPU scheduler.
    - It decides which of the ready, in-memory processes is to be executed (allocated a CPU) after a clock interrupt, an I/O interrupt, an operating system call or another form of signal.
    - This scheduler makes scheduling decisions much more frequently than the long-term or mid-term schedulers - a scheduling decision will at a minimum have to be made after every time slice, and these are very short.
    - It can be preemptive, implying that it is capable of forcibly removing processes from a CPU when it decides to allocate that CPU to another process, or non-preemptive (also known as "voluntary" or "co-operative"), in which case the scheduler is unable to "force" processes off the CPU.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)