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,3ccb707f4c91a5f2 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: Unbounded strings (Was: Java vs Ada 95 (Was Re: Once again, Ada absent from DoD SBIR solicitation)) Date: 1996/11/26 Message-ID: #1/1 X-Deja-AN: 200858849 references: <325BC3B3.41C6@hso.link.com> <57dd70$1pf@fozzie.sun3.iaf.nl> organization: New York University newsgroups: comp.lang.ada Date: 1996-11-26T00:00:00+00:00 List-Id: Geert says, replying to Kevin: Kevin D. Heatwole (heatwole@his.com) wrote: ``Is it really that much harder to provide an efficient ref-counted tasking safe implementation of unbounded strings than it is to provide an efficient tasking safe allocator? '' No, it isn't. The only problems relate to the priority requirements of Annex D. When you want to use ceiling priority locks, it is necessary to change and/or check priority of tasks which requires an expensive system call. Robert replies That's incorrect, it is easy to think of strategies for writing task safe allocators that greatly reduce the requirement for this expensive locking. In particular, an obvious strategy is to cache a chunk of storage for a task doing dynamic allocation, and use this cache to satisfy local requests, so that the expensive locking is only required to get a new chunk. We don't do that by default in GNAT, but it is quite easy, using the storage pools mechanism and task attributes, to write a storage pool that works that way and use it. On the other hand, if you are forced into using locks for reference counts, then no such tricks are at hand, and you will need the expensive system call for every unbounded string assignment, which is pretty fierce. Note also that in a typical use of unbounded strings, you may do many more assignments of UBS's than allocations, so even if you are using the standard allocator which takes a lock, you pay that only on a new string -- taking a lock on every assignment may be much worse.