From: mawhelan@afit.af.mil (Michael A. Whelan)
Subject: Dynamic Task Creation/Control
Originator: mawhelan@scgraph
Organization: Air Force Institute of Technology
Date: Thu, 20 Aug 1992 17:48:57 GMT

Wisdom Sought!

    I am currently working on my MS here at AFIT.  The title of my thesis
is "A Real-Time Intelligent System Architecture Implemented in Ada".  The
'direction' of the thesis is to provide a way to implement what are termed
'Real-Time AI Sytems' in Ada.  Generally, real-time AI systems only 
address the issue of agenda management, and not deadline guarentees.  I 
am trying to add the ability for the 'Intelligent' part to control, the
'real-time' part.
    Please do not ask for an definition of an 'intelligent' agent, I am not 
attempting to start a philosphical debate.  Also, the 'concept' of a 
real-time intelligent system is not new and I can provide references to 
anyone who asks.
    What I am currently attempting to do is allow for the dynamic creation, 
execution, scheduling, prioritzing, etc. of both periodic and 
non-periodic tasks.  I am assuming (well maybe not assuming but using an 
educated speculation) that most work done in an 'intelligent' system is 
done by 'procedural' processes/tasks.  The goal of the 'intelligent' part 
then is to figure out what 'procedural' part to execute and be able to 
have it done in real-time, meaning guaranteed deadlines.
    Periodic tasks are scheduled using a varity of 'scheduling policies' but
the underlying 'scheduling theory' is rate monotonic.  Because, I am 
assuming that I do not know a-priori what the periodic task set looks like,
(i.e. how many tasks, the periods or each, etc.) and because there is a 
limited number of priorites available, ( Verdix on a Sun gives me 100 ), 
the actual assigned priority depends on a scheduling policy.  Policies as 
they exist now are static, normal distribution, and linear.  Static as the
name implies assumes a predined non-dynamic priority assignment.  Normal 
distribution tries to achieve what the name implies; the closer to the mean 
period, the more tasks will have the same priority.  Linear tries to assign 
the fewest tasks to the highest priority and the most tasks to the lowest 
priority.  Non-periodic tasks are scheduled using some techniques for imprecise 
algorithms and since this is long enough already, I'll provide references if 
requested.
    The area where wisdom is needed deals with the dynamic creation of tasks. 
Since Ada tasking essential keeps the memory assigned to an access type
task until termination of the task that has the access type defined, I am 
forced to create a 'task-control-block' that keeps track of which tasks 
are currently being used.  In addition, I have to try and reuse these 
tasks for different 'procedural code'.  Any suggestions?
    Also, when 'it is decided' to terminate a task ( done normally because it
has passed it's deadline ), I need to reclaim the task-control-block and 
be able to reuse it.  However, I am at a loss to come up with a good way to 
insure it is in a known state.  Again, any suggestions?
    I know this short note has left a lot of unanswered questions, but I 
hope it is sufficent to give those of you wiser than I some idea of the 
problem domain.  If you have any thoughts you would like to share on the 
idea of dynamic task creation and control please do so.  It has been my 
experience that half the solution to any problem is asking the right people 
for ideas.


Capt Mike Whelan

e-mail: mawhelan@afit.af.mil
Newsgroups: comp.lang.ada