comp.lang.ada
 help / color / mirror / Atom feed
From: agate!spool.mu.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!menudo.uh.edu!lob ster!nuchat!leeweyr!bill@ucbvax.Berkeley.EDU  (Bill Lee)
Subject: Using Shared memory from Ada code.
Date: 23 Dec 92 04:01:44 GMT	[thread overview]
Message-ID: <1992Dec23.040144.7581@leeweyr.sccsi.com> (raw)

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

             reply	other threads:[~1992-12-23  4:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-12-23  4:01 agate!spool.mu.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!menudo.uh.edu!lob [this message]
  -- strict thread matches above, loose matches on Subject: below --
1992-12-23 14:39 Using Shared memory from Ada code MILLS,JOHN M.
replies disabled

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