comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: [Q]: Distributed System Annex DSA
Date: 1996/09/10
Date: 1996-09-10T00:00:00+00:00	[thread overview]
Message-ID: <DxIzB7.MsG@world.std.com> (raw)
In-Reply-To: 32343D67.5E2D@ehs.ericsson.se


In article <32343D67.5E2D@ehs.ericsson.se>,
Jonas Nygren  <ehsjony@ehs.ericsson.se> wrote:
>I referred to the wrong package in my first question which
>made it self answering. Pls see below for correction.
>
>Jonas Nygren wrote:
>> 
>> For Gnat there now is a release of support for DSA. So I thought
>> it was time to get an understanding what DSA can do for me. I have
>> a few questions around this topic after trying to understand what
>> the Rational and the RM's texts on this feature. (If you can point me
>> to some more good educational text for DSA I would appreciate that.)
>> 
>> Now to my questions for which I use the example of Tape_Driver given
>> in Annex E of the RM. I attach the code from the RM at the end of
>> this posting.
>> 
>> 1)  When I studied this example I got the impression that the three
>>     parts Name_Server, Tape_Server and Tape_Client all could run
>>     in different partitions (and on different nodes). What confuses
>>     me is that the Name_Server does not have any 'pragma
>
>                      ^ ^  Ouch, it should have been Tape_Server

I see no Tape_Server in the code you quoted.  I assume you mean
Tape_Driver?  (Ouch again?  ;-))

>>     Remote_Call_Interface' and in the explaining text it is referred
>>     to as a 'normal package'. Does this imply that Tape_Client and
>>     Tape_Server must be co-located in the same partition? 

Tape_Driver and Tape_Client do not need to be in the same partition.

>...If not,
>>     how does the compiler know that Tape_Server's interfaces
>>     (Copy, Rewind) should be constructed to receive remote calls?

It doesn't need to.  Tape_Ptr is a remote access type, because of where
it's declared.  Normally, a pointer to a tagged type would be
represented as a pointer to the object.  The object contains a tag,
which is a pointer to the type descriptor, which contains pointers to
all the primitive operations.  But for a remote access type, the
compiler must do something different -- I think the best strategy is to
make the pointer point to a dummy object (on the same partition as the
pointer, of course).  Thus dummyy object has a tag, but instead of
pointing to the "real" type descriptor, it points to one which has
pointers to subprograms that send a message to the place where the
"real" object is located.  The "real" object, off on the other node,
doesn't need to know that it is being called remotely.

Make sense?

>> 2)  I have come to regard the package Tapes as the 'contract' of
>>     a tape service. Would this be the right place to enforce
>>     constraint and state checks to strengthen the consistency
>>     of the interface. State information would then be stored in
>>     the Tape (tagged) record. Are there any negative consequences
>>     in this approach and are there better ways to do this?

Sounds reasonable.

>> 3)  With CORBA and other similar technologies there is often much
>>     discussions on the need for threads in servers. My third question
>>     is about if and how one can use Ada tasks to achieve this in
>>     one remote active partition.
>> 
>>     One example in the Rationale showed how one could link together
>>     a number of active Worker partitions with a Controller partition
>>     and how these partitions could be distributed on different nodes.
>>     But nothing with tasks involved.
>> 
>>     My question is really if it is possible to multi-plex several
>>     service sessions on one partition. E.g. If Client A and B issues
>>     requests to the server 'at the same time' - how do I design the
>>     server so that these two calls can be overlapping and executed in
>>     parallel.

You can declare multiple tasks in a partition, as usual.

Also, the PCS is normally implemented with tasks, so that multiple
requests can be serviced simultaneously.

>> Any help appreciated!
>> 
>> Thanks in advance,
>> 
>> /jonas
>> 
>> -- Tape example from Ada RM e.4.2
>> 
>> (2)
>>        package Tapes is
>>           pragma Pure(Tapes);
>>           type Tape is abstract tagged limited private;
>>           -- Primitive dispatching operations where
>>           -- Tape is controlling operand
>>           procedure Copy (From, To : access Tape; Num_Recs : in Natural)
>> is abstract;
>>           procedure Rewind (T : access Tape) is abstract;
>>           -- More operations
>>        private
>>           type Tape is ...
>>        end Tapes;
>> (3)
>>        with Tapes;
>>        package Name_Server is
>>           pragma Remote_Call_Interface;
>>           -- Dynamic binding to remote operations is achieved
>>           -- using the access-to-limited-class-wide type Tape_Ptr
>>           type Tape_Ptr is access all Tapes.Tape'Class;
>>           -- The following statically bound remote operations
>>           -- allow for a name-server capability in this example
>>           function  Find     (Name : String) return Tape_Ptr;
>>           procedure Register (Name : in String; T : in Tape_Ptr);
>>           procedure Remove   (T : in Tape_Ptr);
>>           -- More operations
>>        end Name_Server;
>> (4)
>>        package Tape_Driver is
>>          -- Declarations are not shown, they are irrelevant here
>>        end Tape_Driver;
>> (5)
>>        with Tapes, Name_Server;
>>        package body Tape_Driver is
>>           type New_Tape is new Tapes.Tape with ...
>>           procedure Copy
>>            (From, To : access New_Tape; Num_Recs: in Natural) is
>>           begin
>>             . . .
>>           end Copy;
>>           procedure Rewind (T : access New_Tape) is
>>           begin
>>              . . .
>>           end Rewind;
>>           -- Objects remotely accessible through use
>>           -- of Name_Server operations
>>           Tape1, Tape2 : aliased New_Tape;
>>        begin
>>           Name_Server.Register ("NINE-TRACK",  Tape1'Access);
>>           Name_Server.Register ("SEVEN-TRACK", Tape2'Access);
>>        end Tape_Driver;
>> (6)
>>        with Tapes, Name_Server;
>>        -- Tape_Driver is not needed and thus not mentioned in the
>> with_clause
>>        procedure Tape_Client is
>>           T1, T2 : Name_Server.Tape_Ptr;
>>        begin
>>           T1 := Name_Server.Find ("NINE-TRACK");
>>           T2 := Name_Server.Find ("SEVEN-TRACK");
>>           Tapes.Rewind (T1);
>>           Tapes.Rewind (T2);
>>           Tapes.Copy (T1, T2, 3);
>>        end Tape_Client;

- Bob




  reply	other threads:[~1996-09-10  0:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-09-09  0:00 [Q]: Distributed System Annex DSA Jonas Nygren
1996-09-09  0:00 ` Samuel Tardieu
1996-09-09  0:00 ` Jonas Nygren
1996-09-10  0:00   ` Robert A Duff [this message]
1996-09-12  0:00     ` Jonas Nygren
1996-09-12  0:00       ` Robert A Duff
1996-09-13  0:00         ` Philip Brashear
1996-09-21  0:00           ` Robert Dewar
1996-09-21  0:00           ` Robert Dewar
1996-09-26  0:00             ` Dale Stanbrough
1996-09-12  0:00   ` Samuel Tardieu
1996-09-13  0:00   ` Jon S Anthony
  -- strict thread matches above, loose matches on Subject: below --
1996-09-21  0:00 Douglas Rupp
1996-09-24  0:00 ` Mark A Biggar
1996-09-24  0:00 ` Mike Stark
1996-09-24  0:00 ` Art Schwarz
1996-09-25  0:00 ` Alan Brain
1996-09-21  0:00 Douglas Rupp
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox