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,98fcd569e727e97c X-Google-Attributes: gid103376,public From: steved@pacifier.com (Steve Doiel) Subject: Tasking Techniques - Opinions? Date: 1997/06/04 Message-ID: <5n2hjr$ohm$1@news.pacifier.com>#1/1 X-Deja-AN: 245962667 Organization: Pacifier Online Data Service, Vancouver, Wa. ((360) 693-0325) Newsgroups: comp.lang.ada Date: 1997-06-04T00:00:00+00:00 List-Id: Over the years I have used a number of real time operating systems (or kernal's). Those systems made use of "semaphores," "events," "mutexes," "tasks," "queues," and other synchronization or tasking primatives. The terminology differs in terms of what exactly an "event" is, but the concepts are similar. I have read what John Barnes has to say about tasks and protected types in "Programming in Ada 95." It appears that the tools for creating and synchronizing tasks in Ada are simple, but it leaves me wondering about the best techniques to use to perform the job at hand. For example: I am working on a communications subsystem. In this subsystem various tasks produce packages of data that are to be transmitted using BSD sockets on TCP/IP. In the current implementation, one module maintains a free pool of packet buffers. Access to the free pool is done using a protected type. A second module contains a protected type that contains a FIFO of packet buffers (the send queue). A third module contains a "send task" that is in a short loop that removes entries from the send queue, transmits the data out the socket and then returns the packet buffer to the free pool. In the above description the gory details of how the socket initially gets set up, what happens when a socket goes away, and other error handling are left out to keep the discussion simple. Now the question: Is this a reasonable implementation? Or is there a better approach? I am making almost no use of Ada's "rendevous," and am leaning more toward using protected types to pass data through queues. Is this poor practice? I understand that with Ada 83 this was not an option, but still wonder if this is the best approach. Opinions? Steve Doiel steved@pacifier.com