Page 160 - DCAP103_Principle of operating system
P. 160

Unit 5: Memory Management



            memory-management solution. Modified versions of swapping, however, are found on many   Notes
            systems. A 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. Early PCs
            lacked sophisticated hardware (or operating systems that take advantage of the hardware) to
            implement more advanced memory management methods, but they were used to run multiple
            large processes by a modified version of swapping. A prime example is the Microsoft Windows
            3.1 operating system, which supports concurrent execution of processes in memory. If a new
            process is loaded and there is insufficient main memory, an old process is swapped to disk. This
            operating system, however, does not provide full swapping, because the user, rather than the
            scheduler, decides when it is time to preempt one process for another. Any swapped-out process
            remains swapped out (and not executing) until the user selects that process to run. Follow-on
            Microsoft operating systems, such as Windows NT, take advantage of advanced MMU features
            now found even on PCs.

                          Swapping is a simple memory/process management technique used by the
                          operating system(os) to increase the utilization of the processor by moving
                          some blocked process from the main memory to the secondary memory(hard
                          disk);  thus  forming  a  queue  of  temporarily  suspended  process  and  the
                          execution continues with the newly arrived process. After performing the
                          swapping process,the operating system has two options in selecting a process
                          for execution.

            5.4 Contiguous Memory Allocation


            The main memory must accommodate both the operating system and the various user processes.
            We  therefore  need  to  allocate  different  parts  of  the  main  memory  in  the  most  efficient  way
            possible. This section will explain one common method, contiguous memory allocation. The
            memory  is  usually  divided  into  two  partitions—one  for  the  resident  operating  system,  and
            one for the user processes. We may place the operating system in either low memory or high
            memory. The major factor affecting this decision is the location of the interrupt vector. Since the
            interrupt vector is often in low memory, programmers usually place the operating system in
            low memory as well. Thus, in this text, we shall discuss only the situation where the operating
            system resides in low memory. The development of the other situation is similar. We usually
            want several user processes to reside in memory at the same time. We therefore need to consider
            how to allocate available memory to the processes that are in the input queue waiting to be
            brought  into  memory.  In  this  contiguous  memory  allocation,  each  process  is  contained  in  a
            single contiguous section of memory.

            5.5 Paging


            Paging is a memory-management scheme that permits the physical-address space of a process to
            be noncontiguous. Paging avoids the considerable problem of fitting the varying-sized memory
            chunks onto the backing store, from which most of the previous memory-management schemes
            suffered. When some code fragments or data residing in main memory need to be swapped out,
            space must be found on the backing store. The fragmentation problems discussed in connection



                                             LOVELY PROFESSIONAL UNIVERSITY                                   153
   155   156   157   158   159   160   161   162   163   164   165