comp.lang.ada
 help / color / mirror / Atom feed
From: brbarkstrom@gmail.com
Subject: Re: Exclusive file access
Date: Sun, 6 Sep 2015 10:38:13 -0700 (PDT)
Date: 2015-09-06T10:38:13-07:00	[thread overview]
Message-ID: <b94d04e3-f001-49c4-9305-05075f247044@googlegroups.com> (raw)
In-Reply-To: <msf37t$j80$1@dont-email.me>

On Saturday, September 5, 2015 at 11:56:28 AM UTC-4, björn lundin wrote:
> 
> > I have no idea about Linux but it is perfectly possible under Windows. 
> > However this doesn't stop people (including Microsoft) from creating lock
> > 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.
> 
> That is why you do not want to use gnat.lockfiles, (at least on linux)
> but instead use somthing like linux' lockf.
> 
> If the process holding the lock gets killed, (even by kill -kill)
> the kernel (or something) releases the lock.
> No stale lockfiles.
> 
> 
> --
> Björn

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, 
there is a task window.  The primary procedure appears as a task, which I 
believe is going to be related to the thread for the process.  If I run a 
strictly sequential version of the program there's only one task that appears
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.

  reply	other threads:[~2015-09-06 17:38 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-27 13:52 Exclusive file access ahlan
2015-08-27 14:27 ` gautier_niouzes
2015-08-31 23:20   ` Randy Brukardt
2015-09-01 16:23     ` Pascal Obry
2015-09-01 20:48       ` Randy Brukardt
2015-08-27 14:42 ` Björn Lundin
2015-08-27 14:48 ` G.B.
2015-08-27 15:08   ` Björn Lundin
2015-08-27 18:38     ` tmoran
2015-08-27 23:16     ` Georg Bauhaus
2015-08-27 23:29       ` Pascal Obry
2015-08-28  7:25         ` Georg Bauhaus
2015-08-27 15:15   ` ahlan
2015-08-27 18:29     ` Jeffrey R. Carter
2015-08-28  5:41 ` ahlan
2015-08-28  7:10   ` Georg Bauhaus
2015-08-28 17:40 ` ahlan
2015-08-28 19:49   ` Anh Vo
2015-08-28 21:06     ` Simon Wright
2015-08-28 21:38       ` Jeffrey R. Carter
2015-08-29  7:05   ` Dmitry A. Kazakov
2015-08-29  8:31     ` Pascal Obry
2015-08-29 12:02       ` Dmitry A. Kazakov
2015-08-30 11:35         ` Florian Weimer
2015-08-30 12:44           ` Dmitry A. Kazakov
2015-08-30 19:37             ` Florian Weimer
2015-08-31  7:22               ` Dmitry A. Kazakov
2015-08-31 21:12                 ` Florian Weimer
2015-09-01  7:26                   ` Dmitry A. Kazakov
2015-09-07 18:27                     ` Florian Weimer
2015-09-07 19:06                       ` Dmitry A. Kazakov
2015-09-11 16:54                         ` Florian Weimer
2015-08-31 23:34             ` Randy Brukardt
2015-09-01  7:33               ` Dmitry A. Kazakov
2015-08-29 16:07     ` gautier_niouzes
2015-08-29 17:12       ` Dmitry A. Kazakov
2015-09-01 12:37 ` brbarkstrom
2015-09-01 14:05 ` ahlan
2015-09-01 15:13   ` Simon Wright
2015-09-01 20:36     ` Randy Brukardt
2015-09-01 15:17   ` Jacob Sparre Andersen
2015-09-01 20:37     ` Randy Brukardt
2015-09-01 16:05   ` G.B.
2015-09-01 20:02   ` brbarkstrom
2015-09-01 21:17     ` Simon Wright
2015-09-05 15:52       ` Björn Lundin
2015-09-01 20:31   ` Randy Brukardt
2015-09-01 15:31 ` ahlan
2015-09-05 15:56   ` Björn Lundin
2015-09-06 17:38     ` brbarkstrom [this message]
2015-09-06 19:52       ` Björn Lundin
2015-09-07 15:18         ` brbarkstrom
replies disabled

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