From 99dc5592bbca0f7d3a9d411268608c112b135896 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 15 Feb 2018 16:18:55 +0100 Subject: refactor(#18): Handle process launch using a kernel process This change will make the kernel handle the launch of processes using a kernel process that is launched at the start of the simulation and launches processes when it receives `Launch` messages. --- .../kotlin/com/atlarge/opendc/omega/Messages.kt | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 opendc-kernel-omega/src/main/kotlin/com/atlarge/opendc/omega/Messages.kt (limited to 'opendc-kernel-omega/src/main/kotlin/com/atlarge/opendc/omega/Messages.kt') diff --git a/opendc-kernel-omega/src/main/kotlin/com/atlarge/opendc/omega/Messages.kt b/opendc-kernel-omega/src/main/kotlin/com/atlarge/opendc/omega/Messages.kt new file mode 100644 index 00000000..73c3676f --- /dev/null +++ b/opendc-kernel-omega/src/main/kotlin/com/atlarge/opendc/omega/Messages.kt @@ -0,0 +1,30 @@ +package com.atlarge.opendc.omega + +import com.atlarge.opendc.simulator.Context +import com.atlarge.opendc.simulator.Process + +/** + * An internal message used by the Omega simulation kernel to indicate to a suspended [Process], that it should wake up + * and resume execution. + * + * This message is not guaranteed to work on other simulation kernels and [Context.interrupt] should be preferred to + * wake up a process from another entity. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +object Resume + +/** + * An internal message used by the Omega simulation kernel to indicate to a suspended [Process], that a timeout has been + * reached and that it should wake up and resume execution. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +object Timeout + +/** + * An internal message used by the Omega simulation kernel to launch a process. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +data class Launch(val process: Process<*, M>) -- cgit v1.2.3