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

Generated on Mon Dec 1 16:21:56 2003 for CPUBroker by doxygen 1.3.4