]> rtime.felk.cvut.cz Git - frescor/frsh-include.git/blob - frsh_feedback_control.h
Upgrading FRSH trunk to D-AC2v2. Phase I: Moving FRSH-FOSA to FOSA
[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
82 #define FRSH_FEEDBACKCTRL_MODULE_SUPPORTED       1
83
84 /**
85  * @file frsh_feedback_control.h
86  **/
87
88 /**
89  * @defgroup feedbackctrl Feedback Control Module
90  *
91  * This module provides a way to implement a QoS manager at the
92  * application level.
93  *
94  * @note
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:
98  * <ul>
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
116  *       virtual resources.
117  * </ul>
118  *
119  * @{
120  *
121  **/
122
123 /**
124  * frsh_feedback_set_spare()
125  *
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
129  * reservations.
130  *
131  * @note
132  * No threads must be ever attached to the contract identified by
133  * spare_id.
134  **/
135 int frsh_feedback_set_spare(const frsh_contract_t *spare_contract);
136
137 /**
138  * frsh_feedback_get_spare()
139  *
140  * Get version of the frsh_feedback_set_spare() function.
141  **/
142 int frsh_feedback_get_spare(frsh_contract_t *spare_contract);
143
144 /**
145  * frsh_feedback_set_desired_budget()
146  *
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:
153  *
154  * <ul>
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.
165  * </ul>
166  *
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
169  * negotiation.
170  *
171  * @note
172  * If the requested budget is higher than the maximum value negotiated
173  * for the vres, then an error is returned.
174  *
175  * @note
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.
181  *
182  * @param[in] p_budget_in
183  * The new budget to set as desired.
184  **/
185 int frsh_feedback_set_desired_budget(frsh_vres_id_t vres_id, struct timespec *p_budget_in);
186
187 /**
188  * frsh_feedback_get_desired_budget()
189  *
190  * Get version of the frsh_feedback_set_desired_budget() function.
191  *
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.
196  **/
197 int frsh_feedback_get_desired_budget(frsh_vres_id_t vres_id, struct timespec *p_budget_out);
198
199 /**
200  * frsh_feedback_get_actual_budget()
201  *
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.
206  **/
207 int frsh_feedback_get_actual_budget(frsh_vres_id_t vres_id, struct timespec *budget);
208
209 /*@}*/
210
211 #endif