home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.ada
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!menudo.uh.edu!lobster!nuchat!leeweyr!bill
- From: bill@leeweyr.sccsi.com (Bill Lee)
- Subject: Using Shared memory from Ada code.
- Message-ID: <1992Dec23.040144.7581@leeweyr.sccsi.com>
- Organization: Lee Aerie
- Date: Wed, 23 Dec 1992 04:01:44 GMT
- Lines: 82
-
-
- I have a couple of questions needing serious answers.
-
- First question:
-
- At work, we are developing a rather large, near-realtime application
- in Ada. The application will consist of several processes (POSIX
- environment eventually, UNIX for the time being) with shared memory
- to be attached among all of the processes.
-
- I have read an early version of Ted Baker's report which served as
- the basis for the 1003.20 efforts. In that paper, Ted has the
- following comments concerning shared memory:
-
- "...There is uncertainty about whether the compiler will generate code that
- reads and writes data through to memory. In the absence of pragmas specifying
- otherwise, ... there is no guarantee that a reference or assignment to a
- shared memory object in the Ada source code will result in a compiler
- generating actual read or write operations to memory......"
-
- O.k, the question: How do I use shared memory in my Ada programs
- so that the above concerns are mitigated? How do I make SURE that
- every reference to a shared memory object actually uses the shared
- memory?
-
-
-
- Second question:
-
- In the 1003.20 Ada binding we get functions which return System.Address
- values. I want to put an Ada object at the address so that all
- future references to the object are actually referencing the shared
- memory. How?
-
- I would like something like the following to work (perhaps it will, the
- DEC Ada compiler swallowed it!):
-
- --------------------------------------------------------------------------------
- with System;
- procedure Test is
-
- type Structures is
- record
- Name: string(1..20);
- Status : boolean := false;
- end record;
- type Structure_Lists is array (integer range <> ) of Structures;
-
- Shared_Mem_Address : System.address;
- List_Length : constant integer := 100;
- The_List : Structure_Lists(1..List_Length);
-
-
- function Attach ( An_Address : in System.address;
- Length : in integer ) return Structure_Lists is
- A_List : Structure_Lists ( 1..Length);
- for A_List use at An_Address;
- begin
- return A_List;
- end Attach;
-
- begin
- .
- .
- -- Somehow get a shared memory address into Shared_Mem_Address
- The_List := Attach ( Shared_Mem_Address, List_Length );
- .
- .
- The_List(Index).Status := true;
- .
- .
- -- and so forth
- end Test;
- --------------------------------------------------------------------------------
-
- The question can be simply put: how do I put an Ada object at an address
- in shared memory?
-
-
- Regards,
-
- Bill Lee
-