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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fb45e48e8dddeabd X-Google-Attributes: gid103376,public X-Google-Thread: ffc1e,fb45e48e8dddeabd X-Google-Attributes: gidffc1e,public From: kaz@ashi.footprints.net (Kaz Kylheku) Subject: Re: Ada Protected Object Tutorial #1 Date: 1999/12/18 Message-ID: #1/1 X-Deja-AN: 562411677 Cache-Post-Path: ashi.FootPrints.net!unknown@localhost References: <839toq$pu$1@bgtnsc03.worldnet.att.net> X-Complaints-To: abuse@direct.ca X-Trace: brie.direct.ca 945546910 204.239.179.1 (Sat, 18 Dec 1999 11:55:10 PST) Organization: Psycho-Neurotic Institute for The Very, Very Nervous X-Cache: nntpcache 2.3.3b3 (see http://www.nntpcache.org/) User-Agent: slrn/0.9.5.7 (UNIX) Reply-To: kaz@ashi.footprints.net NNTP-Posting-Date: Sat, 18 Dec 1999 11:55:10 PST Newsgroups: comp.programming.threads,comp.lang.ada Date: 1999-12-18T00:00:00+00:00 List-Id: On Fri, 17 Dec 1999 00:41:27 GMT, Robert A Duff wrote: >"James S. Rogers" writes: > >> This is the first of hopefully several examples of uses for Ada Protected >> Objects. > >People seem to get confused about the difference between waiting for a >lock to become free, and waiting for a barrier to become true. Only the >latter is called "blocking" in Ada 95 terms, and the former is sort of >swept under the rug. If your tutorial can explain all that clearly and >simply, you will have done a great service. Waiting for locks is inherently different from waiting for conditions to become true. In the abstract sense, they are both similar: a thread has to be delayed. But in practical terms, locks are held briefly, so waiting on a lock can be done without using heavy weight scheduling; e.g. using spinlocks. Or, in a kernel running on the bare hardware, a combination of disabling interrupts and spinning (multiple processors are present). In other words, techniques that would be disastrous if applied to long waits.