LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
fj_respt_nt.m
1%{ @file fj_respt_nt.m
2 % @brief Nelson-Tantawi approximation for K-way F/J response time
3 %
4 % @author LINE Development Team
5%}
6
7%{
8 % @brief Nelson-Tantawi approximation for K-way F/J response time
9 %
10 % @details
11 % Computes an approximate mean response time for a K-way Fork-Join
12 % queueing system with Poisson arrivals and exponential service times.
13 % Valid for 2 <= K <= 32.
14 %
15 % R_K^{F/J}(rho) ≈ [H_K/H_2 + (1 - H_K/H_2) * 4*rho/11] * (1.5 - rho/8) / (mu - lambda)
16 %
17 % The approximation is based on the exact 2-way solution and a scaling
18 % approximation that upper and lower bounds increase at the same rate.
19 % The coefficient alpha(rho) ≈ 4*rho/11 was obtained from simulation.
20 %
21 % @par Syntax:
22 % @code
23 % R = fj_respt_nt(K, lambda, mu)
24 % @endcode
25 %
26 % @par Parameters:
27 % <table>
28 % <tr><th>Name<th>Description
29 % <tr><td>K<td>Number of parallel servers (2 <= K <= 32)
30 % <tr><td>lambda<td>Arrival rate
31 % <tr><td>mu<td>Service rate (mu > lambda for stability)
32 % </table>
33 %
34 % @par Returns:
35 % <table>
36 % <tr><th>Name<th>Description
37 % <tr><td>R<td>Approximate K-way F/J response time R_K^{F/J}(rho)
38 % </table>
39 %
40 % @par Reference:
41 % A. Thomasian, "Analysis of Fork/Join and Related Queueing Systems",
42 % ACM Computing Surveys, Vol. 47, No. 2, Article 17, July 2014.
43 % Table I, Eq. (3) on page 17:10.
44 %
45 % Original: R. Nelson and A.N. Tantawi, "Approximate Analysis of Fork/Join
46 % Synchronization in Parallel Queues", IEEE Trans. Computers, 37(6), 1988.
47%}
48function R = fj_respt_nt(K, lambda, mu)
49
50if K < 2
51 line_error(mfilename, 'Nelson-Tantawi approximation requires K >= 2. Got K=%d.', K);
52end
53
54if K > 32
55 line_warning(mfilename, 'Nelson-Tantawi approximation was validated for K <= 32. Using K=%d may have reduced accuracy.', K);
56end
57
58% Compute utilization
59rho = lambda / mu;
60
61if rho >= 1
62 line_error(mfilename, 'System is unstable: rho = lambda/mu = %.4f >= 1. Require lambda < mu.', rho);
63end
64
65% Compute harmonic numbers
66H_K = fj_harmonic(K);
67H_2 = fj_harmonic(2); % H_2 = 1.5
68
69% Nelson-Tantawi approximation (Eq. 3):
70% R_K^{F/J}(rho) ≈ [H_K/H_2 + (1 - H_K/H_2) * 4*rho/11] * (1.5 - rho/8) * (mu - lambda)^{-1}
71S_K = H_K / H_2 + (1 - H_K / H_2) * (4 * rho / 11);
72R_2_factor = 1.5 - rho / 8; % This is (H_2 - rho/8)
73R_rho = 1 / (mu - lambda);
74
75R = S_K * R_2_factor * R_rho;
76
77end