Skip to main content

Paging In Operating System

      ⇰  PAGING :-

   In Operation System, paging is actually a memory management scheme that eliminates the need for contiguous memory allocation. It permits the physical address space of a process to be non–contiguous type.


  Paging  also solves the considerable problem of fitting memory chunks of varying sizes onto the backing store. Most memory management schemes before the introduction of paging suffered from this problem. The problem arises because, when data residing in main memory need to be swapped out, space must be found on the backing store. The backing store has the same fragmentation problems. However, paging avoids external fragmentation

  The basic method for implementing paging involves breaking physical memory or main memory into fixed-sized blocks called frames and breaking logical memory or secondary memory ( Harddisk)  into blocks of the same size called pages.  And the size of a frame is kept the same as that of a page to have optimum utilization of the main memory and to avoid external fragmentation. When a process is to be executed, its pages are loaded into any available memory frames in main memory.

  One page of the process is to be stored in one of the frames of the memory. The pages can be stored at the different locations of the memory but the priority is always to find the contiguous frames or holes. Pages of the process are brought into the main memory only when they are required otherwise they reside in the secondary storage.

  Different operating system defines different frame sizes. The sizes of each frame must be equal. Considering the fact that the pages are mapped to the frames in Paging, page size needs to be as same as frame size. A computer can address more memory than the amount physically installed on the system. This extra memory is actually called virtual memory and paging technique plays an important role in implementing virtual memory.


  Because of its advantages over earlier methods, paging in its various forms is used in most operating systems, from those for mainframes through those for smartphones. Paging is implemented through cooperation between the operating system and the computer hardware. 



      ⇰ EXAMPLE OF PAGING :-
          Suppose our main memory size is 16 KB and  the the frame size is 1 KB. Therefore, the main memory is divided into 16 frames of 1 KB each. Each process present in secondary memory will be divided into pages of 1 KB each. Let there are 4 processes P1, P2, P3 and P4 of 4 Kb each. Each process is divided into pages of 1 KB each, so that one page can be stored  in one frame.
     Since initially all the frames are empty so pages of processes will get stored in the contigeous way as follows:- 


     
      Now assume that P2 and P4 are moved to waiting state, so now 8 frames are empty and can be alloted to other process. Suppose a process P5 of 8 KB is waiting in ready queue, now this process can be loaded at the place of P2 and P4 as :-


    " The mapping from the virtual to the physical address is happend by the memory management unit (MMU) and this mapping is known as paging technique ".


    Share, Follow and please comment if you find anything incorrect or to share more information about the topic discussed above

    Comments

    Popular posts from this blog

    Process Scheduling And Types of Process Schedular :-

            ⇰ PROCESS SCHEDULING Process Scheduling  is a task  of Operating System that schedules processes of different states like new, ready, waiting, terminated  and running.This scheduling helps in allocation of CPU time for each process, and Operating System allocates the CPU time for each procss. And the process scheduling plays important role to keep the CPU busy all the time.  ⏩   Followings are some objectives of Process Scheduling :-  i > To increase the amount of users within acceptable response times.  ii > To maintain the balance between response and utilization of system. iii > To decrease the enforce priorities and  give reference to the processes holding the key resources.      ⇰  PROCESS SCHEDULAR A scheduler carries out the pro cess scheduling work. Schedulers are often implemented so they keep all computer resources busy and  allows multiple users to shar...

    Process & Its state And process control block :-

                    ⇰  PROCESS :- A process can be thought of as a program in execution. Means when any program is executed it becomes process. A processwill need certain resources such as CPU time , memory, files and I/O devices to complete its task. These resources are allocated to the process either when it is created or at the time of execution.             A process is the unit of work in most systems. A system consistes of a collection of processes. All these processes may execute concurrently. Traditionally a process contained only a single thread. Most modern operating ststems now supports processes that have multiple threads.         The operating system is responsible for several important works of process management as - the creation and deletion of process, the schrduling of process, communication and deadlock handling of process. Process is broudly divided into two ...

    Tokens and its types in 'C'

       Tokens are the smallest individual unit of a program or in simple words it is a main part of C program.Tokens are the building blocks of any program. The smallest individual and basic unit of a C programming is called c tokens.      *    Normally there are six types of tokens in C:- i> Keywords:-          Keywords are special words that are used to give a special meaning to the program and can't be used as variable and constant.They are basically a sequence of characters that have fixed to mean. For example:-                 auto     double      long     break                 float    short        char     if                while    continue   int       void etc. All...