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.129.158.2 with SMTP id v2mr21950593ywg.7.1462759946177; Sun, 08 May 2016 19:12:26 -0700 (PDT) X-Received: by 10.182.46.133 with SMTP id v5mr217637obm.9.1462759946134; Sun, 08 May 2016 19:12:26 -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!au2pb.net!feeder.erje.net!2.us.feeder.erje.net!newspeer1.nac.net!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!11no2890846qgt.0!news-out.google.com!uv8ni263igb.0!nntp.google.com!i5no5869802ige.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 8 May 2016 19:12:25 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2601:191:8202:8510:5985:2c17:9409:aa9c; posting-account=fdRd8woAAADTIlxCu9FgvDrUK4wPzvy3 NNTP-Posting-Host: 2601:191:8202:8510:5985:2c17:9409:aa9c References: <9e93195a-eba0-4793-a64c-a24613090b3c@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <95d6e489-463b-484b-b67e-8d37812f6b11@googlegroups.com> Subject: Re: Two-stage suspend operations From: rieachus@comcast.net Injection-Date: Mon, 09 May 2016 02:12:26 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:30358 Date: 2016-05-08T19:12:25-07:00 List-Id: 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 ta= sk/thread that can set the semaphore. This allows the waiting on the semap= hore 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 acq= uiring the write lock. If you think about the problem as efficiently guaranteeing that all request= s are serviced, they are dealing with the same issue. Take a particular ex= ample such as managing a log file and work it through. The Ada solution di= scussed here is highly efficient (and works) if the file is owned (opened f= or writing) by a single thread. The cost of the Ada solution is that you n= eed 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 sy= stems. However, my experience is that file systems depend on tasks/threads= not sharing files open for writing to avoid garbage.