Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Os Linux

3,756 views

Published on

OS Linux Case Study

Published in: Technology, News & Politics
  • Be the first to comment

Os Linux

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

×