Resource Management: Budgeting
==============================

// please don't remove the //word: comments

[options="autowidth"]
|====================================
|*State*       | _Idea_
|*Date*        | _Fri Jul 23 20:33:32 2010_
|*Proposed by* | Christian Thaeter <ct@pipapo.org>
|====================================

[abstract]
******************************************************************************
The link:{rfc}/ResourceManagementProfiling.html[Profiler]
will give some Idea about how much Resources can be used to
optimally utilize the system. Knowing this number leads to the next challenge,
distributing the resources to different subsystems, jobs and objects. Here, I
introduce a budgeting system which takes care of this.
******************************************************************************


Description
-----------
//description: add a detailed description:

The idea is quite simple, for each kind of resource we have a global budget
manager which accounts for the available and used amounts of this resource.

Each user of a resource has its own account managing his share on the resource.

The system is completely voluntary giving only hints how much of a resource is
available for anyone.



Tasks
~~~~~
// List what would need to be done to implement this Proposal in a few words:
 * define a sufficiently well defined goal first, to describe
   what shall and can be achieved through budgeting ...
 * then develop a plausible model of suitable control and regulation mechanisms
 * very likely, practical tests will be required to show the feasibility of
   effective automatic regulation over a significant span of different
   use cases!



Discussion
~~~~~~~~~~

Pros
^^^^
// add just a fact list/enumeration which make this suitable:
//  * foo
//  * bar ...



Cons
^^^^
// fact list of the known/considered bad implications:



Alternatives
^^^^^^^^^^^^
//alternatives: if possible explain/link alternatives and tell why they are not viable:



Rationale
---------
//rationale: Describe why it should be done *this* way:



//Conclusion
//----------
//conclusion: When approved (this proposal becomes a Final) write some
//            conclusions about its process:




Comments
--------
//comments: append below


[source,C]
------------------------------------------------------------------------------
typedef ssize_t budget_count;

struct budgetmanager
{
  rwlock lock;
  
  void (*callback)();                   // called on resource shortage
  (resource collector)
    
  int sum_priorities;                   // sum of all client budgets .. each
  client is granted available/(sum_priorities/own_priority) of the resource
        
  budget_count available_prefs;         // configuration from preferences
  budget_count available_profile;       // tuned by profiler
  int available_factor;                 // how much % from prefs vs profile
              
  budget_count available;               // caclulated from above
  budget_count allocated;               // actively in use
};
                    
struct budget
{
  BudgetManager manager;
  int priority;
                        
  budget_count allocated;
};
------------------------------------------------------------------------------

ct:: '2010-07-23 20:55:49 CEST'
....
​
​
​
....


[[caveat]]
[underline]#Many years later,# I'd like to confirm that this RfC describes
a part of the *core vision*: +
the engine shall make best use of limited resources.

CAUTION: The same caveats as for the
         link:{rfc}/ResourceManagementProfiling.html#caveat[Profiling]
         do apply here as well...

I'd recommend to be extremely cautions to take any achievement for granted
for this topic, which is known to be notoriously difficult and insidious.
With _budgeting alone,_ we may be able to prevent overload of the system,
yet for anything beyond that, we need an actual optimisation strategy.

Ichthyostega:: '2025-09-17'



//endof_comments:




''''
Back to link:/x/DesignProcess.html[Lumiera Design Process overview]
