1 / 16

Linux Vs. Windows NT Memory Management Hitesh Kumar

Linux Vs. Windows NT Memory Management Hitesh Kumar. 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.

brooklyn
Télécharger la présentation

Linux Vs. Windows NT Memory Management Hitesh Kumar

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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 0 Linux Address Space

  5. Address Generation In x86 • x86 provides the support forboth 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. Logical Address Selecter offset Linear Address Space Linear Address segment Lin Addr Dir Table offset Global Desc. Table 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. 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. 4GB Kernel space 2GB User Space 0 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 Table Page frame database Valid Modified Free Standby Valid Free PTE PTE PTE Page Frame Database

More Related