aboutsummaryrefslogtreecommitdiffstats
path: root/native/src/blocking/global-omlp.cpp
blob: 3c4f3da247a4986fa6f8d4814ca4c4dc3f3d7c4e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "sharedres.h"
#include "blocking.h"

#include "stl-helper.h"

BlockingBounds* global_omlp_bounds(const ResourceSharingInfo& info,
				   unsigned int num_procs)
{
	// split every thing by resources, sort, and then start counting.
	Resources resources;

	split_by_resource(info, resources);
	sort_by_request_length(resources);

	unsigned int i;
	BlockingBounds* _results = new BlockingBounds(info);
	BlockingBounds& results = *_results;

	for (i = 0; i < info.get_tasks().size(); i++)
	{
		const TaskInfo& tsk  = info.get_tasks()[i];
		Interference bterm;

		foreach(tsk.get_requests(), jt)
		{
			const RequestBound& req = *jt;
			const ContentionSet& cs =
				resources[req.get_resource_id()];

			unsigned int num_sources = cs.size();
			unsigned long interval = tsk.get_response();
			unsigned long issued   = req.get_num_requests();


			unsigned int total_limit = (2 * num_procs - 1) * issued;
			// Derived in the dissertation: at most twice per request.
			unsigned int per_src_limit = 2 * issued;

			if (num_sources <= num_procs + 1) {
				// FIFO case: no job is ever skipped in the
				//  priority queue (since at most one job is in
				//  PQ at any time).
				// Lemma 15 in RTSS'10: at most one blocking
				// request per source per issued request.
				per_src_limit = issued;
				total_limit   = (num_sources - 1) * issued;
			}

			bterm += bound_blocking(cs,
						interval,
						total_limit,
						per_src_limit,
						&tsk);
		}

		results[i] = bterm;
	}

	return _results;
}