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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.140.233.142 with SMTP id e136mr14069964qhc.13.1441561094381; Sun, 06 Sep 2015 10:38:14 -0700 (PDT) X-Received: by 10.182.19.198 with SMTP id h6mr63952obe.18.1441561094346; Sun, 06 Sep 2015 10:38:14 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!z77no1192274qge.1!news-out.google.com!nt1ni2793igb.0!nntp.google.com!kq10no1475455igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 6 Sep 2015 10:38:13 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=50.111.149.24; posting-account=Ies7ywoAAACcdHZMiIRy0M84lcJvfxwg NNTP-Posting-Host: 50.111.149.24 References: <6725e7d9-eb8e-49b0-985d-9c1b1bbd6fd8@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Exclusive file access From: brbarkstrom@gmail.com Injection-Date: Sun, 06 Sep 2015 17:38:14 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3833 X-Received-Body-CRC: 522028402 Xref: news.eternal-september.org comp.lang.ada:27716 Date: 2015-09-06T10:38:13-07:00 List-Id: On Saturday, September 5, 2015 at 11:56:28 AM UTC-4, bj=F6rn lundin wrote: >=20 > > I have no idea about Linux but it is perfectly possible under Windows.= =20 > > However this doesn't stop people (including Microsoft) from creating lo= ck > > files that then sometimes get left behind when a program crashes > > rendering the file locked forever! > > So the presence of lock files doesn't mean that the opsys can't lock > exclusively. >=20 > That is why you do not want to use gnat.lockfiles, (at least on linux) > but instead use somthing like linux' lockf. >=20 > If the process holding the lock gets killed, (even by kill -kill) > the kernel (or something) releases the lock. > No stale lockfiles. >=20 >=20 > -- > Bj=F6rn I have been debugging a concurrent Ada program (on Windows XP, but I expect the GNAT GPL would work the same on Linux). In the GPS debugger,=20 there is a task window. The primary procedure appears as a task, which I= =20 believe is going to be related to the thread for the process. If I run a= =20 strictly sequential version of the program there's only one task that appea= rs in the debugger window for tasks. When I switch over the the concurrent version (which I'm still debugging), then I can have the program create, run, and terminate a large number of tasks. These appear in the task window including their state (runnable, ..., terminated). [I'll provide the code after I'm satisfied with the debugging process.] I believe the debugger provides a strong prima facie case the (at least for GNAT GPL), Ada will treat a single process as a task. When you add subroutines in other languages to this code, it seems likely that the Ada compiler would still treat the main procedure as a task - although I do not have direct evidence of that. To the extent that the Ada program introduces other tasks, the program falls into the realm of concurrent programming, where the appropriate Ada approach is to deal with resource starvation or blocking with protected objects or some of the more primitive approaches (such as semaphores). If the program is going to run in an environment that involves multiple machines, then in addition to concurrent programming, the system design will involve distributed computing. Because multi-system designs usually have to assume that the individual nodes are unreliable, the algorithms become more complex because of the need to check on whether the components are unavailable. That would be the case, for example, in dealing with a web site that uses clusters of servers and storage units. Bruce B.