Operating Systems/Memory Management
Memory Management Algorithms[edit | edit source]
There are four memory management algorithms.
- First-Fit: A chunk of data is put in the first available block of memory that is big enough for the data to fit.
- Next-Fit: A modification of First-Fit, for which the search space starts from where the last process was placed instead of the beginning of the memory. When the end of the memory is reached while searching, searching starts from the beginning of the memory all over again.
- Best-Fit: A chunk of data is put into the absolutely smallest available block of memory that can still fit the data.
- Worst-Fit: A chunk of data is put into the largest available block of memory. This is the opposite of the Best-Fit algorithm.
Memory Paging[edit | edit source]
Paging, put simply is when data is moved between the disk and ram. In some cases this may be done if a piece of data has not been touched in a while, so, to free up ram the operating system takes the unused data, and puts it in a special page file, essentially "unloading it". This is called paging out memory. How ever, if a program asks for the memory back, it has to be "paged in". Paging in is when you take requested data and move it back it to ram.