1 / 23

CSI 400/500 Operating Systems Spring 2009

CSI 400/500 Operating Systems Spring 2009. Lecture #8 – Memory Management February 23 rd through 25 th , 2009. Memory Hierarchy. Primary. Secondary. External. Primary Memory. Used by processors and running processes Includes: Registers – holds operation data for processor

Télécharger la présentation

CSI 400/500 Operating Systems Spring 2009

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. CSI 400/500 Operating SystemsSpring 2009 Lecture #8 – Memory Management February 23rd through 25th, 2009

  2. Memory Hierarchy Primary Secondary External

  3. Primary Memory • Used by processors and running processes • Includes: • Registers – holds operation data for processor • Cache – holds immediate storage for process • RAM – processing address space

  4. Secondary Memory • Memory not allocated to processors or tasks • Includes “virtual memory”, which is extended memory for tasks containing data not currently being used • Used to store data for extended periods of time • Examples: hard drive, disks, flash drives

  5. External Memory • Storage device external to computer • Located on network, either local or wide • Examples: database server, web page

  6. Memory Manager • Component of Operating System that handles allocation, loading, reading, writing, and clearing of primary and secondary memory • Resolves references and/or calls to external data

  7. Memory Manager Tasks

  8. Loading • Copying process data stored in RAM or secondary memory into cache memory • “Page loading” • Reading external data and loading into cache memory • “Remote accessing”

  9. Binding • Process of translating virtual address into physical address • Most programs use more storage than cache can hold, so virtual address refers to RAM location without needing extremely long address • Address can still fit into register • Allows for continual extension of “onboard” memory space

  10. Saving • Restore data to secondary memory • “Reallocation” • Write data to external memory • “Uploading”

  11. Allocation • Distributing memory among processes • Process’ available space called “address space” • Three main techniques: • Fixed-Partition • Variable-Partition • Dynamic

  12. Fixed Partition Allocation • Called pages • System has predetermined page size • Only one page per process in cache at a time • Common in batch and time-share systems

  13. How Paging Works • Process allocated a page • Data is filled in from start to end • New data added to end of last data block, allowing for data boundaries • If page fills, new page is allocated • Pages tracked with Page Table • We’ll discuss that in a few sessions

  14. Internal Fragmentation • If data freed during process, Memory Manager will attempt to reuse • Desired data must be same size or smaller • Could leave “holes” on page, called “internal fragmentation” • Internal fragmentation cleared by page reallocation • Copies existing data to new page, then clearing old page

  15. Variable Partition Allocation • Called segments • Memory Manager obtains storage as process produces data or needs external data • All current processes share memory • Each process has its own piece of memory • Common in Client-Server systems

  16. How Segmentation Works • System starts with blank page • Processes are created and queued • Initial data for each process allocated a segment • Segments contiguous in storage • New segments added if processes created or processes demand more

  17. External Fragmentation • As processes release data or processes complete, data is freed • System tries to reuse data • Request must be at most same size • Could leave “holes” called “external fragmentation” • Freed storage too small to use at current time • Most systems maintain a Free Space table to track these fragments

  18. Defragmentation • Also called “dynamic relocation” • Moving segments to fill external fragments • Logical addresses reset using dynamic binding • We’ll discuss that with dynamic allocation

  19. Dynamic Allocation • Process allowed to specify and change size of its storage • If that much space is not available, process held until space is available • Often requested storage obtained in chunks, using multiple free space fragments • Space chained together via linked list

  20. Dynamic Binding • Memory Manager can move segment around as process executes • All process data referenced by symbol name • Variable name if defined, or system-created name • Process maintains Symbol Table to resolve reference • Dynamic Binding means Memory Manager resolves to new physical address when process references data

  21. How Dynamic Binding Works • When data placed in segment, entry added to symbol table • Entry is offset in segment • Processor has Relocation Register • Contains start address of segment • Segment moves due to dynamic relocation • Address in relocation register changes • Subsequent reference resolves to new physical location

  22. Swapping • Process of saving process’ current address page to secondary storage and loading new address page • Process is blocked during this time, as execution requires new data

  23. Swapping Process • Process requests non-resident data • Processor blocks process and sends I/O interrupt • Interrupt Handler contacts Memory Manager with data reference • Memory Manager swaps out current page, finds new page, and swaps it in • Tells Interrupt Handler it is done • Interrupt Handler releases process to Ready queue

More Related