comp.lang.ada
 help / color / mirror / Atom feed
* Ada and shared memory question
@ 1994-12-26 22:40 Elgar the Idiot aka Chris Warwick
  1994-12-27 17:14 ` R. William Beckwith
  0 siblings, 1 reply; 2+ messages in thread
From: Elgar the Idiot aka Chris Warwick @ 1994-12-26 22:40 UTC (permalink / raw)


I have had very little luck getting system specific info, but the compiler is 
Verdix, and the OS is SCO UNIX...

Does anyone know how the Ada RTE usually implemented on non-threaded UNIX 
systems? Is it linked into each executable, or is some sort of shared library 
used?

We are trying to write an Oracle SQL procedure to call services provided by 
our Ada programs. The problem seems to be the Ada RTE code is not being 
correctly linked or referenced. One solution I thought of would be to place 
the code into a shared memory buffer, and provide a C front end to access the 
memory and call the service. Is this a reasonable use of shared memory? Can 
I do this in Ada? Has anyone out there tried this?

Any help would be greatly appreciated...



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Ada and shared memory question
  1994-12-26 22:40 Ada and shared memory question Elgar the Idiot aka Chris Warwick
@ 1994-12-27 17:14 ` R. William Beckwith
  0 siblings, 0 replies; 2+ messages in thread
From: R. William Beckwith @ 1994-12-27 17:14 UTC (permalink / raw)


Chris Warwick (cwarwick@fox.nstn.ns.ca) wrote:

: I have had very little luck getting system specific info, but the compiler is 
: Verdix, and the OS is SCO UNIX...

: Does anyone know how the Ada RTE usually implemented on non-threaded UNIX 
: systems?

A non-threaded Unix gives each process only one thread.  There are some
Ada compiler's (OC Systems) that can map each Ada task to a separate
process, but this is not the common implementation.  Most Ada tasking
kernels divvy up the one thread to multiple Ada tasks.

The Ada tasking kernels (usually) do the context switches among the Ada
tasks by using setjmp/longjmp to change stacks.  This is similiar to the
implementation methods used by other threading environments (DCE) when
on non-threaded O/S's.

In addition, the Ada RTE's usually support timeslicing by scheduling
SIGALARM's frequently to allow for a context switch.

There are three hurdles you face when using C code (SQL, O/S, GUI, et al)
that was not built to support multiple threads with Ada tasks in this
kind of Ada RTE implementation:

    1.	blocking - usually the C code calls select or a blocking I/O
	operation that will cause the Unix kernel to stop timeslicing
	or block all of the tasks in that process

    2.	non-reentrant C code - most C code was not written with threads
	in mind and thus has many global states (variables) that can get
	out of sync with multiple threads

    3.	no object protection - you can't update the same C object from
	multiple Ada tasks since there is no semaphore in the C code
	to coordinate access

A good binding written by someone with access to the C source should
address most or all of these issues.

: Is it linked into each executable, or is some sort of shared library 
: used?

Every Ada compiler I've seen statically links the RTE into the executable.

: We are trying to write an Oracle SQL procedure to call services provided by 
: our Ada programs. The problem seems to be the Ada RTE code is not being 
: correctly linked or referenced. One solution I thought of would be to place 
: the code into a shared memory buffer, and provide a C front end to access the 
: memory and call the service. Is this a reasonable use of shared memory? Can 
: I do this in Ada? Has anyone out there tried this?

Are you trying to use tasking with the Oracle client?  Or is the full
extent of the problem a link error?  I have heard of others having
problems linking with Oracle, but I don't know the details.

... Bill



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1994-12-27 17:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-12-26 22:40 Ada and shared memory question Elgar the Idiot aka Chris Warwick
1994-12-27 17:14 ` R. William Beckwith

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