* TM2033
Platform Technology
Memory Management
Dr Nazatul Aini Abd Majid
[email protected] *
* To understand operating system fundamental
concepts and algorithms based on those used in
the industry including Windows and Linux.
*
* Uni-program
* Memory split into two
* One for Operating System (monitor)
* One for currently executing program
* Multi-program
* “User” part is sub-divided and shared among active
processes
*
* OS needs to manage memory:
* Memory management determines if it is possible to
load programs and data into memory and if so where
in memory
* Optimize the use of memory. This could be
prevented:
*
*How memory management
manage the memory?
*
* Content
* Why swapping is needed?
* What is swapping?
* What is paging?
* What is virtual memory
* Summary
* Quiz 2
*
* Problem: I/O is so slow compared with CPU. Even in
multi-programming system, CPU can be idle most of
the time
* Solutions:
* Increase main memory
* Expensive
* Leads to larger programs
* Swapping
*
* Content
* Why swapping is needed?
* What is swapping?
* What is paging?
* What is virtual memory
* Summary
* Quiz 2
*
* Long term queue of processes stored on disk
* Processes “swapped” in as space becomes available
* As a process completes it is moved out of main memory
* ISSUE: If none of the processes in memory are ready (i.e.
all I/O blocked)
*
* Swap out a blocked process to intermediate queue
* Swap in a ready process or a new process
* Therefore, the cpu will not idle for long
*
*How if a user wants to run a
program bigger than the size of
main memory?
* use virtual memory paging is one of the important
concept in virtual memory.
*
* Content
* Why swapping is needed?
* What is swapping?
* What is paging?
* What is virtual memory
* Summary
* Quiz 2
*
* Split memory into equal sized, small chunks -page
frames
* Split programs (processes) into equal sized small
chunks - pages
* Allocate the required number page frames to a
process
* Operating System maintains list of free frames
* Use page table to keep track
*
*
* Content
* Why swapping is needed?
* What is swapping?
* What is paging?
* What is virtual memory
* Summary
* Quiz 2
*
*
* Demand paging
* Do not require all pages of a process in memory
* Bring in pages as required
* Virtual memory = Main memory (RAM) + Part of Hard disk
* We do not need all of a process in memory for it to run
* We can swap in pages as required
* So - we can now run processes that are bigger than total
memory available!
*
* Page fault
* Required page is not in memory
* Operating System must swap in required page
* May need to swap out a page to make space
* Select page to throw out based on recent history
* Thrashing
* Too many processes in too little memory
* Operating System spends all its time swapping
* Little or no real work is done
* Disk light is on all the time
* Solutions
* Good page replacement algorithms
* Reduce number of processes running
* Fit more memory
*
* Content
* Why swapping is needed?
* What is swapping?
* What is paging?
* What is virtual memory
* Summary
* Quiz 2
Dr Nazatul Aini Abd Majid
[email protected]