Skip to content

About

OS project (java)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

31 Commits

Folders and files

Repository files navigation

SimOS

A small operating-system simulator written in Java + JavaFX. It walks through process scheduling, memory management, mutexes, and a tiny interpreter, with a live UI that shows what is happening every tick.

Features

  • Schedulers: Round Robin, HRRN, MLFQ (pick at startup)
  • Memory view: live PCB / variable / instruction rows
  • Process queues: Ready, Blocked, Finished
  • Mutexes: file, user input, user output (locked / free + owner + wait queue)
  • Disk + swap: processes get swapped to DISK_FOLDER/ when memory is full
  • Event log: every system call, scheduler decision, and swap event is logged in the UI

Requirements

  • JDK 23+ (developed against JDK 25 — Eclipse Temurin)
  • JavaFX SDK 23+ (download from Gluon)
  • Windows (the helper script is PowerShell — Linux/macOS users can run the equivalent javac / java commands by hand)

Running it — quick path (Windows / PowerShell)

  1. Download the JavaFX SDK zip from Gluon and extract it somewhere, e.g. C:\Users\<you>\Downloads\openjfx-26.0.1_windows-x64_bin-sdk\
  2. Open run.ps1 and update the $JFX variable at the top to point at the lib folder of your SDK (the one containing javafx.controls.jar).
  3. Open PowerShell in the project folder and run:
    .\run.ps1
    First-time only — if PowerShell blocks the script, run this once:
    Set-ExecutionPolicy -Scope CurrentUser RemoteSigned

The script will clean bin/, recompile every .java under src/, copy all non-Java resources (FXML, CSS, program files) into bin/, and launch the app.

Running it manually

$JFX = "C:\path\to\javafx-sdk-XX\lib"

# Compile
$sources = (Get-ChildItem -Recurse src -Filter *.java).FullName
javac --module-path $JFX --add-modules javafx.controls,javafx.fxml -d bin $sources

# Copy resources (FXML, CSS, sample programs) into bin
Get-ChildItem -Path src -Recurse -File | Where-Object { $_.Extension -ne ".java" } | ForEach-Object {
    $relative = $_.FullName.Substring((Resolve-Path src).Path.Length + 1)
    $destination = Join-Path "bin" $relative
    $dir = Split-Path $destination -Parent
    if (-not (Test-Path $dir)) { New-Item -ItemType Directory -Path $dir -Force | Out-Null }
    Copy-Item $_.FullName $destination -Force
}

# Run
java --enable-native-access=javafx.graphics --module-path $JFX --add-modules javafx.controls,javafx.fxml -cp bin main.Main

Running it in Eclipse

The repo ships with Eclipse project files (.project, .classpath). Configure the JavaFX user library to point at your SDK's lib/ folder (Window → Preferences → Java → Build Path → User Libraries), then right-click src/main/Main.java → Run As → Java Application.

Using the app

  1. Pick an algorithm in the startup dialog (Round Robin / HRRN / MLFQ) and set a quantum (used by Round Robin and MLFQ; ignored by HRRN).
  2. The main window opens with three sample processes pre-loaded (Program_1.txt, Program_2.txt, Program_3.txt under src/programs/).
  3. Top-bar buttons:
    • Start — auto-run, one tick every 5 seconds
    • Step — advance one tick
    • Pause — stop the auto-runner
    • Reset — clear state and re-init
  4. The CLOCK label counts up, processes move through Ready → Running → Blocked → Finished, and the memory / PCB tables + event log update each tick.

To make ticks faster, lower TIME_BETWEEN_CLOCKS_SEC in src/main/MainController.java.

Project layout

src/
  main/         — JavaFX entry point + controllers + SimulationEngine
  scheduler/    — Round Robin, HRRN, MLFQ
  memory/       — main memory + swap
  systemcalls/  — read/write memory, disk I/O, input, print
  mutex/        — file / user-input / user-output mutexes
  interpreter/  — executes one instruction per tick
  models/       — Process, PCB, MemoryWord, ResourceType, …
  viewModels/   — table-row + snapshot DTOs for the UI
  view/         — FXML layouts + style.css
  programs/     — sample programs the engine loads at startup

Authors

Team 108 — GUC, DMET / Operating Systems course.

About

OS project (java)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages