Explain the concept of a bare machine and the need for a resident monitor.
Lecture Notes
Main content
Foundations of Memory Management
These notes explain the early and important ideas of memory management:
basic bare machine, resident monitor,
multiprogramming with fixed partitions,
multiprogramming with variable partitions,
protection schemes, and
internal and external fragmentation.
These topics form the base for understanding modern memory-management methods such as paging and virtual memory.
Bare MachineResident MonitorFixed PartitionsVariable PartitionsProtectionFragmentation
1. Basic Bare Machine
1.1 Meaning
A basic bare machine refers to an early computer system with almost no sophisticated operating-system support for memory management.
A user program is loaded directly into memory and executed there with very little abstraction. The uploaded note describes memory here as almost one raw physical space, with weak or no memory protection and usually only one job running at a time.
Main idea: A bare machine is close to raw hardware operation, with minimal OS control and no advanced memory-management support.
1.2 Characteristics
Simple hardware and simple OS support
No virtual memory
No relocation flexibility
Very weak or no memory protection
Usually only one job runs at a time
1.3 Limitation
The main drawback is poor CPU utilization. If the only running program waits for I/O, the CPU remains idle.
That makes the system inefficient and unsuitable for multiprogramming.
2. Resident Monitor
2.1 Meaning
A resident monitor is an early operating-system component that stays permanently in memory and controls the execution of jobs.
It was introduced to automate job sequencing and reduce manual intervention.
2.2 Why it was introduced
In bare-machine systems, loading and running jobs required almost manual control.
The resident monitor improved this by remaining in memory and taking charge of loading jobs, passing control to them,
and regaining control when they finished or requested I/O.
2.3 Main functions
Stays in a fixed region of memory
Loads jobs one after another
Transfers control to the user program
Regains control after program termination or I/O request
Maintains simple job sequencing
Important: The resident monitor improved control and job sequencing, but it was still not true multiprogramming.
3. Multiprogramming with Fixed Partitions
3.1 Meaning
In fixed partitioning, main memory is divided into a fixed number of partitions before execution begins.
Each partition can hold one process at a time. Several jobs may be loaded into memory together, and if one waits for I/O,
the CPU can switch to another.
3.2 Types
Equal-size partitions – all partitions have the same size
Unequal-size partitions – partitions have different sizes so larger jobs may fit into larger partitions
3.3 Advantages
Simple to implement
Supports multiprogramming
Improves CPU utilization compared with single-job systems
3.4 Disadvantages
Internal fragmentation occurs
Degree of multiprogramming is limited by the number of partitions
A process larger than the biggest partition cannot be loaded
Example
Suppose memory has four fixed partitions of 100 KB each.
Job A = 70 KB → 30 KB wasted
Job B = 95 KB → 5 KB wasted
This wasted space inside the allocated partition is internal fragmentation.
Figure 3: Fixed partitioning divides memory in advance into fixed blocks.
4. Multiprogramming with Variable Partitions
4.1 Meaning
In variable partitioning, memory is not predivided into fixed blocks. Instead, partitions are created dynamically
according to the size of the arriving process.
4.2 Working
Initially, available memory is one large free block.
When a process arrives, the OS allocates a suitable chunk.
The remaining free memory forms one or more holes.
When a process finishes, its memory is released and becomes a hole.
A hole is a free block of memory available for allocation.
4.3 Allocation strategies
Strategy
Rule
First Fit
Allocate the first hole large enough
Best Fit
Allocate the smallest hole that is sufficient
Worst Fit
Allocate the largest available hole
4.4 Advantages
Better memory utilization than fixed partitioning
Less internal fragmentation
More flexible for different process sizes
4.5 Disadvantages
External fragmentation occurs
Memory management becomes more complex
Compaction may be required
Compaction: Moving processes in memory so scattered holes combine into one large free block.
One-line difference: Fixed partitioning wastes space inside partitions, while variable partitioning wastes space between partitions.
6. Protection Schemes
6.1 Why protection is needed
Memory protection ensures that:
one process does not overwrite another process,
user programs do not access OS memory,
illegal memory access is detected and trapped.
6.2 Fence Register
A fence register stores a boundary address. Memory below the fence may be reserved for the OS,
and user programs may access only memory above the fence.
This is simple but too limited for complex multiprogramming.
6.3 Base Register and Limit Register
This is the classic contiguous-memory protection scheme.
Base register – starting physical address of the process
Limit register – size of the process memory space
If logical address < limit, then physical address = base + logical address
Otherwise, trap to operating system
Example
Base = 3000, Limit = 500
Allowed logical addresses: 0 to 499
If the program generates logical address 520, access is illegal and a trap occurs.
6.4 Protection bits
Memory blocks, pages, or segments may have permission bits such as:
Read
Write
Execute
For example:
code segment → read + execute
data segment → read + write
some pages → read only
6.5 Key / lock mechanism
In some schemes, a memory block is tagged with a key or lock value, and a process can access it only if its key matches.
Important: Protection is essential for system stability. Without it, one faulty process can corrupt the whole system.
7. Internal and External Fragmentation
7.1 Internal Fragmentation
Internal fragmentation means unused memory exists inside an allocated block.
Example
Partition size = 100 KB, process size = 72 KB
Internal Fragmentation = 100 − 72 = 28 KB
Internal fragmentation is common in:
fixed partitioning
paging (especially the last page)
7.2 External Fragmentation
External fragmentation means total free memory exists, but it is scattered into small holes,
so a large required block cannot be allocated contiguously.
Example
Free holes: 10 KB, 8 KB, 12 KB
Total free memory = 30 KB, but there may still be no single 25 KB block available.