]> rtime.felk.cvut.cz Git - frescor/frsh-include.git/blob - frsh_feedback_control.h
Adapting FRSH to the new time types and synchronising headers with phase 2
[frescor/frsh-include.git] / frsh_feedback_control.h
1 // -----------------------------------------------------------------------
2 //  Copyright (C) 2006 - 2007 FRESCOR consortium partners:
3 //
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
10 //    ENEA                                   SWEDEN
11 //    Thales Communication S.A.              FRANCE
12 //    Visual Tools S.A.                      SPAIN
13 //    Rapita Systems Ltd                     UK
14 //    Evidence                               ITALY
15 //    
16 //    See http://www.frescor.org for a link to partners' websites
17 //
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
21 //        made of this code.
22 //
23 //
24 //  based on previous work (FSF) done in the FIRST project
25 //                       
26 //   Copyright (C) 2005  Mälardalen University, SWEDEN
27 //                       Scuola Superiore S.Anna, ITALY
28 //                       Universidad de Cantabria, SPAIN
29 //                       University of York, UK
30 //
31 //   FSF API web pages: http://marte.unican.es/fsf/docs
32 //                      http://shark.sssup.it/contrib/first/docs/
33 //
34 //  This file is part of FRSH API
35 //
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)
39 //  any later version.
40 //
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.
45 //
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
49 //  02111-1307, USA.
50 //
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
56 //  Public License.
57 // -----------------------------------------------------------------------
58 //frsh_feedback_control.h
59
60 //==============================================
61 //  ******** *******    ********  **      **
62 //  **///// /**////**  **//////  /**     /**
63 //  **      /**   /** /**        /**     /**
64 //  ******* /*******  /********* /**********
65 //  **////  /**///**  ////////** /**//////**
66 //  **      /**  //**        /** /**     /**
67 //  **      /**   //** ********  /**     /**
68 //  //       //     // ////////   //      // 
69 //
70 // FRSH(FRescor ScHeduler), pronounced "fresh"
71 //==============================================
72
73 #ifndef _FRSH_FEEDBACK_CONTROL_H_
74 #define _FRSH_FEEDBACK_CONTROL_H_
75
76 #include <time.h>
77
78 //#include "frsh_feedback_control_types.h"
79 #include "frsh_core_types.h"
80
81 FRSH_CPP_BEGIN_DECLS
82
83 #define FRSH_FEEDBACKCTRL_MODULE_SUPPORTED       1
84
85 /**
86  * @file frsh_feedback_control.h
87  **/
88
89 /**
90  * @defgroup feedbackctrl Feedback Control Module
91  *
92  * This module provides a way to implement a QoS manager at the
93  * application level.
94  *
95  * @note
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:
99  * <ul>
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
117  *       virtual resources.
118  * </ul>
119  *
120  * @{
121  *
122  **/
123
124 /**
125  * frsh_feedback_set_spare()
126  *
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
130  * reservations.
131  *
132  * @note
133  * No threads must be ever attached to the contract identified by
134  * spare_id.
135  **/
136 int frsh_feedback_set_spare(frsh_vres_id_t spare_id);
137
138 /**
139  * frsh_feedback_get_spare()
140  *
141  * Get version of the frsh_feedback_set_spare() function.
142  **/
143 int frsh_feedback_get_spare(frsh_vres_id_t *p_spare_id);
144
145 /**
146  * frsh_feedback_set_desired_budget()
147  *
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:
154  *
155  * <ul>
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.
166  * </ul>
167  *
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
170  * negotiation.
171  *
172  * @note
173  * If the requested budget is higher than the maximum value negotiated
174  * for the vres, then an error is returned.
175  *
176  * @note
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.
182  *
183  * @param[in] p_budget_in
184  * The new budget to set as desired.
185  **/
186 int frsh_feedback_set_desired_budget(frsh_vres_id_t vres_id, frsh_rel_time_t *p_budget_in);
187
188 /**
189  * frsh_feedback_get_desired_budget()
190  *
191  * Get version of the frsh_feedback_set_desired_budget() function.
192  *
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.
197  **/
198 int frsh_feedback_get_desired_budget(frsh_vres_id_t vres_id, frsh_rel_time_t *p_budget_out);
199
200 /**
201  * frsh_feedback_get_actual_budget()
202  *
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.
207  **/
208 int frsh_feedback_get_actual_budget(frsh_vres_id_t vres_id, frsh_rel_time_t *budget);
209
210 /*@}*/
211
212
213 FRSH_CPP_END_DECLS
214
215 #endif