Operating System (MM) III

How to execute for process in the memory. The process is round-robin and need execute by order. So the swapping is necessary.

  • Swapping

    A process, however, can be swapped temporarily out of memory to a backing store, and then brought back into memory for continuous.

    The quantum must also be sufficiently large that reasonable amount of computing are done between swaps.

    A variant of this swapping policy is used for priority-based scheduling algorithm. This variant of swapping is sometimes called roll out, roll in.

    • Address Binding
      Normally a process that is swapped out will be swapped back into the same memory space that it occupied previously.
      • If binding is done at assembly or load time the process cannot be moved to different locations
      • If execution-time binding is being used a process can be swapped into a different memory space, because the physical addresses are computed during execution time.
    • Backing Store
      The backing store is commonly a fast disk.It must be large enough to accommodate copies of all memory images for all users, and it must provide direct access to these memory images.The system maintains a ready queue consisting of all processes whose memory image are on the backing store or in memory and are ready to run.
      • Whenever the CPU schedule decide to execute a process, it calls the dispatcher . The dispatcher checks to see whether the next process in the queue is in memory. If not, and there is no free memory region, the dispatcher swaps out a process currently in memory and swaps in the desired process. It the reloads registers as normal and transfers control to the selected process.
  • Performance
    • time
      For efficient CPU utilization, we want our execution time for each process to be long relative to the swap time.
    • The factors affected to swapping performance
      • Memory Allocation

      The major part of the swap time is transfer time. The total transfer time is directly proportional to the amount of memory swapped.Therefore, it would be useful to know exactly how much memory a user process is using, not simply how much it might be using. Then, we would need to swap only what is actually used, reducing swap time. For this method to be effective, the user must keep the system informed of any changes in memory requirements. Thus, a process with dynamic memory requirements will need to issue system call (request memory and release memory) to inform the operating system of its changing memory needs.

      • Waiting I/O operation

      Swapping is constrained by other factors as well. A process may be waiting for an I/O operation when we want to swap that process to free up its memory. However, if the I/O is asynchronously accessing the user memory for I/O buffers, then the process cannot be swapped. Assume that the I/O operation was queued because the device was busy.

      The two main solution to this problem are never to swap a process with pending I/O or execute I/O operations only into operating-system buffers. Transfers between operating-system buffers and process memory then occur only when the process is swapped in.

    • The modification of swapping
      The modification of swapping is used in many versions of UNIX.Swapping was normally disabled, but would start if many processes were running and were using a threshold amount of memory. Swapping would again be halted if the load on the system were reduced.