comp.lang.ada
 help / color / mirror / Atom feed
From: rieachus@comcast.net
Subject: Re: Two-stage suspend operations
Date: Sun, 8 May 2016 19:12:25 -0700 (PDT)
Date: 2016-05-08T19:12:25-07:00	[thread overview]
Message-ID: <95d6e489-463b-484b-b67e-8d37812f6b11@googlegroups.com> (raw)
In-Reply-To: <lybn4gqrkr.fsf@pushface.org>

On Sunday, May 8, 2016 at 3:26:30 PM UTC-4, Simon Wright wrote:
> I don't see the connection; they're all about database locking, e.g...

The Ada Rationale is explaining an optimization based on having a single task/thread that can set the semaphore.  This allows the waiting on the semaphore to be combined into a single action--you don't need to acquire a read lock if this thread is the only one that can reset the semaphore.

In the more general database case, several processes may want write access to the semaphore--it is not owned by a single thread in a single process.  Now you need to acquire the read lock (preventing other writers) before acquiring the write lock.

If you think about the problem as efficiently guaranteeing that all requests are serviced, they are dealing with the same issue.  Take a particular example such as managing a log file and work it through.  The Ada solution discussed here is highly efficient (and works) if the file is owned (opened for writing) by a single thread.  The cost of the Ada solution is that you need a separate named protected object for each file or device managed.  You may be able to find discussions of this protocol in the context of file systems.  However, my experience is that file systems depend on tasks/threads not sharing files open for writing to avoid garbage.

  reply	other threads:[~2016-05-09  2:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-07 16:13 Two-stage suspend operations Simon Wright
2016-05-08  3:56 ` rieachus
2016-05-08 19:26   ` Simon Wright
2016-05-09  2:12     ` rieachus [this message]
2016-05-09  8:56       ` Simon Wright
2016-05-09 23:15         ` rieachus
2016-05-10  5:46           ` Simon Wright
2016-05-10 21:14 ` rieachus
2016-05-11  8:55   ` Simon Wright
2016-05-11 21:20 ` rieachus
replies disabled

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