aboutsummaryrefslogtreecommitdiffstats
path: root/native/src/blocking
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2012-05-16 12:37:19 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2012-05-16 12:37:19 -0400
commit4bfee51d6ae7356b3f6cb2cee74123a684b4d593 (patch)
treeb6053bcb137089f478b0b2eb7251e185bc04d456 /native/src/blocking
parentdd7f66806e66d9637b070841c2a7c914671db969 (diff)
C++: Break out the G-OMLP and G-FMLP code into own file
Part of refactoring sharedres.cpp.
Diffstat (limited to 'native/src/blocking')
-rw-r--r--native/src/blocking/global-fmlp.cpp53
-rw-r--r--native/src/blocking/global-omlp.cpp61
2 files changed, 114 insertions, 0 deletions
diff --git a/native/src/blocking/global-fmlp.cpp b/native/src/blocking/global-fmlp.cpp
new file mode 100644
index 0000000..b7cd25b
--- /dev/null
+++ b/native/src/blocking/global-fmlp.cpp
@@ -0,0 +1,53 @@
1#include "sharedres.h"
2#include "blocking.h"
3
4#include "stl-helper.h"
5
6
7BlockingBounds* global_fmlp_bounds(const ResourceSharingInfo& info)
8{
9 // split every thing by resources, sort, and then start counting.
10 Resources resources;
11
12 split_by_resource(info, resources);
13 sort_by_request_length(resources);
14
15
16 unsigned int i;
17 BlockingBounds* _results = new BlockingBounds(info);
18 BlockingBounds& results = *_results;
19
20 unsigned int num_tasks = info.get_tasks().size();
21
22 for (i = 0; i < info.get_tasks().size(); i++)
23 {
24 const TaskInfo& tsk = info.get_tasks()[i];
25 Interference bterm;
26
27
28 foreach(tsk.get_requests(), jt)
29 {
30 const RequestBound& req = *jt;
31 const ContentionSet& cs =
32 resources[req.get_resource_id()];
33
34 unsigned long interval = tsk.get_response();
35 unsigned long issued = req.get_num_requests();
36
37 // every other task may block once per request
38 unsigned int total_limit = (num_tasks - 1) * issued;
39 unsigned int per_src_limit = issued;
40
41 bterm += bound_blocking(cs,
42 interval,
43 total_limit,
44 per_src_limit,
45 &tsk);
46 }
47
48 results[i] = bterm;
49 }
50
51 return _results;
52}
53
diff --git a/native/src/blocking/global-omlp.cpp b/native/src/blocking/global-omlp.cpp
new file mode 100644
index 0000000..3c4f3da
--- /dev/null
+++ b/native/src/blocking/global-omlp.cpp
@@ -0,0 +1,61 @@
1#include "sharedres.h"
2#include "blocking.h"
3
4#include "stl-helper.h"
5
6BlockingBounds* global_omlp_bounds(const ResourceSharingInfo& info,
7 unsigned int num_procs)
8{
9 // split every thing by resources, sort, and then start counting.
10 Resources resources;
11
12 split_by_resource(info, resources);
13 sort_by_request_length(resources);
14
15 unsigned int i;
16 BlockingBounds* _results = new BlockingBounds(info);
17 BlockingBounds& results = *_results;
18
19 for (i = 0; i < info.get_tasks().size(); i++)
20 {
21 const TaskInfo& tsk = info.get_tasks()[i];
22 Interference bterm;
23
24 foreach(tsk.get_requests(), jt)
25 {
26 const RequestBound& req = *jt;
27 const ContentionSet& cs =
28 resources[req.get_resource_id()];
29
30 unsigned int num_sources = cs.size();
31 unsigned long interval = tsk.get_response();
32 unsigned long issued = req.get_num_requests();
33
34
35 unsigned int total_limit = (2 * num_procs - 1) * issued;
36 // Derived in the dissertation: at most twice per request.
37 unsigned int per_src_limit = 2 * issued;
38
39 if (num_sources <= num_procs + 1) {
40 // FIFO case: no job is ever skipped in the
41 // priority queue (since at most one job is in
42 // PQ at any time).
43 // Lemma 15 in RTSS'10: at most one blocking
44 // request per source per issued request.
45 per_src_limit = issued;
46 total_limit = (num_sources - 1) * issued;
47 }
48
49 bterm += bound_blocking(cs,
50 interval,
51 total_limit,
52 per_src_limit,
53 &tsk);
54 }
55
56 results[i] = bterm;
57 }
58
59 return _results;
60}
61