comp.lang.ada
 help / color / mirror / Atom feed
* Ada & UNIX
@ 1994-09-26 18:12 Scott Catterill
  1994-09-27 10:44 ` Tucker Taft
  1994-09-27 13:49 ` James Hopper
  0 siblings, 2 replies; 6+ messages in thread
From: Scott Catterill @ 1994-09-26 18:12 UTC (permalink / raw)



I don't think my original posting made it out, so this is a repost..
(Sorry if this shows up as a dupe!).

Greetings..

I have a some concerns regarding Ada programming under UNIX.
I would appreciate any feedback from any of you gurus out there.

1. How do Ada tasks and Unix processes co-exist?

2. How do Ada tasks behave when interacting with Unix utilities?
   For example, do serial inputs suspend an Ada task or a Unix process?

3. How can mutual exclusion over data be implemented between Ada tasks and
   Unix processes?

4. How do Ada subprograms interface with Unix processes?  For example, Unix
   pipes and streams are often used in C programs.  How are these accessed
   from Ada?  Should they be?

5. How do Ada task priorities and Unix process priorities interact?

6. What can make Ada tasks and Unix processes behave non-deterministically in
   space or time?

7. What are the effects of virtual memory?

8. How is memory organized and allocated?  Can memory be shared between
   processes and tasks?

9. How are peripheral devices controlled and accessed from Ada tasks and Unix
   processes?


Any responses are appreciated, including pointers to sites or other available
references..   Many thanks.


Scott Catterill

--
-----------------------------------------------------------
  ------Scott Catterill:  aa355@freenet.carleton.ca------
    -----Sysop: Heart of Gold BBS: (613) 831-1973 ----- 
       ----------------------------------------------



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

* Re: Ada & UNIX
  1994-09-26 18:12 Ada & UNIX Scott Catterill
@ 1994-09-27 10:44 ` Tucker Taft
  1994-09-27 13:49 ` James Hopper
  1 sibling, 0 replies; 6+ messages in thread
From: Tucker Taft @ 1994-09-27 10:44 UTC (permalink / raw)


In article <Cwr188.J6C@freenet.carleton.ca>,
Scott Catterill <aa355@FreeNet.Carleton.CA> wrote:

> ...
>I have a some concerns regarding Ada programming under UNIX.
>I would appreciate any feedback from any of you gurus out there.

As a general comment, these questions are almost all implementation-specific,
since the definition of the language does not force a particular
mapping to a given set of O/S features.  However, there is enough
commonality among implementations to give at least partial answers.
>
>1. How do Ada tasks and Unix processes co-exist?

In most implementations, the execution of an Ada "program" results
in a single Unix process, with all tasks "inside" that single process.
In some implementations, multiple Unix processes are used, essentially
like "logical processors."   In these cases, when one of the Unix
processes becomes idle, it selects the next task from the ready queue
to execute.  Many implementations are now moving toward using "threads"
to support Ada tasking, when the Unix O/S supports them.  Threads
are a very close match to Ada tasks, in that they share the same address
space and other process resources, just like Ada tasks, but when
one thread does a system call, only that thread is suspended.

>2. How do Ada tasks behave when interacting with Unix utilities?
>   For example, do serial inputs suspend an Ada task or a Unix process?

This also depends on the implementation.  In implementations that
use multiple processes, or multiple threads, then only the process
or thread that is executing the task is suspended inside a system call.
On single-process/single-thread implementations, asynchronous forms
of system calls are sometimes used to avoid suspending the whole process.
If the asynchronous forms are not available or not used, then the
whole process suspends on a system call in single-process/single-thread
implementations.

>3. How can mutual exclusion over data be implemented between Ada tasks and
>   Unix processes?

You can use Unix/Posix mutexes if you want.  There is no particular
magic here.  Perhaps you have something more specific in mind...

>4. How do Ada subprograms interface with Unix processes?  For example, Unix
>   pipes and streams are often used in C programs.  How are these accessed
>   from Ada?  Should they be?

Pipes and streams can certainly be used with Ada, particularly since
they generally just appear as I/O.  There is an Ada binding available
to essentially all Unix system calls, called "Posix/Ada."  If it
is not available from your vendor, you can write your own bindings
for the systems calls of interest, using pragma Interface.

>5. How do Ada task priorities and Unix process priorities interact?

There is generally no connection.  Ada task priorities are within-process
priorities.  Unix process priorities are between-process priorities.
In some environments where Unix processes support multiple threads,
it is possible to have a closer interaction.  For example, the Ada
task priority might become the Unix thread priority, and if that
priority is in the "real-time thread" range, it has some between-process
significance.

>6. What can make Ada tasks and Unix processes behave non-deterministically in
>   space or time?

Almost all multithreaded systems are nondeterministic, because the
relative rate of progress of the various threads is not fully
determined by priority.  You can increase the level of determinism
by using a strict run-until-blocked scheduler, with each thread
having its own priority level.  A few "real-time" Unix systems provide
some "real-time" priority levels that have such nearly-deterministic
scheduling.  The default scheduling model in Ada is strictly
priority-based, so if you make sure each task has its own priority
level, then scheduling within process will be nearly deterministic.
But of course if a task performs I/O, or delays for a period of time
that depends on external factors, then you introduce nondeterminism
due to the nondeterminism of the external environment.

>7. What are the effects of virtual memory?

Nothing special for Ada.  However, if you are worried about
real-time, then this is an O/S question.  You will probably
want a "real-time" Unix process to be locked into memory.

>8. How is memory organized and allocated?  Can memory be shared between
>   processes and tasks?

Tasks are part of processes, in general.  A Unix process represents
a virtual address space.  Tasks within a given Ada program share
access to that space.  Task stacks are allocated out of that space.

>9. How are peripheral devices controlled and accessed from Ada tasks and Unix
>   processes?

In the usual Unix way -- via system calls and sometimes signals.

>Any responses are appreciated, including pointers to sites or other available
>references..   Many thanks.

You should probably get your hands on a Posix/Ada description.

>  ------Scott Catterill:  aa355@freenet.carleton.ca------
>    -----Sysop: Heart of Gold BBS: (613) 831-1973 ----- 

S. Tucker Taft   stt@inmet.com
Intermetrics, Inc.
Cambridge, MA  02138



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

* Re: Ada & UNIX
  1994-09-26 18:12 Ada & UNIX Scott Catterill
  1994-09-27 10:44 ` Tucker Taft
@ 1994-09-27 13:49 ` James Hopper
  1 sibling, 0 replies; 6+ messages in thread
From: James Hopper @ 1994-09-27 13:49 UTC (permalink / raw)




>I have a some concerns regarding Ada programming under UNIX.
>I would appreciate any feedback from any of you gurus out there.


Scott,

I can only answer for the SGI MP ada as thats what i have used, but i 
understand that mp ada exists for sun now as well. My knowledge of
unix systems is limited to my current project as well.

>1. How do Ada tasks and Unix processes co-exist?
On the sgi ada tasks, threads, light weight processes seem to be one and
the same.
ada tasks can be assigned to an SPROC which appears to be the same as a
unix
process. at least when i do a ps (show processes) on the console i see an
entry for each sproc i generate.

>2. How do Ada tasks behave when interacting with Unix utilities?
>   For example, do serial inputs suspend an Ada task or a Unix process?
kind of depends does it block in c? if not it probably does not in Ada
Using the MP threads/SPROC concept if i do blocking io, the sproc is hung
but i have the option of allowing the ada task to float from sproc to
sproc
so while the task doing the io may hang, other tasks can float to another
sproc assigned to the cpu and continue to execute.

>3. How can mutual exclusion over data be implemented between Ada tasks
and
>   Unix processes?
In SGI MP ada you have full access to semiphores, mutexes, etc, and they
interact just fine with unix processes.

>4. How do Ada subprograms interface with Unix processes?  For example,
Unix
>   pipes and streams are often used in C programs.  How are these
accessed
>   from Ada?  Should they be?
I havent done this so i cant say how its done, but there are people on my
project
doing it and they are pleased with its performance.  I belive they are
using
ada bindings to the c code.

>5. How do Ada task priorities and Unix process priorities interact?
when i create an SPROC i assign the unix process priority to the sproc. 
i can 
assign ada tasks to run on this sproc where the ada priority is used to 
control priority within the process.

>6. What can make Ada tasks and Unix processes behave
non-deterministically in
>   space or time?
On the sgi you can lock unix, interrupts, and the clock onto a single
processor
of our multiprocessor system so these do not interrupt the ada tasks.  in
addition
you can turn the unix scheduler off and do other things to make your code
more deterministic.  Test that i ran this summer however indicated this
is not
perfect, there were still some small indetermanacy on the order of as
much as
half a millisecond [very rare] ave was a few 10's of microseconds (i don't
have the data here right now).

>7. What are the effects of virtual memory?
Potentially big hits to timing, and determanism.  On the SGI we had 196MB
RAM so we
simply locked all all physical ram down and did not allow page swapping.

>8. How is memory organized and allocated?  Can memory be shared between
>   processes and tasks?
Yes, SPROCs share the memory space of their parents so if you create a
set of
unix processes they all share the address space of the program that
crated them.
Tasks on the sprocs the individual tasks share the same parent address
space.

You can also use shared memory to talk to unix processes create by
different parens
or forked.

>9. How are peripheral devices controlled and accessed from Ada tasks and
Unix
>   processes?
Sorry i didnt have to deal with this.



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

* Re: Ada & UNIX
@ 1994-09-28 18:41 Scott Catterill
  1994-09-29 12:33 ` James Hopper
  1994-09-29 13:49 ` Oliver E. Cole
  0 siblings, 2 replies; 6+ messages in thread
From: Scott Catterill @ 1994-09-28 18:41 UTC (permalink / raw)



Thanks for all the replies regarding "Ada & Unix".  They're very useful. 
I now understand that most of my questions are implementation dependant.

The missing information is:  Unix: Solaris (v1.1)
                             Ada:  Verdix SunAda (v6.1)

(just in case someone wants to give it another crack)...

Again, thanks for the help.

Scott
--
-----------------------------------------------------------
  ------Scott Catterill:  aa355@freenet.carleton.ca------
    -----Sysop: Heart of Gold BBS: (613) 831-1973 ----- 
       ----------------------------------------------



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

* Re: Ada & UNIX
  1994-09-28 18:41 Scott Catterill
@ 1994-09-29 12:33 ` James Hopper
  1994-09-29 13:49 ` Oliver E. Cole
  1 sibling, 0 replies; 6+ messages in thread
From: James Hopper @ 1994-09-29 12:33 UTC (permalink / raw)


In article <CwurwE.Cvu@freenet.carleton.ca> Scott Catterill,
aa355@FreeNet.Carleton.CA writes:
>Thanks for all the replies regarding "Ada & Unix".  They're very useful. 
>I now understand that most of my questions are implementation dependant.
>
>The missing information is:  Unix: Solaris (v1.1)
>                             Ada:  Verdix SunAda (v6.1)
>
>(just in case someone wants to give it another crack)...
>
>Again, thanks for the help.
>
>Scott

Scott,

Its my understanding that verdix sells mp ada for the sun as well as SGI. 
thus if you get the upgrade most of my comments in this threads would
apply
to your platform etc.

best jim



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

* Re: Ada & UNIX
  1994-09-28 18:41 Scott Catterill
  1994-09-29 12:33 ` James Hopper
@ 1994-09-29 13:49 ` Oliver E. Cole
  1 sibling, 0 replies; 6+ messages in thread
From: Oliver E. Cole @ 1994-09-29 13:49 UTC (permalink / raw)



  The OCS LegacyAda/6000 product (nee IBM Ada/6000) maps Ada tasks
to individual AIX processes when pragma OS_TASK is applied to 
the task type.  For AIX 4.1, the Ada tasks will be mapped to AIX
threads.



-- 
------------------------------------------------------------------------------
Oliver E. Cole                                               oec@ocsystems.com
OC Systems, Inc.                                                (703) 359-8165



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

end of thread, other threads:[~1994-09-29 13:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-09-26 18:12 Ada & UNIX Scott Catterill
1994-09-27 10:44 ` Tucker Taft
1994-09-27 13:49 ` James Hopper
  -- strict thread matches above, loose matches on Subject: below --
1994-09-28 18:41 Scott Catterill
1994-09-29 12:33 ` James Hopper
1994-09-29 13:49 ` Oliver E. Cole

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