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"
83 #define FRSH_FEEDBACKCTRL_MODULE_SUPPORTED 1
86 * @file frsh_feedback_control.h
90 * @defgroup feedbackctrl Feedback Control Module
92 * This module provides a way to implement a QoS manager at the
96 * Please, note that, in order to exploit the feedback-scheduling
97 * functionality of FRESCOR, an application needs to use a set of
98 * different functions:
100 * <li>the frsh_contract_set_basic_params() and the
101 * frsh_contract_set_reclamation_params() functions are used
102 * to set the dynamic variability range (or options) for the budget;
103 * <li>the frsh_feedback_set_spare() function is used to communicate to
104 * the FMGR module what is the spare virtual resource that is used
105 * to reserve a fraction of resource availability by FMGR-enabled
106 * applications, so to avoid a complete occupation of the system
107 * (this is needed in common cases if one wants to keep a good
108 * performance of the QoS control loops);
109 * such spare vres needs to have been previously negotiated through
110 * the usual functions in the FRSH Core module;
111 * <li>the frsh_feedback_set_desired_budget() function is used to
112 * dynamically fine-tune the budget request for the application,
113 * leaving to the FMGR module the freedom to fulfill the requests
114 * made by all the applications in the system according to global
115 * QoS control goals, as well as to the importance and weight
116 * parameters that may be specified by the applications for individual
125 * frsh_feedback_set_spare()
127 * This function is used to tell the FRSH FEEDBACKCTRL module what is
128 * the spare contract that is used as a "reserve" of computation
129 * resources that may be used by other contracts making use of adaptive
133 * No threads must be ever attached to the contract identified by
136 int frsh_feedback_set_spare(frsh_vres_id_t spare_id);
139 * frsh_feedback_get_spare()
141 * Get version of the frsh_feedback_set_spare() function.
143 int frsh_feedback_get_spare(frsh_vres_id_t *p_spare_id);
146 * frsh_feedback_set_desired_budget()
148 * This function sets the budget request that would best suite the
149 * needs of the application for the very next server periods. The
150 * budget actually used for the vres instances (application jobs),
151 * that may be retrieved through a frsh_feedback_get_actual_budget() call,
152 * is dynamically changed by the FMGR Module, and may be less than
153 * the required value, as due to the following rules:
156 * <li>if the required budget is less than the minimum guaranteed
157 * negotiated for the vres, then it is always granted;
158 * <li>if the set of requested budgets is schedulable, then all the
159 * requests are granted, except for what stated in the note below;
160 * <li>if the set of requested budgets overcomes the resource capacity
161 * and the required budget is higher than the minimum guaranteed
162 * negotiated for the vres, then the FMGR module makes an attempt to
163 * fulfill the application request by using also the spare computation
164 * resources that have been reserved through the
165 * frsh_feedback_set_spare() call.
168 * Before any frsh_feedback_set_desired_budget() call, the desired budget
169 * is assumed to be equal to the maximum budget value set during contract
173 * If the requested budget is higher than the maximum value negotiated
174 * for the vres, then an error is returned.
177 * The actual budget that is used for a vres may change dynamically
178 * and asynchronously with respect to the threads attached to the vres,
179 * due to other contracts being negotiated, renegotiated or terminated,
180 * or due the call of the frsh_feedback_set_desired_budget() function
181 * for other virtual resources.
183 * @param[in] p_budget_in
184 * The new budget to set as desired.
186 int frsh_feedback_set_desired_budget(frsh_vres_id_t vres_id, frsh_rel_time_t *p_budget_in);
189 * frsh_feedback_get_desired_budget()
191 * Get version of the frsh_feedback_set_desired_budget() function.
193 * @param[out] p_budget_out
194 * The last budget set as desired through a frsh_feedback_set_desired_budget()
195 * call, or the maximum budget set during contract negotiation, if no such
196 * call ever occurred.
198 int frsh_feedback_get_desired_budget(frsh_vres_id_t vres_id, frsh_rel_time_t *p_budget_out);
201 * frsh_feedback_get_actual_budget()
203 * Retrieve the actual budget that is being dynamically used by the FMGR module for
204 * the specified vres. The value returned by this function (in the budget parameter)
205 * for a given vres may change dynamically as a result of a call to the
206 * frsh_feedback_set_desired_budget() function for the same or other virtual resources.
208 int frsh_feedback_get_actual_budget(frsh_vres_id_t vres_id, frsh_rel_time_t *budget);