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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,703c4f68db81387d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Teaching new tricks to an old dog (C++ -->Ada) Date: 12 Mar 2005 11:11:54 +0000 Organization: Pushface Sender: simon@smaug.pushface.org Message-ID: References: <4229bad9$0$1019$afc38c87@news.optusnet.com.au> <1110032222.447846.167060@g14g2000cwa.googlegroups.com> <871xau9nlh.fsf@insalien.org> <3SjWd.103128$Vf.3969241@news000.worldonline.dk> <87r7iu85lf.fsf@insalien.org> <1110052142.832650@athnrd02> <1110284070.410136.205090@o13g2000cwo.googlegroups.com> <395uqaF5rhu2mU1@individual.net> <112rs0bdr2aftdf@corp.supernews.com> <1inxxr988rxgg$.1w9dedak41k89.dlg@40tude.net> <112s1r0rf0o8nca@corp.supernews.com> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1110626007 5141 62.49.19.209 (12 Mar 2005 11:13:27 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Sat, 12 Mar 2005 11:13:27 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Xref: g2news1.google.com comp.lang.ada:9211 Date: 2005-03-12T11:11:54+00:00 List-Id: Simon Wright writes: > Google shows me lwlock as a C function in the PostGres support groups; > I don't know what machine architecture has these instructions? PowerPC? Someone else gave me the key: the first result returned by a Google Groups query for 'store word conditional' says (a) the instructions are present on (newer?) PowerPCs, (b) You can't use load word and reserve and store word conditional to protect more than one word in common between interrupt and non-interrupt code, because doing so requires implementing a semaphore/mutex. I don't see how you can do this against interrupt code, which has no way of yielding to the non-interrupt code if it finds that the non-interrupt code is in the critical section. Load word and reserve and store word conditional work fine between interrupt and non-interrupt code, but only protect a single word. Dealing with critical-section changes to more than one word appears, to me, to require either locking out interrupts while in the critical section or else having the interrupt code do something requiring critical section modification of only one word (e.g. putting some data on a singly linked list), and deferring the rest of the work to non-interrupt code that *can* yield (or, ick, busy wait for a preemption) on a semaphore. and I suspect there's similar reservation when you have preemptive priorities. I am _really_ not interested in being able to increment integers atomically! -- Simon Wright 100% Ada, no bugs.