Computer Science, asked by aishu5165, 1 year ago

Why portion of a program can be placed anywhere in physical memory without memory allocation

Answers

Answered by Anonymous
0

Memory Management

Is the task carried out by the OS and hardware to accommodate multiple processes in main memory

If only a few processes can be kept in main memory, then much of the time all processes will be waiting for I/O and the CPU will be idle

Hence, memory needs to be allocated efficiently in order to pack as many processes into memory as possible

In most schemes, the kernel occupies some fixed portion of main memory and the rest is shared by multiple processes

Memory Management Requirements

Relocation (Figure 7.1)

programmer cannot know where the program will be placed in memory when it is executed

a process may be (often) relocated in main memory due to swapping

swapping enables the OS to have a larger pool of ready-to-execute processes

memory references in code (for both instructions and data) must be translated to actual physical memory address

Protection

processes should not be able to reference memory locations in another process without permission

impossible to check addresses at compile time in programs since the program could be relocated

address references must be checked at run time by hardware

Sharing

must allow several processes to access a common portion of main memory without compromising protection

cooperating processes may need to share access to the same data structure

better to allow each process to access the same copy of the program rather than have their own separate copy

Logical Organization

users write programs in modules with different characteristics

instruction modules are execute-only

data modules are either read-only or read/write

some modules are private others are public

To effectively deal with user programs, the OS and hardware should support a basic form of module to provide the required protection and sharing

Similar questions