From: nasser@apldbio.com (Nasser Abbasi)
To: ohk@edeber.nta.no (Ole-Hjalmar Kristensen FOU.TD/DELAB)
Subject: Re: Asynchronous IO
Date: 1996/06/17
Date: 1996-06-17T00:00:00+00:00 [thread overview]
Message-ID: <nh91dnl0a6.fsf@paralysys> (raw)
In-Reply-To: OHK.96Jun14131501@edeber.nta.no
From: ohk@edeber.nta.no (Ole-Hjalmar Kristensen FOU.TD/DELAB)
For obvious resons, it is desirable to be able to do output of data to
different devices in parallel. Does the Ada95 standard define what
happens if two tasks try to do IO to two different files at the same
time? I have tried to find out by reading both the RM and the
Rationale, but is none the wiser.
Does one become blocked, waiting for the operation to complete, then
the other becomes blocked, waiting for the operation to complete
(which is what i fear)?
Do both tasks block, then wake up as soon as their respective IO
operations are finished? This is what I would like.
Or, is it simply undefined and left to the implementation?
Ole-Hj. Kristensen
It seems to me that neither Ada nor any other langauge for that matter
can specify what happens when 2 or more tasks/threads attempt
access to a shared external system resource such as a file since this
by its nature, is the resposibility of the operating system (in
particular that of the file system layer) that the program run on top,
and not the ada-rtl or the ada language. If an ada task issues an
IO operation, and an other task does the same at about the same time,
then the file system is resposible for managing concurrent access to
the file internal data structures and to interact with the device driver
in consistant manner. All what Ada-rtl will do is make calls to the
system lower level calls to do the actual IO, I don't see it doing more than
that in this area. (other than offcourse taking care of
task scheduling after the IO is complete, such as making the task
ready, etc..but that is beside the point).
The behviour should be no different from if 2 or more processes
on the system try to access the same file. The IO operations
will be queued to the file in the order they isseued (in general). If
it is a blocked/IO operation, the task (or a process) will block untill
the IO is complete, etc.. even if the 2 tasks each ran on different
cpus in a multi-cpu system, where an IO operation request can happen
at exactly the same time, the system is respsible for synchronizing
access to the device driver.
If the program is an embeded program, where normally there is no
physical files on the board to start with or an operating system
in the normal sense, then access to external devices/ports etc..
should be coordinated by the programmer code, either by using protected
variables or other similar techniques .
I can be competely wrong here becuase I have not also check the RM on
this, but I can bet my house that I have not bought yet that this is
how things would work, and if they don't work like this, then they are
broke :)
nasser
--
Nasser Abbasi. C/C++/Ada Solaris. GeneAssist - A client/server
application for Nucleic acid and protein sequence search and analysis.
PE-Applied BioSystem division. email: nasser@apldbio.com
MSEE, MSCS, MSCE, FM (and Karpov is my chess hero! ..).
next prev parent reply other threads:[~1996-06-17 0:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-06-14 0:00 Asynchronous IO Ole-Hjalmar Kristensen FOU.TD/DELAB
1996-06-15 0:00 ` Robert Dewar
1996-06-17 0:00 ` Ole-Hjalmar Kristensen FOU.TD/DELAB
1996-06-17 0:00 ` Nasser Abbasi
1996-06-17 0:00 ` Nasser Abbasi [this message]
1996-06-18 0:00 ` Jon S Anthony
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox