From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ddc3fe6a39c3123d X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: [Q]: Distributed System Annex DSA Date: 1996/09/10 Message-ID: X-Deja-AN: 179741576 references: <3233EF42.702C@ehs.ericsson.se> <32343D67.5E2D@ehs.ericsson.se> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-09-10T00:00:00+00:00 List-Id: In article <32343D67.5E2D@ehs.ericsson.se>, Jonas Nygren 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