Lecture 6 After Mid
Lecture 6 After Mid
Basic Concept
• CPU executes the program
• Directly connected with registers and cache
memory
• Also connected with RAM
• And there is a secondary memory.
• Secondary is not connected directly with CPU as
it slower.
• And to execute a program we have to bring
them in Ram for execution from secondary.
Basic Concepts
• Selection of memory-management method for a specific
system depends on many factors especially on the hardware
design of the system. Recent designs have integrated the
hardware and operating system.
• The CPU fetches instructions from memory according to the
value of its program counter and other memory management
registers such as segment registers in Intel CPUs.
• A typical instruction-execution cycle, e.g., first fetches an
instruction from memory, which is then decoded and
executed. Operands may have to be fetched from memory.
After the instruction has been executed, the results are stored
back in memory.
• Increasing the RAM size or cache and registers increase cost
of the system
Memory Hierarchy
• The memory hierarchy includes:
• Very small, extremely fast, extremely expensive, and volatile
CPU registers
• Small, very fast, expensive, and volatile cache
• Hundreds of megabytes of medium-speed, medium-price,
volatile main memory
• Hundreds of gigabytes of slow, cheap, and non-volatile
secondary storage
• Hundreds and thousands of terabytes of very slow, almost free,
and non-volatile
Internet storage (Web pages, Ftp repositories, etc.)
Memory Management
• The purpose of memory management is to ensure
• fair,
• secure,
• orderly, and
• efficient use of memory.
• The task of memory management includes keeping track of used and free
memory space, as well as when, where, and how much memory to allocate and
de-allocate.
• It is also responsible for swapping processes in and out of main memory.
• Degree of Multi-programming.
• When processes are brought from secondary storage to RAM bring more
processes to enhance CPU utilization.
• A process will use either CPU or I/O unit and if only one process is in memory
and it needs to perform I/O that time CPU will sit idle and efficiency will be drop.
Source to Execution
• Compile/Assemble
↓
• Link
↓
• Load
↓
• Execute
Address Binding
• Usually a program resides on a disk as a binary executable
or script file. The program must be brought into the
memory it to be executed. The collection of processes that
is waiting on the disk to be brought into the memory for
execution forms the input queue.
• The normal procedure is to select one of the processes in
the input queue and to load that process into the memory.
As the process is executed, it accesses instructions and data
from memory. Eventually the process terminates and its
memory space is become available for reuse.
Address Binding
• Compile time: if you know at compile where the process will
reside in memory, the absolute addresses can be assigned to
instructions and data by the compiler.
• Load time: if it is not known at compile time where the
process will reside in memory, then the compiler must
generate re-locatable code. In this case the final binding is
delayed until load time.
• Execution time: if the process can be moved during its
execution from one memory segment to another, then
binding must be delayed until run time. Special hardware
must be available for this to work.
Logical- Versus Physical-Address Space