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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6ff6ac051491e437 X-Google-Attributes: gid103376,public From: "James A. Squire" Subject: Question about the need for requeue as described in Rationale Date: 1996/07/03 Message-ID: <31DAD51F.40F1@csehp3.mdc.com>#1/1 X-Deja-AN: 163538895 sender: Ada programming language references: <31c8fdd4.5a455349@zesi.ruhr.de> comments: Gated by NETNEWS@AUVM.AMERICAN.EDU content-type: text/plain; charset=us-ascii organization: MDA Avionics Tools & Processes mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.01 (X11; I; HP-UX A.09.01 9000/715) Date: 1996-07-03T00:00:00+00:00 List-Id: In the Ada95 Rationale, II.9 "Protected Types", it says the following: "Our final example introduces the ability to requeue a call on another entry. It sometimes happens that a service needs to be provided in two parts and that the calling task has to be suspended after the first part until conditions are such that the second part can be done. Two entry calls are then necessary but attempts to program this in Ada 83 usually run into difficulties; race conditions can arise in the interval between the calls and there is often unnecessary visibility of the internal protocol." It goes on to cite an example which does not represent work that needs to be provided in two parts, and concludes with this disclaimer: "The above example has been used for illustration only. The astute reader will have observed that the condition is not strictly needed inside Signal; without it the caller will simply always requeue and then immediately be processed if there are no waiting tasks. But the condition clarifies the description. Indeed, the very astute reader might care to note that we can actually program this example in Ada 95 without using requeue at all. A more realistic classic example is the disk scheduler where a caller is requeued if the head is currently over the wrong track." I am trying to understand what problem Requeue is trying to solve and the above does not help me. I can see from the example given how it would be difficult to do the same thing in Ada83, but as I was trying to describe the Ada83 problem that raised the need for this, I found I couldn't come up with any good way of describing the problem. "race conditions can arise in the interval between the calls" - like what, for example? A race condition, AFAIK, is where two tasks are both updating the same data object but act as if they are oblivious to it. I'm having trouble seeing how that applies in the context in which this quote was used. "Indeed, the very astute reader might care to note that we can actually program this example in Ada 95 without using requeue at all." - Great! So why was it used if it wasn't needed? For that matter, how can I do it in Ada 95 without requeue? "A more realistic classic example is the disk scheduler where a caller is requeued if the head is currently over the wrong track." - Gee, then why didn't they? I have a feeling I would understand the dilemma a lot better if they had. Can anybody help me understand what race conditions can't be avoided in Ada83 that pertain the situation where a service needs to be provided in two parts? (Frankly, if they had said "deadlock" instead, I might have understood that a bit more) Thank you. -- James Squire MDA Avionics Tools & Processes ja_squire@csehp3.mdc.com Opinions expressed here are my own and NOT my company's "one of these days I'm going to better myself by going to Knight school" "You'll be a web knight instead of a web page!"