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-Language: ENGLISH,ASCII X-Google-Thread: 103376,1b417df64012e6d3 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-17 16:36:09 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cyclone2.usenetserver.com!usenetserver.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3C95376C.A401A26@acm.org> From: Bo Sanden X-Mailer: Mozilla 4.78 [en] (Windows NT 5.0; U) X-Accept-Language: en,pdf MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: tasks, protected types and entries References: <%12l8.9656$%_6.1717935@news11-gui.server.ntli.net> <3C94F235.80C7166A@adaworks.com> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Date: Mon, 18 Mar 2002 00:36:12 GMT NNTP-Posting-Host: 66.1.241.29 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 1016411772 66.1.241.29 (Sun, 17 Mar 2002 16:36:12 PST) NNTP-Posting-Date: Sun, 17 Mar 2002 16:36:12 PST Organization: EarthLink Inc. -- http://www.EarthLink.net X-Received-Date: Sun, 17 Mar 2002 16:36:08 PST (newsmaster1.prod.itd.earthlink.net) Xref: archiver1.google.com comp.lang.ada:21386 Date: 2002-03-18T00:36:12+00:00 List-Id: Another way to view this is to talk about "exclusion" and "condition" synchronization. Procedures have exclusion synchronization, which means that if you call a procedure that is currently being run by another task, you get to wait a little until the previous task is done. If things are well designed, the likelihood that yet another task should try to call the same procedure and also be put waiting is almost nil, so there is little reason to worry about which waiting task gets to proceed first. Condition synchronization is when a task must wait for some condition in the problem domain to become true. For example, the task may need access to some problem domain resource, such as a track segment in a switchyard or an automated guided vehicle (AGV) in a flexible manufacturing system. This wait is on an average much longer than the exclusion wait and we want the tasks that need the AGV to wait in a first-in-first-out queue (within priorities). This is what a queue is for. It organizes the waiting tasks when the wait can be expected to be long enough to warrant it. The wait could also be for some software resource such as a buffer. A task that calls Get( ) is queued if the buffer is empty, and a task that calls Put( ) is queued if the buffer if full. In these cases the wait can again be much longer than the time it takes for a task to get out of a protected procedure, and we want the waiting tasks to be properly queued. Bo Sanden Richard Riehle wrote: > "chris.danx" wrote: > > > What is the difference between an entry and a procedure? > > This is one of the most important and least often address issue > in Ada. In my classroom, after we have started our unit on > tasking, I have my students recite, in unison, > > "An entry has a queue." > > That is so fundamental, and so overlooked. I believe it is a > starting point for understanding all the associated mechanisms. > The properties of the queue itself, and behavior of its enclosing > task or protected object can be understood only when one > grasps this simple idea. Yet I encounter programmers who > have been using Ada for years who still don't know this. > > > ... a procedure will always execute regardless of any > > condition, but that an entry can have a guard to allow/prevent its execution > > if a given condition is satisfied. > > There are no guards on subprograms (procedures and functions). If there > were, they would be called pre-conditions. In fact, protected entry > barriers, and task entry guards, are simply a variation-on-the-theme of > pre-conditions. > > Richard Riehle -- Dr. Bo I. Sand�n Professor of Computer Science Colorado Technical University Colorado Springs, CO, U.S.A. iis-web.coloradotech.edu/bsanden (0719) 590-6733