Presentation is loading. Please wait.

Presentation is loading. Please wait.

Linux Vs. Windows NT Memory Management Hitesh Kumar

Similar presentations


Presentation on theme: "Linux Vs. Windows NT Memory Management Hitesh Kumar"— Presentation transcript:

1 Linux Vs. Windows NT Memory Management Hitesh Kumar

2 Introduction Linux and Windows NT use Virtual Memory with paging.
The memory management is platform independent. These platforms provide the support for paging with varying levels of page tables. The platform chosen for explanation is Intel Pentium/x86.

3 Linux Memory Management
Linux uses two separate memory management schemes like SVR4 and Solaris. These Two Schemes are: a. Virtual memory management for user process. b. Kernel memory management for the use of Kernel. The complete 4GB memory(linear address space of Pentium /x86) is divided into two parts. The first 0-3GB(0 x BFFF FFFF) is used for user process. The next 3GB to 4GB part is used for the kernel.

4 4GB Kernel space 3GB User Space Linux Address Space

5 Address Generation In x86
x86 provides the support for both Segmentation and Paging. Maximum Segment Size is 4GB; the complete linear address space of the processor. Smaller size segments are created by specifying limit field. Logical Address 1. Logical address must be provided to locate a byte, which is the combination of segment selector and offset.

6 Continue 2. Segment Selector selects the segment descriptor, a data structure which contains the base address of the segment. Linear Address 1.The offset is added into the base address to create the linear address of the byte. Physical Address 1. If paging is not enabled then linear address is directly used to access the byte in the physical memory. 2. If paging is enabled then linear address is broken into 3 parts: Page Directory(10), Page Table(10), Offset(12). 3. The page size is 4KB.

7 Segmentation and Paging In x86
Logical Address Selecter offset Linear Address Space Linear Address segment Lin Addr Global Desc. Table Dir Table offset Physical Address Space Segment Descriptor Page Phy Addr. Page Dir Page Table Entry Entry Segmentation and Paging In x86

8 How Linux Uses This? Uses Flat Memory Model.
All the segments in the user space are of 3GB. The segment in kernel space are of 1GB and start from 3GB. Each process contains its own page directory and maps the full 4GB space. The kernel mode is entered by switching the segments from user space to kernel space.

9 Continue Linux uses three level page table structure:
1. PAGE GLOBAL DIRECTORY. 2. PAGE MIDDLE DIRECTORY. 3. PAGE TABLE. The software handling middle level does nothing on x86. Page Replacement Algorithm Linux uses second chance clock algorithm for page replacement, means uses one bit.

10 Physical Memory Management
Linux uses zone allocator to allocate the physical pages of memory. Memory is divided into zones for different purposes like DMA. Memory from each zone is allocated in 2n –paged size blocks , by using Buddy system .

11 Kernel Memory Management
Kernel does frequent memory allocation for small sized objects. Only zone allocator is inefficient for this. The idea of “Object Caching” is used, because most of the time is wasted in initialization and destruction of objects. Slab allocator is used for dividing the 2n - paged blocks into small buffers.

12 Slab Layout Kmem slab Kmem bufctl Kmem bufctl Kmem bufctl buf buf buf
unused Slab Layout

13 Windows NT Memory Management
Like Linux, it divides the memory into two parts. 2GB is allocated for user space and 2GB is used for kernel space. The address generation scheme is same as of Linux.

14 Windows NT Address Space
4GB Kernel space 2GB User Space Windows NT Address Space

15 Page Frame States Page-Frame States 1. Valid 2. Modified. 3. Standby
4. Free 5. Zeroed 6. Bad.

16 Page Frame Database Page Table Page frame database Valid Modified PTE
Free Standby PTE PTE Page Frame Database


Download ppt "Linux Vs. Windows NT Memory Management Hitesh Kumar"

Similar presentations


Ads by Google