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 share system resources  to achieve  multiprogramming .  There are  mainy three types of pro

    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 types:-  i> System  Process. ii> User Process. Early computers allowed only one program be ex

    Semaphores In Process Synchronization

       ⇰  Semaphores :-   Semaphore is actually a method or tool to prevent race condition. Race condition can cause loss of data or even deadlock situation. For prevention from these conditions, the semaphore is one of the method.  Semaphore was proposed by Dijkstra in 1965. Simaphore    is a very significant technique to manage concurrent processes.  Semaphore is useful tool in the prevention of race condition. But the use of semaphore never means a guarantee that a program is free from these problems.     Semaphore is an integer variable which is used in mutual exclusive manner by various concurrent cooperative processes in order to acheive synchronization. Hence semaphore is one of the way to achieve synchronization.  Semaphore is basically  a variable which is non-negative and shared between threads. This variable is used to solve the critical section problem and to achieve process synchronization in the multiprocessing environment. Semaphore contains some operations as f