Skip to content

petruki/jcpu-simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

Java CPU Simulator is a showcase application that displays how multi-threading works programmatically. Nothing fancy though.

Usage

  1. Run mvn clean install
  2. Execute the simulator located at: com\github\petruki\playground\Simulator.java

You can also create your own scenario or use one of the available pre-built scenarios located at com\github\petruki\playground\sample

Output sample

#############################
# Custom Scenario: 
# CPUs: 1
# - Computer
#      quantum=5
#
# Proc I
# Start at: 0
#   run(10)
#   run(3)
#
# Proc II
# Start at: 3
#   run(10)
#
# Proc III
# Start at: 2
#   run(10)
#
#############################

Proc I - w: 20 
|#####----------#####----------###
Proc II - w: 17 
---|-------#####----------#####
Proc III - w: 13 
--|---#####----------#####

- : IDLE
# : RUNNING
| : STARTED
w : WAITING