Professional Documents
Culture Documents
Term Frame
Page
Fixed-length block of data in secondary memory (e.g. on disk). Variable-length block of data that resides in secondary memory.
Segment
Relocation
Protection
Processes need to acquire permission to reference memory locations for reading or writing purposes Location of a program in main memory is unpredictable Memory references generated by a process must be checked at run time Mechanisms that support relocation also support protection
A pair of base and limit registers define the logical address space
Sharing
Advantageous to allow each process access to the same copy of the program rather than have their own separate copy Memory management must allow controlled access to shared areas of memory without compromising protection Mechanisms used to support relocation support sharing capabilities
Shared Library
Logical Organization
Memory management brings processes into main memory for execution by the processor involves virtual memory based on segmentation and paging Partitioning used in several variations in some now-obsolete operating systems does not involve virtual memory
Fixed Partitioning
Equal-size partitions any process whose size is less than or equal to the partition size can be loaded into an available partition The operating system can swap out a process if all partitions are full and no process is in the Ready or Running state
When we set the upper limit of PC-DOS at 640K, we thought nobody would ever need that much memory. William Gates, chairman of Microsoft, April 29, 1985 issue of InfoWorld.
A program may be too big to fit in a partition program needs to be designed with the use of overlays Main memory utilization is inefficient any program, regardless of size, occupies an entire partition internal fragmentation wasted space due to the block of data loaded being smaller than the partition
Using unequal size partitions helps lessen the problems programs up to 16M can be accommodated without overlays
partitions smaller than 8M allow smaller programs to be accommodated with less internal fragmentation
The use of fixed partitioning is almost unknown today. One example of a successful operating system that did use this technique was an early IBM mainframe operating system, OS/ MFT ( Multiprogramming with a Fixed Number of Tasks).
Memory Assignment
Discussions: 1. Waste of memory for one Q per Par 2. For single Q, when it comes to decide which Par to swap out, what would be your choice?
The number of partitions specified at system generation time limits the number of active processes in the system Small jobs will not utilize partition space efficiently
Partitions are of variable length and number Process is allocated exactly as much memory as it requires This technique was used by IBMs mainframe operating system, OS/MVT (Multiprogramming with a
Variable Number of Tasks).
Dynamic Partitioning
Placement Algorithms
If there is more than one free block of memory of sufficient size, then the operating system must decide which free block to allocate.
Buddy System
Comprised
schemes
Space
Memory
T r e e
R e p r e s e
n t a t i o n
If two buddies are leaf nodes, then at least one must be allocated; otherwise they would be fused into a larger block
A modified form of the buddy system is used for UNIX kernel memory
Addresses
The resulting address is compared to the value in the bounds register. If the address is within bounds, then the instruction execution may proceed. Otherwise, an interrupt is generated to the operating system, which must respond to the error in some fashion.
Partition memory into equal fixed-size chunks that are relatively small Process is also divided into small fixed-size chunks of the same size
Page Table
Maintained by operating system for each process Contains the frame location for each page in the process Processor must know how to access for the current process Used by processor to produce a physical address
Data Structures
Logical Addresses
Paging Hardware
Segmentation
A
program can be subdivided into segments may vary in length there is a maximum length consists of two parts:
segment number an offset
Addressing
Similar
Eliminates internal
Segmentation
Memory-management scheme that supports user view of memory A program is a collection of segments. A segment is a logical unit such as:
main program, procedure, function, method, object, local variables, global variables, common block, stack, symbol table, arrays
8.39
8.40
Example of Segmentation
8.41
Base
42
Security Issues
Security threat related to memory management Also known as a buffer overrun Can occur when a process attempts to store data beyond the limits of a fixed-sized buffer One of the most prevalent and dangerous types of security attacks
Summary
Memory Management
one of the most important and complex tasks of an operating system needs to be treated as a resource to be allocated to and shared among a number of active processes desirable to maintain as many processes in main memory as possible desirable to free programmers from size restriction in program development basic tools are paging and segmentation (possible to combine)