LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
fj_respt_nosplit.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2012-2026, QORE Lab, Imperial College London
3
* All rights reserved.
4
*/
5
#ifndef LINE_API_FJ_RESPT_NOSPLIT_H
6
#define LINE_API_FJ_RESPT_NOSPLIT_H
7
8
/**
9
* @file
10
* @ingroup api_fj
11
* Mean response time of the distributed no-splitting parallel system.
12
*
13
* Templated port of matlab/src/api/fj/fj_respt_nosplit.m.
14
*
15
* A job of K tasks is routed in one piece to a single server chosen uniformly
16
* among the K, so each server is an M/E_K/1 queue of arrival rate lambda/K and
17
* service the sum of K exponential stages of rate mu. Pollaczek-Khinchine then
18
* reduces to
19
*
20
* R = [ K - (K-1) rho/2 ] / (mu - lambda), rho = lambda/mu,
21
*
22
* the reference against which the splitting policies are judged. At K = 1 it
23
* collapses to the M/M/1 response time.
24
*/
25
26
#include "
line/api/fj/fj_types.h
"
27
#include "
line/num/number.h
"
28
#include "
line/util/error.h
"
29
30
namespace
line
{
31
namespace
fj
{
32
33
/** [R, rho] of fj_respt_nosplit. */
34
template
<
class
T>
35
struct
FJResptNosplitResult
{
36
T
R
;
37
T
rho
;
38
};
39
40
/**
41
* @brief Mean response time of the distributed no-splitting parallel system.
42
*
43
* @param K number of servers, equal to the number of tasks per job
44
* @param lambda total job arrival rate
45
* @param mu per-server task service rate, mu > lambda
46
* @return the mean job response time and the per-server utilization
47
*/
48
template
<
class
T>
49
FJResptNosplitResult<T>
fj_respt_nosplit
(
unsigned
K,
const
T& lambda,
const
T& mu) {
50
detail::require_positive_K(K,
"fj_respt_nosplit"
);
51
const
T zero =
num_traits<T>::from_int
(0), one =
num_traits<T>::from_int
(1),
52
two =
num_traits<T>::from_int
(2);
53
if
(!(lambda > zero))
throw
InputError
(
"fj_respt_nosplit: the arrival rate must be positive"
);
54
if
(!(mu > zero))
throw
InputError
(
"fj_respt_nosplit: the service rate must be positive"
);
55
56
FJResptNosplitResult<T>
out;
57
out.
rho
= lambda / mu;
58
if
(out.
rho
>= one)
59
throw
NumericError
(
"fj_respt_nosplit: unstable system, rho = lambda/mu >= 1"
);
60
const
T Kt =
num_traits<T>::from_int
(
static_cast<
long
>
(K));
61
// M/M/1 response time at the same utilization
62
const
T Rmm1 = one / (mu - lambda);
63
out.
R
= (Kt - (Kt - one) * out.
rho
/ two) * Rmm1;
64
return
out;
65
}
66
67
}
// namespace fj
68
}
// namespace line
69
70
#endif
// LINE_API_FJ_RESPT_NOSPLIT_H
line::InputError::InputError
InputError(const std::string &what)
Definition
error.h:39
line::NumericError::NumericError
NumericError(const std::string &what)
Definition
error.h:45
error.h
The exception types the port throws.
fj_types.h
Shared return types and arithmetic helpers for the templated fork-join port.
line::fj
Definition
fj_amva.h:34
line::fj::fj_respt_nosplit
FJResptNosplitResult< T > fj_respt_nosplit(unsigned K, const T &lambda, const T &mu)
Mean response time of the distributed no-splitting parallel system.
Definition
fj_respt_nosplit.h:49
line
Definition
aoi_dist2ph.h:52
number.h
Number-type abstraction for the templated API port.
line::fj::FJResptNosplitResult
[R, rho] of fj_respt_nosplit.
Definition
fj_respt_nosplit.h:35
line::fj::FJResptNosplitResult::rho
T rho
Definition
fj_respt_nosplit.h:37
line::fj::FJResptNosplitResult::R
T R
Definition
fj_respt_nosplit.h:36
line::num_traits
Definition
number.h:111
include
line
api
fj
fj_respt_nosplit.h
Generated by
1.18.0