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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9d303864ae4c70ad X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-04-16 18:20:09 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!216.196.106.140!border1.nntp.sjc.giganews.com!nntp.giganews.com!local1.nntp.sjc.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 16 Apr 2004 20:20:08 -0500 Date: Fri, 16 Apr 2004 21:20:07 -0400 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Reprise: 'in out' parameters for functions References: <5ad0dd8a.0404090512.15af2908@posting.google.com> <5ad0dd8a.0404091828.6e79bb4e@posting.google.com> <8Oadneu6eY9pweDdRVn-hA@comcast.com> <5ad0dd8a.0404151752.4f598e1a@posting.google.com> <5ad0dd8a.0404160338.5a1c9116@posting.google.com> <1080a21p0nn482f@corp.supernews.com> <5ad0dd8a.0404161415.220cce54@posting.google.com> In-Reply-To: <5ad0dd8a.0404161415.220cce54@posting.google.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <-9qdnUKOH_DVGx3dRVn-ug@comcast.com> NNTP-Posting-Host: 24.147.90.114 X-Trace: sv3-J0bL59MgSC4t4IMWj5KiUVhLJfRJTSK+9Q+UZ56E6EEuGW9d6FJVSrvM1GejNvNE/G5z8LnxMrbFAmK!dqGq302yMv2oSwXlwwwsW268AQDpE/ge7j2xeBKlezSYKH/0LSZ+Zn0ViGpWww== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: archiver1.google.com comp.lang.ada:7238 Date: 2004-04-16T21:20:07-04:00 List-Id: Wojtek Narczynski wrote: > This is not easy but solveable. For example ADABAS (and forks) > relational database is organized as one large B* tree. It can be > edited concurrently, it rebalances, and does not deadlock. > > One more example: Java heap, millions of objects, 64 CPUs, thousands > of threads. Would you like to have one lock for the whole data > strucutre? You are missing the point. The answer is no, one lock per storage pool. How many storage pools do you have? At least one per CPU, more usually two or three due to different storage management protocols. But the major insight is that you either update a copy of an object and then swap it in atomically as Randy said, or (my preference) the lock for the data structure controls the data structure and a separate per object lock controls the object updates. (Except changing index keys, which has to be done Randy's way.) The simplest data structure locking protocol is usually by far the most efficient. Spending a dozen times as many CPU cycles on lock management to double or triple the effective concurrency is a joke, and you will find that holding complex schemes to only a dozen times as long is difficult. Factor in memory caches, and anything else is crazy. What is important, in real cases, is memory management. Having any part of a data structure paged to disk can kill performance. (The data structure now, not the actual data.) This is why I tend to implement the tree or whatever with a pointer (excuse me access value) designating the data. That way the next data structure entry you need will be in main memory, and is much more likely to be in cache. (If you also figure from this that I am one of those people who designs large objects and not that many of them, you are right. Complex data dictionaries are all right for the theoretical part of design, but when it comes to practice, you want to merge data nodes to the maximum extent possible.) -- Robert I. Eachus "The terrorist enemy holds no territory, defends no population, is unconstrained by rules of warfare, and respects no law of morality. Such an enemy cannot be deterred, contained, appeased or negotiated with. It can only be destroyed--and that, ladies and gentlemen, is the business at hand." -- Dick Cheney