resource Processor() import Scheduler, Bus int NUM_PROCESSORS = 3 # processors, default 3 real TIME = 1000.0 # time to run simulation cap Scheduler sched cap Bus bus # get command-line arguments, if present getarg(1, NUM_PROCESSORS); getarg(2, TIME) # start up Scheduler, Bus, and processors sched = create Scheduler(NUM_PROCESSORS+1) bus = create Bus(sched) process processor [ i = 1 to NUM_PROCESSORS ] { while (true) { bus.seize() # grab the bus sched.delay(random(10.0)) # use the bus bus.release() # release the bus sched.delay(random(20.0)) # do something else } } # run the simulation for TIME clock ticks sched.delay(TIME) # print usages from bus, then stop the simulation bus.print() stop end Processor