Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

Broker.idl

Go to the documentation of this file.
00001 /*
00002  * Broker.idl
00003  *
00004  * Copyright (c) 2003 The University of Utah and the Flux Group.
00005  * All rights reserved.
00006  *
00007  * This file is licensed under the terms of the GNU Public License.  
00008  * See the file "license.terms" for restrictions on redistribution 
00009  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
00010  */
00011 
00012 /**
00013  * @file Broker.idl
00014  *
00015  * IDL for the CPU Broker.
00016  */
00017 
00018 #ifndef _broker_idl
00019 #define _broker_idl
00020 
00021 /**
00022  * Root name space for the CPU Broker.
00023  */
00024 module Broker
00025 {
00026     /**
00027      * The NamedValue structure is used to construct variable length argument
00028      * lists for some methods.
00029      */
00030     struct NamedValue {
00031         string name;    /**< The symbolic name for the value. */
00032         any value;      /**< The parameter value. */
00033     };
00034 
00035     /**
00036      * Sequence of NamedValue's used when creating a task.
00037      */
00038     typedef sequence<NamedValue> TaskParameters;
00039 
00040     /**
00041      * Sequence of NamedValue's used when beginning a scheduling period.
00042      */
00043     typedef sequence<NamedValue> ScheduleParameters;
00044     
00045     /**
00046      * Exception thrown when an internal error occurs.
00047      */
00048     exception Internal {
00049         string message; /**< A detailed description of the problem. */
00050     };
00051 
00052     /**
00053      * Exception thrown when an invalid parameter is passed in a TaskParameters
00054      * list.
00055      */
00056     exception InvalidTaskParameter {
00057         string message;         /**< A detailed description of the problem. */
00058         NamedValue pair;        /**< The invalid parameter pair. */
00059     };
00060 
00061     /**
00062      * Exception thrown when a required parameter is missing from the
00063      * TaskParameters list.
00064      */
00065     exception MissingTaskParameter {
00066         string name;            /**< The name of the missing parameter. */
00067     };
00068 
00069     /**
00070      * Exception thrown when a duplicate parameter is found in the
00071      * TaskParameters list.
00072      */
00073     exception DuplicateTaskParameter {
00074         string name;            /**< The name of the duplicate parameter. */
00075     };
00076 
00077     /**
00078      * Exception thrown when an invalid parameter is passed in a
00079      * ScheduleParameters list.
00080      */
00081     exception InvalidScheduleParameter {
00082         string message;         /**< A detailed description of the problem. */
00083         NamedValue pair;        /**< The invalid parameter pair. */
00084     };
00085 
00086     /**
00087      * Exception thrown when a required parameter is missing from the
00088      * ScheduleParameters list.
00089      */
00090     exception MissingScheduleParameter {
00091         string name;            /**< The name of the missing parameter. */
00092     };
00093 
00094     /**
00095      * Exception thrown when a duplicate parameter is found in the
00096      * ScheduleParameters list.
00097      */
00098     exception DuplicateScheduleParameter {
00099         string name;            /**< The name of the duplicate parameter. */
00100     };
00101 
00102     /**
00103      * XXX fill me in.
00104      */
00105     exception InvalidState {
00106         string message;         /**< A detailed description of the problem. */
00107     };
00108 
00109     /**
00110      * Exception thrown when an invalid status value is received by the
00111      * implementation.
00112      */
00113     exception InvalidStatus {
00114         string message;         /**< A detailed description of the problem. */
00115         unsigned long status;   /**< The invalid status value. */
00116     };
00117 
00118     /* Forward declaration for the overall task manager. */
00119     interface Manager;
00120 
00121     /**
00122      * The Task interface encapsulates the per-process resource usage detection
00123      * policy.
00124      */
00125     interface Task
00126     {
00127         /**
00128          * The name of the task.  Mostly useful for debugging.
00129          */
00130         readonly attribute string Name;
00131 
00132         /**
00133          * Begin CPU scheduling for this task with the given parameters.
00134          *
00135          * @param man The resource manager that will handle scheduling
00136          *            during contention.
00137          * @param cs The high level scheduling parameters.
00138          *
00139          * @exception DuplicateScheduleParameter if the given schedule has a
00140          *            duplicate parameter.
00141          * @exception InvalidScheduleParameter if the given schedule has an
00142          *            invalid parameter.
00143          * @exception MissingScheduleParameter if the given schedule is missing
00144          *            a required parameter.
00145          * @exception CORBA::BAD_INV_ORDER if the method is called without
00146          *            intervening calls to EndCPUScheduling().
00147          */
00148         void BeginCPUScheduling(in Manager man, in ScheduleParameters cs)
00149             raises(DuplicateScheduleParameter,
00150                    InvalidScheduleParameter,
00151                    MissingScheduleParameter);
00152 
00153         /**
00154          * End CPU scheduling for this task.
00155          *
00156          * @exception CORBA::BAD_INV_ORDER if the method is called without
00157          *            BeginCPUScheduling() being called first.
00158          */
00159         void EndCPUScheduling();
00160     };
00161 
00162     /**
00163      * List of tasks.
00164      */
00165     typedef sequence<Task> TaskList;
00166 
00167     /**
00168      * The RealTimeTask interface encapsulates scheduling parameters for tasks
00169      * that have real-time requirements.
00170      *
00171      * @sa RKTask
00172      * @sa RealTimeTaskDelegateImpl
00173      */
00174     interface RealTimeTask : Task
00175     {
00176         /**
00177          * The period, in microseconds.
00178          */
00179         readonly attribute unsigned long Period;
00180 
00181         /**
00182          * The deadline, in microseconds, relative to the start of the period.
00183          */
00184         readonly attribute unsigned long Deadline;
00185         
00186         /**
00187          * @return The number of microseconds of compute time.
00188          */
00189         unsigned long GetComputeTime();
00190 
00191         /**
00192          * @param usecs The number of microseconds of compute time.
00193          */
00194         void SetComputeTime(in unsigned long usecs);
00195 
00196         /**
00197          * Method used by the application to report its actual CPU usage.  This
00198          * method would then be used by adaptation proxies to change the advice
00199          * parameter to their liking.
00200          *
00201          * @param rtt The task object that was actually added to the manager.
00202          * @param status The CPU usage of the task in microseconds.
00203          * @param advice The amount of CPU time, in microseconds, that the
00204          * application would like for the next period.
00205          *
00206          * @sa ChangeTaskCPU
00207          */
00208         void ReportCPU(in RealTimeTask rtt,
00209                        in unsigned long status,
00210                        in unsigned long advice);
00211     };
00212 
00213     /**
00214      * A TaskFactory provides an interface for processes to request resource
00215      * management by a task.
00216      *
00217      * @sa TaskFactoryTemplate
00218      * @sa ExactTaskFactory
00219      */
00220     interface TaskFactory
00221     {
00222         /**
00223          * Create a new Task object.
00224          *
00225          * @param tp The description of the task.
00226          * @return A new Task object.
00227          *
00228          * @exception DuplicateTaskParameter if the given schedule has a
00229          *            duplicate parameter.
00230          * @exception InvalidTaskParameter if the given schedule has an
00231          *            invalid parameter.
00232          * @exception MissingTaskParameter if the given schedule is missing
00233          *            a required parameter.
00234          */
00235         Task CreateTask(in TaskParameters tp)
00236             raises(DuplicateTaskParameter,
00237                    InvalidTaskParameter,
00238                    MissingTaskParameter);
00239     };
00240 
00241     /**
00242      * A Policy provides an interface for objects that can manage contention
00243      * for a resource.
00244      *
00245      * @sa StrictPolicy
00246      */
00247     interface Policy
00248     {
00249         /**
00250          * The name of the policy.  Mostly useful for debugging.
00251          */
00252         readonly attribute string Name;
00253         
00254         /**
00255          * Add a task to an active policy.  @e NOTE: This method will be called
00256          * @e before the reservation is made, giving the policy a chance to
00257          * adjust any values.
00258          *
00259          * @sa RemoveTask
00260          *
00261          * @param new_task The newly created Task object.
00262          * @param sp The tasks's scheduling parameters.
00263          *
00264          * @exception CORBA::BAD_PARAM if task is nil.
00265          * @exception CORBA::BAD_PARAM if task has already been added.
00266          * @exception CORBA::BAD_INV_ORDER if the method is called without
00267          *            Activate() being called first.
00268          */
00269         void AddTask(in Task new_task, in ScheduleParameters sp);
00270 
00271         /**
00272          * Remove a task from an active policy.  @e NOTE: This method will be
00273          * called @e after the reservation has been destroyed, so it can
00274          * safely reallocate the newly freed CPU time.
00275          *
00276          * @sa AddTask
00277          *
00278          * @param added_task The task to remove.
00279          *
00280          * @exception CORBA::BAD_PARAM if task is nil.
00281          * @exception CORBA::BAD_PARAM if task has already been removed.
00282          * @exception CORBA::BAD_INV_ORDER if the method is called without
00283          *            Activate() being called first.
00284          */
00285         void RemoveTask(in Task added_task);
00286 
00287         /**
00288          * @return The list of task's managed by this policy.
00289          */
00290         TaskList GetTaskList();
00291         
00292         /**
00293          * Activate the policy.  @e NOTE: The policy is expected to discover
00294          * and adjust the scheduling parameters of any currently executing
00295          * tasks.
00296          *
00297          * @sa Deactivate
00298          *
00299          * @param tasks The list of tasks the policy needs to manage.
00300          *
00301          * @exception CORBA::BAD_INV_ORDER if the method is called without
00302          *            intervening calls to Deactivate().
00303          */
00304         void Activate(in TaskList tasks);
00305 
00306         /**
00307          * Deactivate an active policy.  @e NOTE: The policy should @e change
00308          * any scheduling parameters of the currently executing tasks, the
00309          * next policy to be activated will handle any changes.
00310          *
00311          * @sa Deactivate
00312          *
00313          * @exception CORBA::BAD_INV_ORDER if the method is called on an
00314          *            inactive policy.
00315          */
00316         void Deactivate();
00317 
00318         /**
00319          * @param task The Task object requesting a CPU time change.
00320          * @param ct The Task's current CPU time.
00321          * @param status The status value reported by Task.ReportCPU().
00322          * @param advice The CPU time advice from the Task object.
00323          */
00324         void ChangeTaskCPU(in RealTimeTask task,
00325                            in unsigned long ct,
00326                            in unsigned long status,
00327                            in unsigned long advice)
00328             raises(InvalidState);
00329     };
00330 
00331     /**
00332      * The Manager interface is a point of indirection for the Tasks that wish
00333      * to be scheduled by a contention policy.
00334      *
00335      * @sa ManagerImpl
00336      */
00337     interface Manager
00338     {
00339         /**
00340          * The current policy to use when handling CPU time change requests.
00341          * If this value is nil, the manager will implement a straightforward
00342          * default policy.
00343          */
00344         attribute Policy CurrentPolicy;
00345 
00346         /** @copydoc Broker::Policy::AddTask */
00347         void AddTask(in Task new_task, in ScheduleParameters sp)
00348             raises(DuplicateScheduleParameter,
00349                    InvalidScheduleParameter,
00350                    MissingScheduleParameter);
00351 
00352         /** @copydoc Broker::Policy::RemoveTask */
00353         void RemoveTask(in Task added_task);
00354 
00355         /** @copydoc Broker::Policy::GetTaskList */
00356         TaskList GetTaskList();
00357 
00358         /**
00359          * @copydoc Broker::Policy::ChangeTaskCPU
00360          *
00361          * Note: If there is no policy set, the manager will simply call
00362          * SetComputeTime() on the given task with the given advice.
00363          */
00364         void ChangeTaskCPU(in RealTimeTask task,
00365                            in unsigned long ct,
00366                            in unsigned long status,
00367                            in unsigned long advice)
00368             raises(InvalidState);
00369     };
00370 };
00371 
00372 #endif

Generated on Mon Dec 1 16:29:06 2003 for CPU Broker by doxygen 1.3.4