Systems · University · 2024

SO-SSEGADO

An operating-system simulator in C, with processes, memory, I/O and disk.

Status
Completed
Context
University project · team of three
My role
One of three authors, with Leandro Aguiar Mota and Otávio Augusto Teixeira.
Stack
  • C
  • POSIX threads
  • Semaphores
  • GCC
SO-SSEGADO terminal screens: the logo, the main menu and a table with sint1 blocked, sint2 running and sint3 ready.
Real program output, recompiled and run in October 2026.

Overview

SO-SSEGADO loads test programs and shows, in the terminal, what the operating system does with each resource.

Problem

Scheduling, semaphores and disk access are hard to grasp in theory alone. The idea was to see them running.

Approach

Each part of the system — kernel, memory, I/O and disk — runs on its own thread, like a real system. Test programs are text files with simple instructions.

How it works

  1. Kernel

    Schedules processes between ready, running and blocked.

  2. Semaphores

    Block and release processes that compete for the same resource.

  3. Disk

    C-SCAN algorithm: the head sweeps the disk in one direction and jumps back to the start.

  4. Menu

    Creates processes and shows the state of processes, semaphores, memory and disk.

pthread_t kernel;         // Thread do kernel
pthread_t sim_menu;       // Thread do menu
pthread_t memory_manager; // Thread da memoria
pthread_t io_manager;     // Thread de io
pthread_t disk_manager;   // Thread do disco

pthread_create(&sim_menu, NULL, menu, NULL);
pthread_create(&kernel, NULL, &mainLoop, NULL);
pthread_create(&memory_manager, NULL, memoryManagerThread, NULL);
pthread_create(&io_manager, NULL, ioManagerThread, NULL);
pthread_create(&disk_manager, NULL, diskManagerThread, &disk);
Excerpt from main.c in the public repository: one thread per part of the system.

Key decisions

  • One thread per resource

    Concurrency was the focus of the course, and this made shared-data problems real.

  • C-SCAN for the disk

    Sweeping in one direction keeps waiting times more even.

Result

Completed in 2024. In October 2026 I recompiled and ran it to capture the screens.