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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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: Jonas Nygren Subject: Re: [Q]: Distributed System Annex DSA Date: 1996/09/09 Message-ID: <32343D67.5E2D@ehs.ericsson.se> X-Deja-AN: 179466749 references: <3233EF42.702C@ehs.ericsson.se> content-type: text/plain; charset=us-ascii organization: Ericsson Hewlett-Packard Telecommunications AB mime-version: 1.0 reply-to: ehsjony@ehs.ericsson.se newsgroups: comp.lang.ada x-mailer: Mozilla 3.0b5a (WinNT; I) Date: 1996-09-09T00:00:00+00:00 List-Id: 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 > 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? If not, > how does the compiler know that Tape_Server's interfaces > (Copy, Rewind) should be constructed to receive remote calls? > > 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? > > 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. > > 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;