What is the main function of the medium-term scheduler in an operating system?
a) To swap processes in and out of memory
b) To allocate CPU time to processes
c) To handle I/O operations
d) To manage process creation and termination
Answer:
a) To swap processes in and out of memory
Explanation:
The medium-term scheduler is responsible for swapping processes in and out of main memory to control the level of multiprogramming in a system. It removes processes from memory to free up space when the system is overloaded and swaps them back into memory when resources are available.
This process, known as “swapping,” allows the operating system to maintain an optimal balance between active and inactive processes. Swapping ensures that processes can be resumed at a later time without losing progress.
Medium-term scheduling helps improve system performance by managing memory usage efficiently and preventing memory overloading while keeping a balanced load on the CPU.