The Codex of Business Writing Software for Real-World Solutions 2.pptx
Os Linux
1. Linux Memory Management Case Study : Operating System Muhammad Ather Rasool IS/17115/Aut-07/M Muhammad Muzammil IS/17104/Aut-07/M Muhammad Zahid Majeed IS/17105/Aut-07/M Federal Urdu university of Arts, Science & Technology,.
2. Introduction: Linux is a UNIX like system that has gained popularity in recent years. Development begins in 1991. Two different GUI (GNOME & KDE) for Linux. In early days, Linux development revolved around central OS kernel. Linux kernel: Is an entirely original piece of SW developed from scratch by the Linux community.
3. Components of Linux Memory Two Components Physical memory: kernel is loaded in memory rest of memory is available for user pages Allocate and free physical memory pages Virtual Memory: Each Linux process on a 32 bit get 3 GB for virtual addressing Remaining 1 GB reserve for its Page Table and kernel data Frequently accessed pages will be on the "hot" list Free pages will be on the "cold" or "free" list
4. Paging Page Size: Intel 4 KB, Alpha 8 KB Linux kernel is the page allocator Each process has its own page table The entire page table may take up too much main memory Page tables are also stored in virtual memory When a process is running, part of its page table is in main memory
5. Fetch Policy Linux use a demand paging With no preparing And no working set concept There is a system call in which user can give a hint that a certain page may be needed soon Demand paging
6. Linux Memory Management Three level page table structure Page directory Page middle directory Page table 6
8. Placement Policy All page frames are grouped into 10 lists of blocks that contain groups of 1, 2, 4, 8, 16, 32,64, 128, 256, and 512 contiguous page frames respectively If a small area is needed and only a larger area is available, the larger area is split into two Halves (buddies), possibly repeatedly When a block is released, the kernel attempts to merge together pairs of free buddy Buddy Algorithm
9. Buddy Algorithm problem Linux manages memory using the buddy algorithm. The algorithm leads to the internal fragmentation because if we want 65 page chunks w required 128 page chunks For this problem to solve Linux has a second memory allocation which manages smaller units separately
11. Replacement Policy Paging system can divided into two sections First policy algorithm decides which pages to write out to disk, and when to write them. Second the paging mechanism carries out the transfer and pages data back into physical memory when they are needed again. Under Linux a clock is used, and every page has an age that is adjusted on each pass of the clock Age is measure of youthfulness of pages
12. Clock Algorithm – Another Implementation of Second Chance Order pages in circular list “Hand” of the clock points to the page to be replaced currently When required to evict a page If page pointed to has R=0, then evict it If R=1, then reset R and move hand forward Clock algorithm can be used with NRU (decision based on both R and M bits)
14. Replacement Scope Local replacement policy – chooses only among the resident pages of the process that generated page fault in selecting a page to replace Global replacement policy – considers all unlocked pages in main memory as candidates for replacement, regardless of which process owns a particular page Global policies are more attractive because of the simplicity of implementation and minimal overhead
15. References Picture: Fig 1:operating System 4th Edition by William Stalling Fig 2:Modern operating Systems 2nd Edition by A Tanenbaum. Fig 3:operating System 4th Edition by William Stalling Text: Modern operating Systems 2nd Edition by A Tanenbaum. operating System 4th Edition by William Stalling