[saga-rg] Task model...

Pascal Kleijer k-pasukaru at ap.jp.nec.com
Fri Nov 11 00:02:53 CST 2005


Hello,

If you are working on a C++ model why work with flags? Simply use the 
power of the language and use inheritance. A core abstract class give 
the general common stuff and then you can derivate as wished to a 
synchronous and asynchronous class.

In that case the calls can remain the same but the behavior changes:

saga::directory d= new SynchronousDirectory()
or
saga::directory d= new AsynchronousDirectory()


std::list<string> l;
saga::task t = d.list(&l);
t.wait();
do something with l

In the synchronous case the list is filled up and in the asynchronous 
case the list will be filled only after the task has properly ended. 
Calling the wait on the sync task will directly return.

So:
1) You have uniformed calls.
2) You can overwrite the class without affecting the definition.
3) You can interchange the classes without touching your code.

Having the sync flag set on the fly and change the behavior might be 
very difficult to handle in case of race conditions. I'm used to code 
multi-tasked applications that often share numerous objects and changing 
    the sync/async behavior will be a real problem if you don't take 
care. Debug that sort of code is hell.

my 2ct.

'Andre Merzky' wrote:
> Hmm, I thought so as well, you know.  But actually, error
> conditions are flagged by excptions, so we would not return
> errors anyway.  So it does not matter if e.g.  mkdir_sync ()
> returns a task: it would not be used anyway. (If the task
> gets returned it is Finished.  If it failes, an error is
> thrown.)
> 
> OTOH, for calls which do return infos this is different:
> directory.ls ();  would normally return a list of strings  I
> guess.  With the proposed model, the list would need to be
> returned in I/O parameters, such as:
> 
>  std::list<string> l;
>  d.ls_sync (&l);
> 
> So, the problems are not error conditions, but return values
> I guess.  
> 
> However, similar considerations hold for the other task
> models: at least the signature of the method calls might
> look different for synchroneous and asynchroneous calls:
> 
>   sync in version B:
> 
>     std::list<string> l = d.sync.ls ();
> 
>   async in version B:
>   
>     std::list<string> l;
>     saga::task t = d.sync.ls (&l);
> 
> I created some more verbose examples at 
> 
>   http://wiki.cct.lsu.edu/saga/space/Task+Models
> 
> (see bottom of page) -- I hope that helps the discussion.
> Feel free to change/edit/correct them, and in fact to edit
> that page.
> 
> Again: the cuurent discussion does ONLY affect the C++
> language binding for now!
> 
> Cheers, Andre.
> 
> 
> 
> Quoting [Hartmut Kaiser] (Nov 08 2005):
>> The main question is, do we need to have different return values from
>> sync/async operations or not. It's kind of unusual to get a task from a
>> 'normal' sync operation, even more because this task is usable for return
>> value retrieval only.
>>
>> Regards Hartmut
> 
> 


-- 

Best regards,
Pascal Kleijer

----------------------------------------------------------------
   HPC Marketing Promotion Division, NEC Corporation
   1-10, Nisshin-cho, Fuchu, Tokyo, 183-8501, Japan.
   Tel: +81-(0)42/333.6389       Fax: +81-(0)42/333.6382





More information about the saga-rg mailing list