Download presentation
Presentation is loading. Please wait.
Published byKory Murphy Modified over 9 years ago
1
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
2
very small very large very fast very slow volatile non-volatile
3
Based on the von Neumann architecture, data and program instructions exist in physical memory Repeatedly perform fetch-decode-execute cycles The execute part often results in data fetch and store operations physical memory
4
Locations in memory are identified by memory addresses When compiled, programs consist of relocatable code Other compiled modules also consist of relocatable code symbolic addresses in source code relative addresses in object code
5
At load time, any additional libraries also consist of relocatable code physical addresses generated by loader
6
At run time, memory addresses of all object files are mapped to a single memory space in physical memory
7
Using dynamic loading, external libraries are not loaded when a process starts Libraries are stored on disk in relocatable form Libraries loaded into memory only when needed Using dynamic linking, external libraries can be preloaded into shared memory When a process calls a library function, the corresponding physical address is determined
8
Main memory is partitioned and allocated to resident operating system and user processes fixed partitioning scheme
9
A pair of base and limit registers define the logical address space Also known as relocation registers
10
The CPU generates logical memory addresses A Memory-Management Unit (MMU) maps logical memory addresses to the physical address space User programs never see physical memory addresses
11
Hardware protects against memory access outside of a process’s valid memory space
12
Variable-length or dynamic partitions: When a new process enters the system, the process is allocated to a single contiguous block The operating system maintains a list of allocated partitions and free partitions OS Process 5 Process 8 Process 2 OS Process 5 Process 2 OS Process 5 Process 2 Process 9 OS Process 5 Process 9 Process 2 Process 1
13
How can we place new process P i in memory? First-fit algorithm: allocate the first free block that’s large enough to accommodate P i Best-fit algorithm: allocate the smallest free block that’s large enough to accommodate P i Next-fit algorithm: allocate the next free block, searching from last allocated block Worst-fit algorithm: allocate the largest free block that’s large enough to accommodate P i
14
Memory is wasted due to fragmentation, which can cause performance issues Internal fragmentation is wasted memory within a partition or process memory External fragmentation can reduce the number of runnable processes ▪ Total memory space exists to satisfy a memory request, but memory is not contiguous OS Process 5 Process 8 Process 2 Process 3 Process 6 Process 12 Process 7 Process 9
15
Process 3 Process 6 Process 12 Process 7 Reduce external fragmentation by compaction or defragmentation Rearrange memory contents to organize all free memory blocks together into one large contiguous block Compaction is possible only if relocation is dynamic and is done at execution time Compaction is expensive OS Process 5 Process 8 Process 2 Process 9 Process 3 Process 6 Process 12 Process 7 Process 3 Process 6 Process 12 Process 7 Process 9
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.