You are on page 1of 11

MEMORY

MANAGEMENT
MODULE 3
EARLY SYSTEMS
Memory Management
Memory is the primary and fundamental power,
without which there could be no other intellectual
operation.”

—Samuel Johnson (1709–1784)


Main Memory Management
In charge of main memory
– Random Access Memory (RAM)

Responsibilities include:
– Preserving space in main memory occupied by operating
system
– Checking validity and legality of memory space request
– Setting up memory tracking table
◦ Tracks usage of memory by sections
◦ Needed in multiuser environment
– Deallocating memory to reclaim it
Components of Memory Management
Garbage Collector
- Collection is performed when an allocation failure occurs in heap
lock allocation. Heap lock allocation occurs when the allocation
request cannot be satisfied in the existing cache or memory space.
- If the Garbage Collector cannot find a large enough chunk of free
storage, allocation fails and the Garbage Collector must run a
garbage collection.
- Responsible to perform the deallocation process to release a block
of information or program from the memory so it may be used for
another program.
Allocator
- Responsible for allocating areas of memory for the process/
program.
- The task is small compared to the functions of a garbage collector.
Memory Allocation
 A process by which computer programs and services
are assigned with physical or virtual memory space.
 The process of reserving a partial or complete portion
of computer memory for the execution of programs and
processes.

www.techopedia.com
Types of Memory Allocation Schemes

• Single-User Contiguous
• Fixed Partition
• Dynamic Partition
• Relocatable Dynamic Partition
Single-User Contiguous Scheme:
Program is loaded its entirety into memory and allocated as
much contiguous space in memory as it needs.
Jobs are processed sequentially.
If program is too large— it couldn’t be executed.
• The size of the main memory must be increased or
• the program must be modified to fit.
Requires minimal work by the Memory Manager
Hardware needed:
‣ Register to store the base address
‣ Accumulator to keep track of the program size
Single-User Contiguous Scheme:
Advantages:
Jobs are processed sequentially. Hence the requirement of OS’s work is
minimal.
The OS just need to check if the incoming job fits into the memory
space else reject the job and proceed to the next incoming job.
Disadvantages:
Only one job or program is loaded in to memory at any point of time.
All available memory is allocated to a job.
Memory sharing is not possible among jobs.
Even though there is a space to accommodate the waiting jobs, it is not
possible to accommodate more than one job.
Does not support multi-programming
Not cost effective, as it serves the purpose of only one user at a time.
Single-User Contiguous Scheme:
The Memory Manager
1. Evaluates the incoming job to see if it fits the memory
space.
◦ If it fits, load into memory. Otherwise, reject and evaluate
the next process.
2. Monitors the occupied memory space.
◦ When the resident job ends its execution and no longer
needs to be in memory, indicate that the entire amount of
main memory space is now available and return to Step 1
(evaluate the next incoming job).
Memory Allocation
Memory Capacity = 200K

Jobs Allocation Partition Size

OS 10K

Job1 (40K) 40K

Unused Space 150K


PL-M3: ACT5: Single-User Contiguous Scheme
1. Display the activity title and your name.
2. Input the following: (in k unit – integer/float)
◦ Memory size
◦ OS size
3. Input the numbered 6 jobs, place them in an array and then display the job list.
4. Load OS in the memory. Memory is divided into 3 sections, namely: OS, job
loaded, and unused space.
5. Allocate and deallocate memory for the jobs in sequence, one after the other.
Consider a pause for each job loaded and determine if the memory was allocated
or not. Display an appropriate message/alert for the results. Display also the
unused memory size for each job.
:Example
OS (10k), J1(40k), unused(150k)
Memory for J1 was successfully allocated.

6. Provide your conclusions. How many jobs was considered for memory allocation?

You might also like