COREWAR

/
Step 22: Observation: The "SPL" Split Instruction and Mitosis
🎯Multiply your active processes to 4 or more using SPL(0/4)

MISSIONS (30 STEPS)

CH.1: UI & MEMORY BASICS (1-6)
BASIC★☆☆
Step 1: The "STEP" Button That Advances Time
🔒
BASIC★☆☆
Step 2: Process Termination and Restoring with "RESET"
🔒
BASIC★☆☆
Step 3: "Edit Mode" vs. "Running Mode"EDIT
🔒
BASIC★☆☆
Step 4: The Three Rooms of a Memory Box (Changing B)EDIT
🔒
BASIC★☆☆
Step 5: Modifying Both the Left Room (A) and Right Room (B)EDIT
🔒
BASIC★☆☆
Step 6: Literal Numbers (#) vs. Relative Addresses ($)EDIT
CH.2: CORE INSTRUCTIONS (7-13)
🔒
ARITHMETIC★☆☆
Step 7: Observing the "ADD" Instruction
🔒
ARITHMETIC★☆☆
Step 8: Changing the Number to Add (A-Field)EDIT
🔒
ARITHMETIC★☆☆
Step 9: Changing the Target Address (B-Field)EDIT
🔒
ARITHMETIC★☆☆
Step 10: Using the Subtraction Instruction "SUB"EDIT
🔒
BASIC★☆☆
Step 11: Copying an Entire Box with "MOV"EDIT
🔒
CONTROL★☆☆
Step 12: Looping Back in Time with "JMP"EDIT
🔒
CONTROL★☆☆
Step 13: Build Your First Program (Automatic Counter)EDIT
CH.3: VON NEUMANN & DIGITAL LIFE (14-18)
🔒
BASIC★☆☆
Step 14: Why Does "DAT" Become a Bomb?EDIT
🔒
BASIC★☆☆
Step 15: Copying Your Own Instruction (Code = Data)EDIT
🔒
BASIC★☆☆
Step 16: Observation: Stepping Through "Imp", the Oldest Digital Organism
🔒
BASIC★☆☆
Step 17: Modifying the Imp (Copy Destination Experiment)EDIT
🔒
ARITHMETIC★★☆
Step 18: Understanding Indirect Addressing (@ Pointers)EDIT
CH.4: CLASSIC ARCHETYPES (19-24)
🔒
STRATEGY★★☆
Step 19: Observation: Dissecting the "Dwarf" Bomber Step-by-Step
🔒
STRATEGY★★☆
Step 20: Modifying Dwarf (Changing the Bombing Interval)EDIT
🔒
STRATEGY★★☆
Step 21: First Combat: Tune Your Bomb Interval to Destroy the TargetEDIT
🔒
CONTROL★★☆
Step 22: Observation: The "SPL" Split Instruction and Mitosis
🔒
CONTROL★★☆
Step 23: Finding Enemies with Conditional Skip "SEQ / CMP"EDIT
🔒
STRATEGY★★☆
Step 24: Stopping an Imp with a Pre-Decrement "Imp-Gate"EDIT
CH.5: BATTLE EVOLUTION (25-30)
🔒
STRATEGY★★☆
Step 25: [Stone] High-Speed Bomber and Step Size TuningEDIT
🔒
STRATEGY★★☆
Step 26: [Paper] Observing the Self-Replicating Swarm "Mice"
🔒
STRATEGY★★★
Step 27: [Modifying Paper] Tune Clone Dispersal Distance to Overwhelm StoneEDIT
🔒
STRATEGY★★☆
Step 28: [Scissors] Tuning Scanner Stride to Shred PaperEDIT
🔒
STRATEGY★★★
Step 29: [Trap] Abducting Enemy Processes with "Vampire"EDIT
🔒
STRATEGY★★★
Step 30: Graduation Exam: Tune Your Warrior and Win the Final BattleEDIT
👁️ OBSERVATION MODE (Press [STEP])
[Addr][Opcode][A (Left)][B (Right)]
📦 DATA / BOMB (DAT)
0000
▼MOV
#
$
0001
▼MOV
<
<
0002
↺JMN
$
$
0003
❖SPL
@
#
0004
+ADD
#
$
0005
↺JMP
$
$
0006
■DAT
$0
$0
0007
■DAT
$0
$0
0008
■DAT
$0
$0
0009
■DAT
$0
$0
0010
■DAT
$0
$0
0011
■DAT
$0
$0
0012
■DAT
$0
$0
0013
■DAT
$0
$0
0014
■DAT
$0
$0
0015
■DAT
$0
$0
0016
■DAT
$0
$0
0017
■DAT
$0
$0
0018
■DAT
$0
$0
0019
■DAT
$0
$0
0020
■DAT
$0
$0
0021
■DAT
$0
$0
0022
■DAT
$0
$0
0023
■DAT
$0
$0
0024
■DAT
$0
$0
0025
■DAT
$0
$0
0026
■DAT
$0
$0
0027
■DAT
$0
$0
🏟️ARENA (20 ROWS)SCOPE: 0000 - 0019
[CORE MEMORY 800 CELLS (20 ROWS × 40 COLS)]1:1 Row Synced with Editor
TASKS: 0
CYC: 0
📖 LECTURE NOTE // STEP 22 OF 30Chapter 4: Warrior Dissection, Multitasking & Sensors⏱ 6 min read
📖 Lecture Note: Computer Science & Artificial Life Principles Behind This Experiment

The "SPL" Split Instruction and OS Multitasking: fork() and the Parallelism Trade-Off

How spawning multiple execution pointers grants near-immortality while dividing per-thread execution speed by 1/N

#SPL (Split)#Multitasking & Concurrency#FIFO Task Queue#Round-Robin Scheduling#UNIX fork()
🔬Step 22: Observation: The "SPL" Split Instruction and Mitosis

Until now, your program had only one glowing execution pointer. If that single pointer stepped on a DAT, you lost immediately. Enter SPL (Split)—the mitotic instruction that splits your execution pointer into multiple concurrent processes!

- Executing SPL spawns a new process in your queue (1 ➔ 2 ➔ 3 ➔ 4...). - As long as at least one of your processes survives, your Warrior stays alive even if another process hits a bomb!

🎯 Your Task (No Editing Needed) Press [STEP] several times or press [PLAY] to watch your processes multiply and march forward together!

1. Fragile Mortality vs. Mitotic Division ("SPL")

From Step 1 through Step 21, every warrior you ran possessed only a single glowing execution pointer (one Program Counter). Having a single thread of execution means living on a knife's edge: if that lone pointer ever steps onto a DAT bomb, your warrior is wiped out instantaneously.

Step 22 shatters that limitation with the introduction of CoreWar's most magical instruction: "SPL" (Split). As you stepped through "SPL.A $0, #0" followed by "MOV.I $0, $1", you watched your warrior's active process count multiply—from 1 to 2, 3, 4, and beyond—like a biological cell undergoing mitosis!

Recall the fundamental survival rule of CoreWar: a warrior loses only when ALL of its processes have terminated. If you use SPL to split your organism into 16 parallel processes, an enemy bomber can blow up 15 of your threads with DAT bombs, and as long as the 16th process survives elsewhere in memory, your organism remains alive and fighting!

 Executing: [0000] SPL.A $Target
                 │
   ┌─────────────┴──────────────────────────┐
   ▼ (1st in FIFO Queue)                    ▼ (2nd in FIFO Queue)
[Parent Process]: Steps to PC + 1 (0001)   [Child Process]: Jumps to $Target!

2. UNIX fork() and MARS Round-Robin Task Scheduling

Under the hood, the "SPL" instruction is a pure, visual miniature of the "fork()" system call and multi-threaded task scheduling found at the heart of UNIX, Linux, macOS, and Windows kernels.

When a process at Address PC executes "SPL.A $Target", the MARS virtual operating system performs two actions atomically: 1. PARENT PROCESS: The original execution pointer advances to the next sequential instruction (PC + 1) and is placed at the back of your warrior's Process Queue (a First-In, First-Out / FIFO queue). 2. CHILD PROCESS: A brand-new execution pointer is spawned pointing to the destination address (PC + $Target) and is queued immediately behind the parent process.

How does MARS execute a warrior that has 4 active processes (say, Threads P1, P2, P3, and P4) in its queue? It uses classic Round-Robin Time-Sharing! Each time your warrior's turn arrives, MARS pops ONLY ONE process (P1) from the front of your FIFO queue, executes its single instruction, and pushes P1 to the back of the line. On your next turn, P2 runs one instruction; on the turn after that, P3 runs; then P4; and only on the 5th turn does P1 get to move again.

3. The Fundamental Law of Parallelism: Redundancy vs. The 1/N Speed Penalty

This brings us to a profound law of computer architecture and parallel systems: Why not just execute SPL a thousand times immediately to become invincible?

Because in MARS (just like on a single-core CPU), your warrior receives a fixed budget of ONE instruction cycle per turn, regardless of how many processes are in your queue! - With 1 process: That lone process runs on 100% of your turns, moving and firing at maximum speed. - With 4 processes: Each individual process only gets to execute once every 4 turns—cutting each thread's speed to 1/4 (25%)! - With 100 processes: Each thread is starved for CPU cycles, creeping forward at 1/100th normal speed while a single-threaded enemy Stone bomber runs circles around it at full speed!

Spawning processes via SPL trades Individual Thread Speed (1/N) for Distributed Redundancy (survivability). Balancing this exact trade-off between mitotic replication and metabolic speed is the secret to mastering multi-process organisms in Chapter 5. Notice also how the ordering inside the FIFO queue matters: when a parent process executes "SPL $Target", the parent is scheduled BEFORE the newly spawned child on the next round of turns. This subtle scheduling rule (defined in the ICWS-94 specification) ensures that a parent copying loop can finish initializing a structure before the child thread begins executing it.

🔒

🔒 MISSION CLEAR Unlocks the Full Lecture Note

Complete the experiment in the simulator above to automatically unlock the full deep-dive article—or click below to read the full text immediately.