[comp.lang.ada] The ADA Rendevous

tfrancis@wpi.wpi.edu (Krishan M Nainani) (08/18/89)

[1mHi[m,

	I have a question about the Ada rendevous. 

	There are many tasks each with 1 entry and these tasks are scheduled
by calling a global scheduler from inside the entry call. So, initially any 
task is chosen and its entry is accepted and somewhere within the entry there 
is a call to the scheduler (which is global to these tasks). Next, the 
scheduler checks a data-structure which contains the varying importances of 
each task and then it executes that task's entry. This can be done.

But I am unsure as to how I can encode the following restriction which is 
illustrated in the following example:

	Task A was chosen to run and so it was entered at entry point AA.
Within the code of AA, there was a call to the scheduler which found that
task B is more important than task A and so task A should be suspended and
task B is entered at entry point BB. Within BB, there was a call to the 
scheduler which determined that task C (entry CC) should now run. Within CC,
it was found that task A (entry AA) is the most important and should be run 
now. HOWEVER, task A should be resumed at where it left off (i.e where it was
suspended). THIS IS THE PART THAT I DON'T KNOW HOW TO ENCODE IN ADA.
	This seems to involve manipulating the global task queue at runtime.
I doubt if I can do this in standard Ada but is it possible to accomplish 
this by interfacing to C (not Assembler) ? 

	[5;7mAnyone have any clues whatsoever?[m

Krishan Nainani	(tfrancis@wpi.wpi.edu)

	
	

rracine@ajpo.sei.cmu.edu (Roger Racine) (08/26/89)

In article <3567@wpi.wpi.edu> tfrancis@wpi.wpi.edu (Krishan M Nainani) writes:
>
>	There are many tasks each with 1 entry and these tasks are scheduled
>by calling a global scheduler from inside the entry call. So, initially any 
>task is chosen and its entry is accepted and somewhere within the entry there 
>is a call to the scheduler (which is global to these tasks). Next, the 
>scheduler checks a data-structure which contains the varying importances of 
>each task and then it executes that task's entry. This can be done.
>
>But I am unsure as to how I can encode the following restriction which is 
>illustrated in the following example:
>
>	Task A was chosen to run and so it was entered at entry point AA.
>Within the code of AA, there was a call to the scheduler which found that
>task B is more important than task A and so task A should be suspended and
>task B is entered at entry point BB. Within BB, there was a call to the 
>scheduler which determined that task C (entry CC) should now run. Within CC,
>it was found that task A (entry AA) is the most important and should be run 
>now. HOWEVER, task A should be resumed at where it left off (i.e where it was
>suspended). THIS IS THE PART THAT I DON'T KNOW HOW TO ENCODE IN ADA.
>	This seems to involve manipulating the global task queue at runtime.
>I doubt if I can do this in standard Ada but is it possible to accomplish 
>this by interfacing to C (not Assembler) .

 What would you like to interface to?  The task scheduler?  I do not know
if the vendors give you access to that unless you have the source to the
runtime system.  If you do not, ask the vendor if there is a way to
interface to their RTS.  Better yet, ask them to implement dynamic priorities
(which seems to be what you really want).  If you have the source, the best
thing to do would be to implement dynamic priorities (this is fairly easy,
since it must already exist for rendezvous.  All you have to do is get it
visible).  

After you have dynamic priorities, be sure NOT to use the normal Ada
pragma PRIORITY (those priority values are supposed to be static) for the
tasks which need to have their priority values changed.  The scheduler would
then just modify the priorities (it being run at the highest priority) and
return to the caller.  The task scheduler would handle the rest.

By the way, the SIGAda Ada RunTime Environment Working Group (ARTEWG) has
a document called the Catalog of Implementation Features and Options
which contains an interface definition for this, if you want at least
some semblance of standardization.  If you are interested, I would be
glad to forward a request for the document to the chairman of the ARTEWG.

By the way (again), why would you think that C could interface to an Ada
scheduler easier than Ada?  Are you using a product with a C RTS?

Good luck.

Roger Racine
C.S. Draper Lab.
rracine@ajpo.sei.cmu.edu