2 % Fork Job splitting node
for parallel processing models
4 % Fork
is a specialized node that splits incoming jobs into multiple sibling
5 % tasks that can be processed in parallel by downstream
nodes. Each job
6 % arriving at a Fork node
is replicated into multiple parallel tasks that
7 % must later be
synchronized using a corresponding Join node.
9 % @brief Job splitting node that creates parallel sibling tasks from incoming jobs
11 % Key characteristics:
12 % - Splits each job into multiple parallel tasks
13 % - Works in conjunction with Join
nodes for synchronization
14 % - Supports different fork strategies and task distributions
15 % - Essential
for modeling parallel processing systems
16 % - No service delay - instantaneous job splitting
18 % Fork
nodes are commonly used
for:
19 % - Parallel processing models
20 % - Fork-join queueing networks
21 % - Multi-threaded system modeling
22 % - Task decomposition scenarios
23 % - Distributed computing models
27 % fork = Fork(model,
'TaskSplitter');
28 % % Jobs entering
this fork will be split into parallel tasks
29 % % Must be paired with a Join node
for proper synchronization
32 % Copyright (c) 2012-2026, Imperial College London
33 % All rights reserved.
42 function self = Fork(model, name)
43 % FORK Create a Fork node instance
45 % @brief Creates a Fork node
for splitting jobs into parallel tasks
46 % @param model Network model to add the fork to
47 % @param name String identifier
for the fork node
48 % @
return self Fork instance configured
for the given model
50 % The constructor initializes the Fork node with appropriate buffers,
51 % service tunnels, and forker output components. Fork
nodes have no
52 % service delay and immediately split incoming jobs into parallel tasks.
55 if model.isMatlabNative()
60 self.schedStrategy = SchedStrategy.FORK;
61 self.server = ServiceTunnel();
66 elseif model.isJavaNative()
68 self.obj = jline.lang.nodes.Fork(model.obj, name);
69 self.index = model.obj.getNodeIndex(self.obj);
73 function setTasksPerLink(self, nTasks)
74 % SETTASKSPERLINK Configure number of tasks per output link
76 % Sets the number of tasks sent out on each outgoing link. By
default,
77 % a Fork node sends exactly one task per outgoing link. This method
78 % allows configuring the Fork to send multiple identical tasks on each
79 % link. The total number of tasks created will be:
80 % (number of outgoing links) × tasksPerLink.
82 % Solver compatibility
for tasksPerLink > 1:
83 % - SolverJMT: Fully supported - simulation handles multiple tasks correctly
84 % - SolverMVA (H-T method): Not supported - throws error
85 % - SolverMVA (MMT method): Limited - results may be inaccurate
87 % @param nTasks Number of tasks per link (default: 1)
89 self.output.tasksPerLink = nTasks;
92 function summary(self)
93 % SUMMARY Display fork node configuration summary
95 % @brief Prints a summary of the fork node
's routing configuration
97 line_printf('\nNode: <strong>%s</strong>
',self.getName);
98 for r=1:length(self.output.outputStrategy)
99 classes = self.model.getClasses();
100 line_printf('Routing %s: %s
',classes{r}.name,self.output.outputStrategy{r}{2});