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,9c78d085847f47af X-Google-Attributes: gid103376,public From: mfb@mbunix.mitre.org (Michael F Brenner) Subject: Re: file locking in Ada Date: 1997/03/28 Message-ID: <5hglog$lf8@top.mitre.org>#1/1 X-Deja-AN: 229012986 References: <333BB430.BF8@aston.ac.uk> Organization: MITRE Newsgroups: comp.lang.ada Date: 1997-03-28T00:00:00+00:00 List-Id: In any language, such as Ada or C, you can call an underlying operating system or file management system, such as Mips OS, VxWorks, Desqview, Apple OS, CP/M, Starlet, Linus, DOS, etc. Ada is a lanaguage which lets you implement file locking within the language itself. Set up a task which processes all requests for files. Lets say you are using this for a database management system with file-at-a-time access, since you wish to have file locking instead of record locking. Therefore your operations will be a subset of relational algebra, such as the following: select, merge (or join), import, delete, and update. Each of these operations would be an entry in the file request task. No other software talks to the files except through that file request task. The task processes the requests one at a time, and that implements TOTAL file locking. Now, if you wish to have some operations in parallel and some locked, with the ability to turn locking on and off, you will need to store the locking state of each file in a data structure accessible to the file request task. That data structure will be accessed at each file operation request. Based on its value, either a parallel task will be issued, or the command will be queued. Record locking is the same logical concept, but implementing it efficiently is difficult because of the size of the problems where record locking is useful, and because of the distributed nature of those problems. Therefore, if you intended to ask about record locking, always use commercial software to record lock the net.