Do you think IIT Guwahati certified course can help you in your career?
No
Introduction
Paging in Operating System is a storage mechanism that enables the operating system to retrieve processes from secondary storage and place them in the main memory as pages.
The basic concept behind paging in operating system is to break each process into individual pages. The primary memory will be separated into frames as well.
One page of the process should be saved in one of the memory frames. The pages can be placed in various locations throughout the memory, but finding contiguous frames or holes is always the goal.
Process pages are only brought into the main memory when they are needed; otherwise, they are stored in secondary storage.
Frame sizes fluctuate depending on the operating system. Each frame must have the same size. Because the pages in Paging are mapped to the frames, the page size must be the same as the frame size.
Paging in operating system is a storage mechanism that enables the operating system to retrieve processes from secondary storage and place them in the main memory as pages.
The primary memory is partitioned into little fixed-size pieces of physical memory called frames in the Paging method.
To get the most out of the main memory and avoid external fragmentation, the size of a frame should be the same as the size of a page. Paging in operating system is a logical approach for gaining faster access to data.
Examples of Paging in Operating System
Dedicated registers can be used in the hardware implementation of the page table. However, using a register for the page table is only appropriate if the page table is tiny. We can employ TLB (translation Look-aside buffer), a particular, small, fast lookup hardware cache if the page table has a high number of entries.
The TLB is a high-speed, associative memory.
TLB entries are made up of two parts: a tag and a value.
When this memory is accessed, an item is compared to all tags at the same time.
If the object is located, the value associated with it is returned. Main memory access time = m If the page table is kept in the main memory, Effective access time = m(for page table) + m(for particular page in page table).
For example, if the main memory is 16 KB and the frame memory is 1 KB. The main memory will be partitioned into 16 frames, each with one kB.
The system has four independent processes, 4 KB in size: A1, A2, A3, and A4.
All processes are divided into 1 KB pages for the operating system to store one page in a single frame.
All of the frames are left empty at the start of the process to ensure that all of the process pages are stored in a logical order.
After some time, A2 and A4 are shifted to the waiting state, as seen in this example. As a result, eight frames become unoccupied, allowing new pages to be loaded into those spaces. In the ready queue is a process A5 with a size of 8 pages (8 KB).
We can see that there are eight non-continuous frames available in the memory in this example, and paging allows us to store the process in multiple locations. This permits us to load process A5 pages instead of A2 and A4 pages.
The address generated by the CPU is divided into
Page number(p): Page number or the number of bits necessary to indicate the pages in Logical Address Space.
Offset(d) on the page: The number of bits necessary to represent a certain word on a page, the size of a page in Logical Address Space, or the word number of a page or the offset of a page.
Physical Address is divided into
Frame number(f): The number of bits necessary to represent a frame in Physical Address Space, often known as a frame number.
Frame offset(d): The number of bits necessary to represent a certain word in a frame, or the physical address space frame size or the word number of a frame or the frame offset. With the help of frame offset, the memory management unit can calculate the physical address of a word by combining the frame offset and the frame number. It helps to determine the location of a specific word within a frame.
Here are a few important points about paging in the operating system:
1. Reduces internal fragmentation: Paging divides memory into a fixed size of pages. This eliminates the wasted space within each page and it improves the memory utilization.
2. Enables reminiscence to be allotted on call for: When a process needs more memory, the operating system provides more pages to the process as per the need. This on-demand allocation feature makes memory utilization efficient.
3 Protection and sharing of memory: Paging provides memory protection by preventing it from unauthorized access. It also shares memory between the processed by mapping multiple logical addresses to the same physical memory pages.
4. External fragmentation: It occurs when the free memory blocks become scattered. Paging reduces external fragmentation by allocating memory to the fixed-sized pages.
5. Overhead: Overhead occurs at the time of paging due to maintaining the page table and performing address translation.
Memory Management Unit
1. Logical Address or Virtual Address
The logical address is an address that is generated by the CPU in the context of a computer system’s memory management. A process or program uses this address at the time of accessing memory.
2. Logical Address Space or Virtual Address Space
The logical address space is the total range of logical addresses that a program can access. It represents the memory address and it can be larger than the physical memory.
3. Physical Address
The Physical address is a real location in the physical memory hardware where the data is stored. It is used by the hardware components to read from or write to the physical memory.
4. Physical Address Space
The Physical address space is the total range of physical addresses that are present in the physical memory. Physical address space is determined by the capacity and the architecture of the computer system.
Features of Paging in PC Reminiscence Management
Here are some features of Paging:
Page desk entries:: A page table entry (PTE) is used to represent each page in a method's logical address.
Number of page desk entries: The number of entries in a method's page desk equals the number of pages inside the logical address region of the method.
Fixed web page and frame length: The page length used for paging is often the same as the size of a frame in the most crucial memory.
Logical to bodily address mapping: Paging enables a process's logical address space to be non-contiguous, which allows the process to occupy physical memory.
Page table stored in important memory: Page table is stored in the main memory that allows fast-access memory of the computer.
Advantages of Paging in Operating System
The following are some advantages of Paging in Operating System:-
Efficient memory management
Simplified allocation and deallocation
Supports virtual memory systems
Provides better utilization of physical memory
Disadvantages of Paging in Operating System
The following are some disadvantages of Paging in Operating System:-
What is the paging in the operating system memory management scheme?
Paging is a memory management scheme in operating systems that divides physical memory and processes into fixed-size blocks (pages) to manage memory allocation efficiently.
What are the two types of paging?
The two types of paging in operating systems are "Hierarchical Paging," which uses a multi-level page table, and "Hashed Page Tables," which employ a hash function for page mapping.
What problem does paging solve?
Paging enables a process's logical address space to be non-contiguous, which allots the process's physical memory. We separate the processes into pages to put this strategy into practise. Blocks with defined size make up pages.
What does paging avoid?
Although paging reduces external fragmentation, internal fragmentation still exists. When memory is divided up into fixed-sized blocks, internal fragmentation occurs. It happens when a process uses less space or requires more space than the memory block size provided.