Module: Risc::Process

Included in:
ProcessWithPid
Defined in:
lib/risc/Process.rb

Overview

Mixin representing processes running within the simulator. A simulated process should override this interface as necessary.

Constant Summary collapse

NULL_PROCESSID =
0

Instance Method Summary collapse

Instance Method Details

#initObject

Action when the process is created. This execution step is scheduled when the process is created through Sim#create_process. This action is executed before any event or timeout.



37
38
# File 'lib/risc/Process.rb', line 37

def init
end

#process_event(event) ⇒ Object

Action executed in response to an event signaled to this process. Notice that the signaled event should not be used outside this method, other than by signaling it to a process through Sim#signal_event. The implementation of this method may specify the duration of the actions associated with this response using the Sim#advance_delay method. By default, the duration of an action is 0.



47
48
# File 'lib/risc/Process.rb', line 47

def process_event(event)
end

#process_timeoutObject

Action executed in response to a timeout. This method defines the actions explicitly scheduled for this process by the process itself. These actions are scheduled by calling Sim#set_timeout. The implementation of this method may specify the duration of the actions associated with this response using the Sim#advance_delay method. By default, the duration of an action is 0.



57
58
# File 'lib/risc/Process.rb', line 57

def process_timeout
end

#stopObject

Executed when the process is explicitly stopped. A process is stopped by a call to Sim#stop_process. This method is executed immediately after the process has processed all the events or timeouts scheduled before the call to Sim#stop_process.



64
65
# File 'lib/risc/Process.rb', line 64

def stop
end