CPU Cycle Simulator

2023, Individual


CPU Cycle Simulator

This project is a round-robin simulator, written in C++, made just to deepen my understanding of low-level computer processes and the foundations of OS process management.

This project allows users to schedule processes and simulates the round-robin scheduling algorithm by calculating the time allocation for each process and estimating their completion times. The simulator provides a way to explore how operating systems manage process execution, making it a helpful tool for studying CPU scheduling.

This code closely mirrors how real task schedulers determine which tasks are allocated CPU resources.

Input/Output Example

INPUT

BSIZE 4096
START 0
CORE 200

READ 256
CORE 30
DISPLAY 100
CORE 10
INPUT 900
CORE 10
WRITE 256
CORE 30
OUTPUT
            
main queue entered, looking at top process. It is: 0 CORE

Core Completion called with 0 CORE
process info- GLOBAL clock time: 200 completion time: 200
logReads: 0 phyReads: 0 phyWrites: 0
entry data: 0 1 10
process instruction:: READ and time: 256
write or read was taken, go to ssd request

SSDRequest reached with 0 READ
physical read, push to main queue or SSD queue if SSD full

handle buffer called. Bytes needed: 256 Current Buffer Size: 0
Final buffer size: 3840

...

Process 0 terminates at 1280.2 ms
physical reads: [1] logical reads: [0] physical writes: [1]

Process Table:
Process 0: Terminated