From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9e46e8a19dc8e224 X-Google-Attributes: gid103376,public From: nasser@apldbio.com (Nasser Abbasi) Subject: Re: Asynchronous IO Date: 1996/06/17 Message-ID: #1/1 X-Deja-AN: 160541940 sender: news@biosys.apldbio.COM references: to: ohk@edeber.nta.no (Ole-Hjalmar Kristensen FOU.TD/DELAB) original-sender: nasser@apldbio organization: Aplied BioSystems newsgroups: comp.lang.ada Date: 1996-06-17T00:00:00+00:00 List-Id: 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! ..).