Part 3

 Memory Management:
Pyramid of the Memory
Kinds of Memory
Memory Map (Dumping)
Memory Paging
Virtual Memory
Memory Swapping
Memory Segmentation
- Definitions:
Memory refers to devices or recording media that retain (Store) digital data used
for computing for some interval of time.
Memory Management Goals:
Memory Allocation (Multi programs, Data files)
Memory Utilization (Optimization of the memory space)
- Pyramid of the Memory:
It’s a typical memory hierarchy.
Registers, Cache, Main Memory (RAM), Buffer, Electronic Disk (Flash),
Magnetic disk, Optical Disk, Magnetic Tape, Card Punch.
Expensive / Cheap Small / Big Fast /Slow (CPB= Cost Per Bit)
Ideal Memory is Fast, Big and Cheap!
Memory Data Access Types:
RAM Random Access Memory (Main Memory)
DAM Direct Access Memory (Disk)
SAM Sequential Access Memory (Magnetic Tape)
Access Time: Is the time after request till obtaining the data. (Books in Library)
- Kinds of Memory:
Primary storage (Main Memory) RAM
Secondary storage (Auxiliary Memory) Disk
Compare Table:
The program runs in the main memory (RAM) at all.
Buffer and Cache:
Cache is an intermediate memory between CPU and RAM to fill gap of speed.
CPU works ~5 times faster than RAM.
Double Caching uses two caches in parallel.
Buffer is an intermediate memory between RAM and Disk (or I/O devices) to fill
gap of speed.
RAM works ~20 times faster than Disk.
Spooling Technique.
Memory Map (Dumping):
FFFF 65535= 64 KB One Page (1111 1111 1111 1111) 16bit addressing
P1,P2,P3,… (Code Segment, Data Segment)
Mono programming without Swapping or Paging
Offset Address is a virtual address that starts at 0 in beginning of the program
Organizing memory for operating system with one process
Example of running a single Program:
Instruction cycle:
The CPU presents the value of the program counter (PC) on the address bus.
The CPU then fetches the instruction from main memory via the data bus into the
current instruction register (CIR), Then data is placed into the memory data
register (MDR) in same manner.
The Decoder interprets the instruction (Machine Code) into the instruction
register (IR), while the program counter (PC) holds the address of the next
instruction to be executed in memory.
Control unit executes the code inside instruction register (IR). It then passes
the decoded information as a sequence of control signals to the relevant function
units of the CPU to perform the actions required by the instruction such as reading
values from data registers, passing them to the Arithmetic logic unit (ALU) to add
them together and writing the result back to another register (Accumulator).
Memory Paging:
Memory protection: To Lock a part of memory and make it Read Only
Memory Fragmentation:
Avoid of Insufficient memory space Error
(Garbage Collector is a function of OS for Defragmentation)
Virtual Memory:
Unlimited memory space with using Overlay Technique
*.dll dynamic linked library
Commit Charge:
The amount of virtual memory Windows is currently using, as reported in the
Task Manager dialog under the Performance tab. The Commit Charge fluctuates as
applications are opened and closed. TOTAL shows the current amount of virtual
memory used, which is comprised of main memory (RAM) and disk (pagefile).
TOTAL is also graphed in real time on the Page File Usage History chart. PEAK
is the maximum amount this session, while LIMIT is the maximum amount
available unless the pagefile is expanded by Windows.
Memory Swapping:
Swap out: Move unnecessary data (are not accessed for long time) to HD
Swap In: Move back to main memory if there is a request for that block.