Paging in Memory Management

Paging divides memory into fixed-size pages and frames. A page table maps pages to frames, eliminating external fragmentation.
aging is a memory management technique used to store and access data efficiently. It allows a process to be divided into smaller parts so that memory can be used in a flexible way. In paging, memory is divided into two parts:

Each page has the same size as a frame.
Paging in Operating System
In the diagram:

Working of Paging in Operating System

Working of Paging in Operating Systemm

Paging is a memory management method that converts a logical address generated by the CPU into a physical address in main memory. This process helps the operating system use memory efficiently.

1. Logical Address Generation

The CPU generates a logical address which is divided into two parts:

Logical Address = Page Number + Offset

In this example, the logical address is 13 bits:

2. Page Table Mapping

The page number is sent to the page table. The page table stores the corresponding frame number where the page is located in RAM.

Example: Page 2 → Frame 2

3. Physical Address Formation

After finding the frame number, the system combines:

Physical Address = Frame Number + Offset

In this example:

4. Accessing Main Memory

Using the physical address, the system accesses the correct frame in main memory and fetches the required data.

Segmentation in memory Management

Segmentation in Operating System (OS) is a memory management technique where a program is divided into smaller logical parts called segments. Segmentation divides a program into logical units such as code, data, and stack segments. Each segment has its own base and limit.
Segmentation means breaking a program into meaningful sections like:

Each part is stored separately in memory.

Working of Segmentation in Operating System

Working of Segmentation in Operating System

Segmentation is a memory management technique where a logical address generated by the CPU is converted into a physical address using a segment table.

Steps Involved

  1. Logical Address from CPU

    • Segment Number (s) = 1
    • Offset (d) = 400
    • Logical Address = (1, 400)
  2. Access Segment Table

    • Base Address = 1800
    • Segment Size = 400
  3. Check Validity

    • Check if Offset ≤ Segment Size
    • 400 ≤ 400 → Valid
    • If offset is greater → Segmentation Fault
  4. Calculate Physical Address

    • Physical Address = Base Address + Offset
    • Physical Address = 1800 + 400 = 2200
  5. Access Physical Memory

    • System accesses memory at address 2200
    • Data is retrieved successfully

Invalid Case

Memory management plays a vital role in the performance and reliability of an operating system. By using techniques such as paging, segmentation, and virtual memory, the OS ensures optimal utilization of limited memory resources.

Visit Our YouTube Channel