Unformatted text preview:

OS Memory ManagementPowerPoint PresentationProcess State DiagramWorking SetProcess SchedulingManaging PagesVirtual MemoryVirtual Memory (V.M.)Addressing and VMVM and PerformanceMemory MgtCSIS 4490 n-Tier Client/ServerDr. HogansonOS Memory Management•Memory Management is a critical function of an OS•Failure to correctly manage memory causes many “crashes”–Corrupted memory–Running out of memory–Failure to reclaim free memory–Invalid memory access–Historic Microsoft problems, while LINUX and other OS avoid problems with memory managementMemory MgtCSIS 4490 n-Tier Client/ServerDr. Hoganson•Single process in memory – simple memory management•Not efficient – CPU wastes time while process does Input/Output•Many processes share memory – better use of CPU and other components – less wasted time waiting for I/O•How to share memory between processes?•Divide memory into pages of fixed size•Processes are allocated memory in pagesMemory MgtCSIS 4490 n-Tier Client/ServerDr. HogansonProcess State DiagramRunningReady for CPUWaiting for I/OSchedulerDispatcherNewDoneInterruptWait for I/OI/O donePg 243 in StallingsMemory MgtCSIS 4490 n-Tier Client/ServerDr. HogansonWorking Set•Each program consists of a set of pages of memory•Process is a running program•Each process needs only a subset of its pages at any one time•This subset is called the “Working Set” – the set of pages the process is working with at that time•So, the entire program does NOT need to be in the computers memory in order to run the program•So, available memory can be used for other program’s working sets•CPU can multitask between programs just by changing from one set of pages to another•Improved efficiency and performanceMemory MgtCSIS 4490 n-Tier Client/ServerDr. HogansonProcess Scheduling•Scheduler: Part of OS that determines which process in the ready queue will be executed next by the CPU•Dispatcher: Part of OS that switches the CPU from one process to the next•Context Switch: A switch from one process to another. The CPU changes from one context (the memory space and register contents of a process) to another.•Time to run the scheduler and do the context switch is overhead•These need to be fast and efficient algorithmsMemory MgtCSIS 4490 n-Tier Client/ServerDr. HogansonManaging Pages•Which pages to keep in memory – the ones currently being used plus the ones most likely to be needed in the near term•Similar strategy to caching•Need to track the most recently used pages•When a new page must be loaded in, unload the least recently used page•The size of the computer’s memory with the size of the applications determines the number of process working sets that can be in the computer’s memory at a time•Which determines utilization, efficiency, and performanceMemory MgtCSIS 4490 n-Tier Client/ServerDr. HogansonVirtual Memory•Memory limits performance in a multi-tasking system•Virtual memory is a technique used to make a system operate as if it has more real memory than it actually has.–More processes “ready” for execution – performance and efficiency–Allows processes with working sets that are larger than the computer’s real memory to run•Virtual memory uses Secondary Storage (disk) memory to emulate real memory•Works like a cache system: real memory is like the cache, disk storage is the slower memory•The virtual memory space can be many times larger than all of real memory.Memory MgtCSIS 4490 n-Tier Client/ServerDr. HogansonVirtual Memory (V.M.)•Establishes a two-level scheduling system•Groups of process working sets are moved between VM and real memory (high level of scheduling – long term queue)•Multiple groups of process working sets in VM•The CPU is switched between processes within real memory (lower level of scheduling – short term queue)•Ideally, a group of processes that are switched between VM and real memory should be balanced in terms of the CPU and I/O work required.Memory MgtCSIS 4490 n-Tier Client/ServerDr. HogansonAddressing and VM•Physical Memory Address: page number + offset within page•Logical Memory Address: virtual page number + offset within page•CPU sends out Logical Addresses (virtual addresses)•Logical Addresses must be translated to Physical Addresses•Uses a page table for lookup and substitutionPage OffsetPage OffsetLogicalPhysicalPage TableReal memoryPg 253 in StallingsMemory MgtCSIS 4490 n-Tier Client/ServerDr. HogansonVM and Performance•Note that each address must now be translated – logical page replaced with physical page•Means two memory accesses instead of one (lookup in page table)•Solution: use a small cache just for page table translations:Translation Lookaside Buffer (TLB)•Translation overhead is very small•TLB buffers are integrated on the CPU


View Full Document

KSU CSIS 4490 - Memory Management

Download Memory Management
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Memory Management and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Memory Management 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?