1 // -----------------------------------------------------------------------
2 // Copyright (C) 2006 - 2007 FRESCOR consortium partners:
4 // Universidad de Cantabria, SPAIN
5 // University of York, UK
6 // Scuola Superiore Sant'Anna, ITALY
7 // Kaiserslautern University, GERMANY
8 // Univ. Politécnica Valencia, SPAIN
9 // Czech Technical University in Prague, CZECH REPUBLIC
11 // Thales Communication S.A. FRANCE
12 // Visual Tools S.A. SPAIN
13 // Rapita Systems Ltd UK
16 // See http://www.frescor.org for a link to partners' websites
18 // FRESCOR project (FP6/2005/IST/5-034026) is funded
19 // in part by the European Union Sixth Framework Programme
20 // The European Union is not liable of any use that may be
24 // based on previous work (FSF) done in the FIRST project
26 // Copyright (C) 2005 Mälardalen University, SWEDEN
27 // Scuola Superiore S.Anna, ITALY
28 // Universidad de Cantabria, SPAIN
29 // University of York, UK
31 // FSF API web pages: http://marte.unican.es/fsf/docs
32 // http://shark.sssup.it/contrib/first/docs/
34 // This file is part of FRSH API
36 // FRSH API is free software; you can redistribute it and/or modify
37 // it under the terms of the GNU General Public License as published by
38 // the Free Software Foundation; either version 2, or (at your option)
41 // FRSH API is distributed in the hope that it will be useful, but
42 // WITHOUT ANY WARRANTY; without even the implied warranty of
43 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
44 // General Public License for more details.
46 // You should have received a copy of the GNU General Public License
47 // distributed with FRSH API; see file COPYING. If not, write to the
48 // Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
51 // As a special exception, if you include this header file into source
52 // files to be compiled, this header file does not by itself cause
53 // the resulting executable to be covered by the GNU General Public
54 // License. This exception does not however invalidate any other
55 // reasons why the executable file might be covered by the GNU General
57 // -----------------------------------------------------------------------
58 //frsh_feedback_control.h
60 //==============================================
61 // ******** ******* ******** ** **
62 // **///// /**////** **////// /** /**
63 // ** /** /** /** /** /**
64 // ******* /******* /********* /**********
65 // **//// /**///** ////////** /**//////**
66 // ** /** //** /** /** /**
67 // ** /** //** ******** /** /**
68 // // // // //////// // //
70 // FRSH(FRescor ScHeduler), pronounced "fresh"
71 //==============================================
73 #ifndef _FRSH_FEEDBACK_CONTROL_H_
74 #define _FRSH_FEEDBACK_CONTROL_H_
78 //#include "frsh_feedback_control_types.h"
79 #include "frsh_core_types.h"
82 #define FRSH_FEEDBACKCTRL_MODULE_SUPPORTED 1
85 * @file frsh_feedback_control.h
89 * @defgroup feedbackctrl Feedback Control Module
91 * This module provides a way to implement a QoS manager at the
95 * Please, note that, in order to exploit the feedback-scheduling
96 * functionality of FRESCOR, an application needs to use a set of
97 * different functions:
99 * <li>the frsh_contract_set_basic_params() and the
100 * frsh_contract_set_reclamation_params() functions are used
101 * to set the dynamic variability range (or options) for the budget;
102 * <li>the frsh_feedback_set_spare() function is used to communicate to
103 * the FMGR module what is the spare virtual resource that is used
104 * to reserve a fraction of resource availability by FMGR-enabled
105 * applications, so to avoid a complete occupation of the system
106 * (this is needed in common cases if one wants to keep a good
107 * performance of the QoS control loops);
108 * such spare vres needs to have been previously negotiated through
109 * the usual functions in the FRSH Core module;
110 * <li>the frsh_feedback_set_desired_budget() function is used to
111 * dynamically fine-tune the budget request for the application,
112 * leaving to the FMGR module the freedom to fulfill the requests
113 * made by all the applications in the system according to global
114 * QoS control goals, as well as to the importance and weight
115 * parameters that may be specified by the applications for individual
124 * frsh_feedback_set_spare()
126 * This function is used to tell the FRSH FEEDBACKCTRL module what is
127 * the spare contract that is used as a "reserve" of computation
128 * resources that may be used by other contracts making use of adaptive
132 * No threads must be ever attached to the contract identified by
135 int frsh_feedback_set_spare(const frsh_contract_t *spare_contract);
138 * frsh_feedback_get_spare()
140 * Get version of the frsh_feedback_set_spare() function.
142 int frsh_feedback_get_spare(frsh_contract_t *spare_contract);
145 * frsh_feedback_set_desired_budget()
147 * This function sets the budget request that would best suite the
148 * needs of the application for the very next server periods. The
149 * budget actually used for the vres instances (application jobs),
150 * that may be retrieved through a frsh_feedback_get_actual_budget() call,
151 * is dynamically changed by the FMGR Module, and may be less than
152 * the required value, as due to the following rules:
155 * <li>if the required budget is less than the minimum guaranteed
156 * negotiated for the vres, then it is always granted;
157 * <li>if the set of requested budgets is schedulable, then all the
158 * requests are granted, except for what stated in the note below;
159 * <li>if the set of requested budgets overcomes the resource capacity
160 * and the required budget is higher than the minimum guaranteed
161 * negotiated for the vres, then the FMGR module makes an attempt to
162 * fulfill the application request by using also the spare computation
163 * resources that have been reserved through the
164 * frsh_feedback_set_spare() call.
167 * Before any frsh_feedback_set_desired_budget() call, the desired budget
168 * is assumed to be equal to the maximum budget value set during contract
172 * If the requested budget is higher than the maximum value negotiated
173 * for the vres, then an error is returned.
176 * The actual budget that is used for a vres may change dynamically
177 * and asynchronously with respect to the threads attached to the vres,
178 * due to other contracts being negotiated, renegotiated or terminated,
179 * or due the call of the frsh_feedback_set_desired_budget() function
180 * for other virtual resources.
182 * @param[in] p_budget_in
183 * The new budget to set as desired.
185 int frsh_feedback_set_desired_budget(frsh_vres_id_t vres_id, struct timespec *p_budget_in);
188 * frsh_feedback_get_desired_budget()
190 * Get version of the frsh_feedback_set_desired_budget() function.
192 * @param[out] p_budget_out
193 * The last budget set as desired through a frsh_feedback_set_desired_budget()
194 * call, or the maximum budget set during contract negotiation, if no such
195 * call ever occurred.
197 int frsh_feedback_get_desired_budget(frsh_vres_id_t vres_id, struct timespec *p_budget_out);
200 * frsh_feedback_get_actual_budget()
202 * Retrieve the actual budget that is being dynamically used by the FMGR module for
203 * the specified vres. The value returned by this function (in the budget parameter)
204 * for a given vres may change dynamically as a result of a call to the
205 * frsh_feedback_set_desired_budget() function for the same or other virtual resources.
207 int frsh_feedback_get_actual_budget(frsh_vres_id_t vres_id, struct timespec *budget);