Class ForkJoinExamples
-
- All Implemented Interfaces:
public class ForkJoinExamples
Fork-join network examples mirroring the Kotlin notebooks in forkJoin.
This class contains Java implementations that mirror the Kotlin notebook examples found in jar/src/main/kotlin/jline/examples/kotlin/basic/forkJoin/. Each method demonstrates a specific fork-join concept using models from the basic package.
The examples cover: - Basic fork-join synchronization patterns - Asymmetric and nested fork-join structures - Class switching within fork-join topologies - Complex serial and parallel compositions - Deep nesting and routing overlaps
-
-
Constructor Summary
Constructors Constructor Description ForkJoinExamples()
-
Method Summary
Modifier and Type Method Description static void
fj_asymm()
Asymmetric fork-join network (fj_asymm.ipynb). static void
fj_basic_closed()
Basic closed fork-join network (fj_basic_closed.ipynb). static void
fj_basic_nesting()
Basic nested fork-join network (fj_basic_nesting.ipynb). static void
fj_basic_open()
Basic open fork-join network (fj_basic_open.ipynb). static void
fj_complex_serial()
Complex serial fork-join network (fj_complex_serial.ipynb). static void
fj_cs_multi_visits()
Fork-join with class switching and multiple visits (fj_cs_multi_visits.ipynb). static void
fj_cs_postfork()
Fork-join with post-fork class switching (fj_cs_postfork.ipynb). static void
fj_cs_prefork()
Fork-join with pre-fork class switching (fj_cs_prefork.ipynb). static void
fj_deep_nesting()
Deep nested fork-join network (fj_deep_nesting.ipynb). static void
fj_delays()
Fork-join with multiple delay stages (fj_delays.ipynb). static void
fj_nojoin()
Fork without join synchronization (fj_nojoin.ipynb). static void
fj_route_overlap()
Fork-join with overlapping routes (fj_route_overlap.ipynb). static void
fj_serialfjs_closed()
Closed serial fork-join stages (fj_serialfjs_closed.ipynb). static void
fj_serialfjs_open()
Open serial fork-join stages (fj_serialfjs_open.ipynb). static void
fj_threebranches()
Multi-class three-branch fork-join (fj_threebranches.ipynb). static void
fj_twoclasses_forked()
Two-class fork-join with task multiplication (fj_twoclasses_forked.ipynb). static void
main(Array<String> args)
Main method demonstrating all fork-join examples. -
-
Method Detail
-
fj_asymm
static void fj_asymm()
Asymmetric fork-join network (fj_asymm.ipynb).
Demonstrates an asymmetric fork-join where one branch has serial queues (Queue2→Queue3) while the other has a single queue (Queue1).
Features: - Closed network with 10 jobs circulating through delay→fork-join - Branch 1: Single Queue1, Branch 2: Serial Queue2→Queue3 - Different service rates creating bottleneck effects - Multiple solver comparison (JMT and MVA)
-
fj_basic_closed
static void fj_basic_closed()
Basic closed fork-join network (fj_basic_closed.ipynb).
Demonstrates symmetric fork-join with PS scheduling in closed system.
Features: - 5 jobs circulating through Delay→Fork→{Queue1,Queue2}→Join→Delay - Symmetric parallel branches with identical service rates (1.0) - PS scheduling for fair sharing within each queue - Multiple solver comparison (JMT and MVA with fork-join extensions)
-
fj_basic_nesting
static void fj_basic_nesting()
Basic nested fork-join network (fj_basic_nesting.ipynb).
Shows hierarchical fork-join structures with multiple levels.
-
fj_basic_open
static void fj_basic_open()
Basic open fork-join network (fj_basic_open.ipynb).
Demonstrates fundamental fork-join synchronization with open arrivals, showing parallel processing and synchronization effects.
Features: - Fork splits jobs into parallel streams for processing - Two FCFS queues with different service rates (1.0 and 2.0) - Join synchronizes completion from both parallel branches - Queue2 is faster, so Queue1 becomes the bottleneck - Multiple solver comparison (JMT and MVA)
-
fj_complex_serial
static void fj_complex_serial()
Complex serial fork-join network (fj_complex_serial.ipynb).
Demonstrates complex fork-join with serial processing within branches.
Features: - Fork to two branches with series queues within each branch - Branch 1: Queue1 → Queue4 → Queue5 (3 queues in series) - Branch 2: Queue2 → Queue3 (2 queues in series) - Different service rates creating complex performance interactions - Shows how serial chains within parallel branches affect overall performance
-
fj_cs_multi_visits
static void fj_cs_multi_visits()
Fork-join with class switching and multiple visits (fj_cs_multi_visits.ipynb).
Demonstrates feedback loop with class switching in fork-join.
Features: - Two open classes: Class1 with arrivals, Class2 generated internally - Router node creates feedback from Join back to Fork - Class switching capabilities showing job transformation - PS scheduling for fair resource sharing - Feedback loop creates multiple visits to fork-join structure
-
fj_cs_postfork
static void fj_cs_postfork()
Fork-join with post-fork class switching (fj_cs_postfork.ipynb).
Shows class switching after fork splitting.
Features: - Two closed classes with 1 job each - Class switching occurs after fork via router nodes - Router nodes between Fork and Queue nodes enable class transformation - PS queues with identical service rates for fairness - Demonstrates how jobs can change class during fork-join processing
-
fj_cs_prefork
static void fj_cs_prefork()
Fork-join with pre-fork class switching (fj_cs_prefork.ipynb).
Demonstrates class switching before fork operation.
Features: - Two closed classes with 10 jobs each - Class switching happens before entering fork-join structure - Delay1 → Delay2 path with class transformation - Only transformed jobs enter the fork-join section - Shows selective fork-join participation based on job class
-
fj_deep_nesting
static void fj_deep_nesting()
Deep nested fork-join network (fj_deep_nesting.ipynb).
Shows complex hierarchical fork-join structures.
Features: - Nested fork-join: Fork1 splits to Queue1 and Queue2 - Queue1 leads to Fork2 which splits to Queue3 and Queue4 - Creates asymmetric tree structure with deeper nesting on one side - Single job to clearly show synchronization behavior - Demonstrates how nested fork-joins affect response times
-
fj_delays
static void fj_delays()
Fork-join with multiple delay stages (fj_delays.ipynb).
Demonstrates impact of sequential delays before fork-join.
Features: - Two delay nodes in series before fork-join structure - Delay1 (rate 0.5) → Delay2 (rate 2.0) → Fork - Symmetric parallel queues after fork (both rate 1.0) - Shows how pre-processing delays affect fork-join performance - 10 jobs circulating in closed system
-
fj_nojoin
static void fj_nojoin()
Fork without join synchronization (fj_nojoin.ipynb).
Shows fork splitting without synchronization requirement.
Features: - Fork splits arrivals to three PS queues - No Join node - jobs exit independently to sink - Probabilistic routing: 1/3 to each queue - Different service rates: Queue1(1.0), Queue2(0.5), Queue3(0.333) - Demonstrates load balancing without synchronization overhead
-
fj_route_overlap
static void fj_route_overlap()
Fork-join with overlapping routes (fj_route_overlap.ipynb).
Three-way fork-join demonstrating route overlap effects.
Features: - Fork splits to three FCFS queues simultaneously - Different service rates: Queue1(1.0), Queue2(2.0), Queue3(3.0) - Join waits for all three branches to complete - Queue1 is fastest, Queue3 is slowest (bottleneck) - Shows impact of slowest branch on overall response time
-
fj_serialfjs_closed
static void fj_serialfjs_closed()
Closed serial fork-join stages (fj_serialfjs_closed.ipynb).
Two fork-join stages in series within closed network.
Features: - First stage: Fork1 → {Queue1, Queue2} → Join1 - Second stage: Fork2 → {Queue3, Queue4} → Join2 - 10 jobs circulating through Delay → Stage1 → Stage2 → Delay - All queues PS with identical service rates (1.0) - Shows cumulative effect of cascaded fork-join stages
-
fj_serialfjs_open
static void fj_serialfjs_open()
Open serial fork-join stages (fj_serialfjs_open.ipynb).
Cascaded fork-join stages with open arrivals.
Features: - External arrivals at rate 2.5 - Two fork-join stages in series - Stage 1: Fork1 → {Queue1, Queue2} → Join1 - Stage 2: Fork2 → {Queue3, Queue4} → Join2 - All queues FCFS with identical service rates - Demonstrates pipeline parallelism with synchronization points
-
fj_threebranches
static void fj_threebranches()
Multi-class three-branch fork-join (fj_threebranches.ipynb).
Asymmetric fork-join with three branches and two classes.
Features: - Two closed classes with 10 jobs each - Fork splits to three PS queues - Queue2 → Queue3 creates series within middle branch - Different service rates for each class at each queue - Shows multi-class interaction in asymmetric fork-join topology
-
fj_twoclasses_forked
static void fj_twoclasses_forked()
Two-class fork-join with task multiplication (fj_twoclasses_forked.ipynb).
Multi-class fork-join with different task multiplicity.
Features: - Two open classes with arrival rate 0.25 each - Fork creates 2 tasks per link (task multiplication) - PS scheduling for resource sharing between classes - Class2 has immediate service at Queue1, exponential at Queue2 - Shows effect of task multiplication on system performance
-
-
-
-