Related: Architecture · Simulation Engine
The simulator reads a UTF-8 plain-text configuration file that fully defines a simulation:
- Memory size and minimum allocation unit
- Pre-existing memory state at tick 0 (optional)
- Processes to be allocated
Copy this, fill in your values, and load it.
// -------------------------------------------------------
// Memory Manager Simulator — configuration template
// -------------------------------------------------------
// Separators: comma or space (both work, pick one and stick to it)
// Comments: // anywhere — full line or inline
// -------------------------------------------------------
[config]
SIZE, 1000 // total memory in KB (required)
ALIGN, 100 // memory alignment granularity in KB (required)
// -------------------------------------------------------
// [initial] is optional.
// Remove this section entirely to start with a single
// free hole that covers all of SIZE.
//
// One entry per line:
// <size> → free hole
// <ID>, <size> → occupied block (process already in memory)
// * → free hole that fills remaining space to SIZE
//
// All blocks must sum to SIZE exactly (use * to avoid counting).
// -------------------------------------------------------
[initial]
100
P1, 200
P2, 200
P3, 300
100
P5, 100
// -------------------------------------------------------
// [process] is required. One process per line:
// ID, ArrivalTick, MemoryKB, BurstTicks
// -------------------------------------------------------
[process]
P1, 1, 200, 3
P2, 1, 300, 2
P3, 2, 100, 5
P4, 3, 200, 3
P5, 4, 100, 7
The file is divided into named sections enclosed in brackets. Section names are case-insensitive.
| Section | Required | Description |
|---|---|---|
[config] |
Yes | Memory size and allocation unit |
[initial] |
No | Pre-existing memory layout at tick 0 |
[process] |
Yes | Processes to simulate |
[config] must appear before any other known section. Repeating a section is a parse error. Unknown sections are silently ignored.
[config]
SIZE, 512
ALIGN, 64
[process]
P1, 0, 128, 3
SIZE 512— 512 KB total memoryALIGN 64— alignment granularity is 64 KBP1, 0, 128, 3— process P1 arrives at tick 0, needs 128 KB, runs for 3 ticks
Two directives are mandatory. Attribute names are case-insensitive.
[config]
SIZE, 1000
ALIGN, 100
| Directive | Description |
|---|---|
SIZE |
Total size of the memory segment (KB). Must be a multiple of ALIGN. |
ALIGN |
Alignment granularity (KB). Every block in [initial] must be a multiple of this value. Process requests don't have to be exact multiples — the engine rounds them up to the next multiple at allocation time. |
Unknown attributes in [config] are ignored.
One process per line:
<ID>, <ArrivalTime>, <Memory>, <BurstTime>
| Field | Type | Description |
|---|---|---|
ID |
String |
Unique process identifier |
ArrivalTime |
Integer |
CPU cycle at which the process arrives (ticks) |
Memory |
Integer |
Memory required (KB) |
BurstTime |
Integer |
Uninterrupted CPU time needed (ticks) |
If a process arrives at tick 1 and has a burst time of 4, it leaves memory at tick 5.
Processes are read top to bottom. If multiple processes share the same arrival tick, their allocation order follows reading order.
By default, tick 0 is a single free hole the size of total memory.
The [initial] section lets you override this with a pre-existing memory layout.
[initial]
<size> // free hole
<ID>, <size> // occupied block
* // fill remaining space with a free hole
* as a standalone entry creates a free hole that covers all remaining space up to SIZE. Use it as the last entry to avoid counting bytes by hand. The expanded hole must be at least UNIT in size.
The sum of all blocks must equal
SIZEexactly, or a parse error is raised.
Allowed everywhere — as a full line or inline after any entry:
// This is a full-line comment
[config]
SIZE, 1000 // total memory in KB
UNIT, 100
[process]
P1, 0, 200, 3 // arrives immediately, needs 200 KB for 3 ticks
Accepted separators between fields: , (comma) or space. Any other character is treated as part of the token.
A dialog is shown when:
- An initial block size is not a multiple of
ALIGN. SIZEis not a multiple ofALIGN.- Process identifiers are not unique within their section.
- A field is missing from a process line.
- An initial state is defined but its total size ≠
SIZE. - A required directive (
SIZEorALIGN) is missing. - A field cannot be parsed to its expected type.
- A section is duplicated.
- A known section (
[initial]or[process]) appears before[config]. *in[initial]has no space left to fill.
The simulation pre-computes the entire timeline in memory. Exceeding these thresholds may cause excessive RAM usage or incorrect behavior:
| Parameter | Safe limit |
|---|---|
| Total processes | < 200 |
| Processes arriving at the same tick | < 50 |
| Max burst time | < 25 ticks |
The engine hard-caps at 150 ticks (MAX_TICKS_PER_SIMULATION).