comp.lang.ada
 help / color / mirror / Atom feed
From: Jim Rogers <jimmaureenrogers@worldnet.att.net>
Subject: Re: True faiths ( was Re: The true faith )
Date: Tue, 22 Jan 2002 23:47:51 GMT
Date: 2002-01-22T23:47:51+00:00	[thread overview]
Message-ID: <3C4DFA24.4020107@worldnet.att.net> (raw)
In-Reply-To: k4m38.16051$XG4.674426@news2.calgary.shaw.ca

Kaz Kylheku wrote:

> In article <3C4DE336.3080102@worldnet.att.net>, Jim Rogers wrote:
> 
>>Bruce Hoult wrote:
>>
>>
>>>Garbage collection has a *lot* to do with this problem!
>>>
>>>A large proportion of assignments in languages such as C++ are done 
>>>merely in order to resolve the question of who owns an object and who is 
>>>responsible for eventually deleting it.
>>>
>>>With GC available, objects are seldom copied with pointers to them being 
>>>passed around instead.  You don't care who "owns" the object, because it 
>>>just magically goes away when all the pointers to it get forgotten.
>>>
>>Copying pointers and using GC or even reference counting is a very
>>nice solution for single threaded applications. It becomes a very
>>messy solution for multi-threaded applications. Now all those
>>copied pointers need to be protected from inappropriate simultaneous
>>access by several threads.
>>
> 
> By definition, something that is copied isn't shared, and so doesn't
> have to be protected.  What it points to is shared, so that's a different
> matter.
> 
> Making copies of every object is not a realistic solution in multithreaded
> programs, no matter what language they are written in.  You can do it
> sometimes, but not always.
> 
> If you must share references to objects, GC is far cleaner and safer
> than reference counting techniques. It will automatically ensure that no
> thread will delete an object while it is still in use by another thread.
> 
> 
>>In threaded applications GC solves no concurrency issues, but it
>>does complicate them. How can a semaphore be "held" by only one
>>thread if only one instance exists, and all threads hold a
>>pointer to that instance?
>>
> 
> How can a semaphore be useful unless there is one shared instance
> of it? Do you know the first thing about threading? Doh!
> 


Of course Doh! I was thinking about the concept of many handles
to the same object, without the object state itself identifying
the "owner".


> 
>>How can you keep one thread from
>>consuming all the free store or "heap"?
>>
> 
> This is a problem regardless of your memory management strategy, if you
> admit dynamic storage allocation.  If you insist on making copies for
> the sake of avoiding sharing, you will only make this concern worse.
> Garbage collection eliminates memory leaks, thus lessening the
> concern.
> 


Aha. There are solutions to this problem, with or without GC.
The solution is to provide a separate storage pool for each
thread. That storage pool could then be managed manually or by
GC. With this design, one thread consuming its storage pool would
not interfere with the storage usage of other threads.

If you do use GC you will need some way of partitioning the
GC work among the storage pools. This could be done in a single
GC, or by implementing many GC's.


> 
>>Obviously there are answers to all those questions.
>>Unfortunately, those answers a generally pretty messy unless
>>someone has designed your GC solution with concurrency in mind.
>>
>

> Do you know what GC is? It simply means computing what objects are unreachable
> and liberating their storage for future allocations.
> 


Yes, I know this. It appears to me that computing unreachability
across a multi-processor system is much more difficult than with
the simpler memory model of a uni-processor system. Am I wrong?


> It has nothing to do with the semantics of those objects while they
> are still live. Garbage collected or not, shared objects have to be
> protected from concurrent access.


Yes, and that concurrent sharing complicates the reachability
algorithm.

While operations on general shared memory objects do not need
to be, and indeed often cannot be, atomic, operations on
semaphores must be atomic. This includes reachability
calculations. It would seem that an object that is unreachable
must remain unreachable. In general this is true. With out of order
instruction execution in some multi-processor systems this cannot
be guaranteed.


> 
> Of course a garbage collector has to be correctly implemented to be used
> in a multithreaded environment. However, it remains easy to use; the
> user simply remains unconcerned about what happens to unreachable
> objects.
> 


Certainly, a GC properly implemented for a multithreaded environment
should be just as easy to use as one implemented in a single threaded
environment. This does, however, argue for a language providing GC
to also implement a threading model as part of the language standard.
Mixing a threaded implementation with a GC designed only for single
threaded applications could lead to very disappointing results.

Jim Rogers
Colorado Springs, Colorado USA





  reply	other threads:[~2002-01-22 23:47 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <B85AB00A.3603%verec@mac.com>
     [not found] ` <%njZ7.279$iR.150960@news3.calgary.shaw.ca>
     [not found]   ` <B85BD264.370E%verec@mac.com>
     [not found]     ` <n7ybsg9lq8y.fsf@panix1.panix.com>
     [not found]       ` <3c36fbc5_10@news.newsgroups.com>
     [not found]         ` <gat-0501022256350001@192.168.1.50>
     [not found]           ` <4idg3u40ermnp682n6igc5gudp7hajkea9@4ax.com>
     [not found]             ` <gat-1001021155210001@eglaptop.jpl.nasa.gov>
     [not found]               ` <bruce-6C0AC5.10391411012002@news.paradise.net.nz>
     [not found]                 ` <gat-1001021515510001@192.168.1.50>
     [not found]                   ` <76be8851.0201101909.9db0718@posting.google.com>
     [not found]                     ` <gat-1101020950400001@eglaptop.jpl.nasa.gov>
2002-01-11 23:46                       ` True faiths ( was Re: The true faith ) israel r t
2002-01-12  0:38                         ` Steven T Abell
2002-01-13 12:20                           ` Kevin McFarlane
2002-01-13 18:52                             ` Erik Naggum
2002-01-14  8:12                               ` Espen Vestre
2002-01-14 10:40                                 ` israel r t
2002-01-16  6:42                                   ` Patrick Doyle
2002-01-16  8:00                                     ` israel r t
2002-01-16  8:55                                       ` Espen Vestre
2002-01-20  0:55                                         ` Mad Hamish
2002-01-20  1:18                                           ` Bruce Hoult
2002-02-13 16:31                                             ` Tom Hawker
2002-02-13 17:51                                               ` Larry Kilgallen
2002-02-13 23:28                                               ` Peter Gummer
2002-02-14  3:10                                                 ` Greg C
2002-02-14  1:56                                               ` Hartmann Schaffer
2002-02-14  9:59                                               ` Barry Watson
2002-01-16  8:00                                     ` " Do computers because it pays well" ( was Re: True faiths ) israel r t
2002-01-14 11:00                               ` True faiths ( was Re: The true faith ) Immanuel Litzroth
2002-01-18 15:19                                 ` Bob Bane
2002-01-18 17:44                                   ` René
2002-01-18 18:04                                   ` Hyman Rosen
2002-01-18 23:22                                     ` Richard Riehle
2002-01-18 23:53                                       ` Matthew Heaney
2002-01-20  5:39                                       ` Hyman Rosen
2002-01-20  5:59                                         ` Kaz Kylheku
2002-01-20 15:15                                           ` Software Scavenger
2002-01-21  1:42                                         ` Richard Riehle
2002-01-21  9:52                                           ` Hyman Rosen
2002-01-21 16:38                                             ` Richard Riehle
2002-01-21 20:30                                             ` Kaz Kylheku
2002-01-22  5:35                                             ` Raffael Cavallaro
2002-01-18 18:44                                   ` Simon Willcocks
2002-01-22 17:01                                     ` Hyman Rosen
2002-01-22 21:59                                       ` Bruce Hoult
2002-01-22 22:08                                         ` Hyman Rosen
2002-01-22 23:22                                           ` Kenny Tilton
2002-01-23 21:12                                             ` Hyman Rosen
2002-01-23 22:24                                               ` Tim Bradshaw
2002-01-24  0:15                                               ` Kenny Tilton
2002-01-24  8:14                                                 ` Hyman Rosen
2002-01-24 16:50                                                   ` Canconical C++ assignment (was Re: True faiths ...) Ray Blaak
2002-01-23  2:26                                           ` True faiths ( was Re: The true faith ) Bruce Hoult
2002-01-23 17:49                                             ` Richard Riehle
2002-01-22 22:09                                         ` Jim Rogers
2002-01-22 22:54                                           ` Kaz Kylheku
2002-01-22 23:47                                             ` Jim Rogers [this message]
2002-01-23  0:08                                               ` Ada SDL Eric Merritt
2002-01-23  1:39                                                 ` Rajat Datta
2002-01-23 10:52                                                 ` Preben Randhol
2002-01-23 13:59                                                   ` Eric Merritt
2002-01-23 16:48                                                     ` Preben Randhol
2002-01-23 16:01                                           ` True faiths ( was Re: The true faith ) Greg C
2002-01-26  0:40                                           ` AG
2002-02-11  7:18                                             ` David Combs
2002-02-11 17:50                                               ` Ray Blaak
2002-02-11 20:13                                               ` Kaz Kylheku
2002-02-13 21:17                                               ` Tom Hawker
2002-01-23 17:45                                         ` Georg Bauhaus
2002-01-18 19:36                                   ` Bruce Hoult
2002-01-18 19:57                                     ` Kaz Kylheku
2002-01-18 19:58                                     ` Marc Spitzer
2002-01-18 20:11                                       ` Ed Falis
2002-01-18 22:14                                         ` Kenny Tilton
2002-01-19  2:46                                           ` Thomas F. Burdick
2002-01-19  7:32                                     ` av1474
2002-02-13 23:12                                 ` Tom Hawker
2002-01-14 11:42                               ` Kevin McFarlane
2002-01-12  2:31                         ` Victor B. Putz
2002-01-12  3:56                         ` Kenny Tilton
2002-01-12  5:49                           ` israel r t
2002-01-12  6:04                             ` Thaddeus L Olczyk
2002-01-12  8:42                               ` Friedrich Dominicus
2002-01-12 15:44                             ` Andreas Bogk
2002-01-14 13:52                             ` Georg Bauhaus
2002-01-12 19:39                           ` Doug Hockin
2002-01-12 19:49                             ` Thaddeus L Olczyk
2002-01-12 20:14                             ` Kenny Tilton
2002-01-12 22:45                               ` Fernando Rodr�guez
2002-01-13  1:03                               ` Thomas F. Burdick
2002-01-13  5:24                                 ` Kenny Tilton
2002-01-12 15:58                         ` Preben Randhol
2002-01-12 16:18                           ` Nils Goesche
2002-01-12 17:03                             ` Thomas F. Burdick
2002-01-12 17:56                               ` Christopher Browne
2002-01-13  0:52                                 ` Thomas F. Burdick
2002-01-13 18:17                                   ` Nils Goesche
2002-01-13 19:04                                     ` Thomas F. Burdick
2002-01-13 19:26                                       ` James A. Robertson
2002-01-13 20:40                                         ` Nils Goesche
2002-01-13 20:43                                     ` Andreas Bogk
2002-01-13 19:05                             ` Preben Randhol
2002-01-13 19:20                               ` Preben Randhol
2002-01-16 12:00                           ` Christian Lynbech
     [not found]                       ` <9jtu3u8cq92b05j47uat3412tok6hq <3C409A34.7DE61ACB@nyc.rr.com>
2002-01-13 15:23                         ` Patrick Doyle
2002-01-13 16:29                           ` Dr. Edmund Weitz
     [not found]                       ` <9jtu3u8cq92b05j47uat3412tok6hq <i1t28.632$XG4.38637@news2.calgary.shaw.ca>
2002-01-22 14:25                         ` Copying semantics molehill (was Re: True faiths) Patrick Doyle
2002-01-22 15:47                           ` Steven T Abell
2002-01-26 17:32                             ` Patrick Doyle
2002-01-22 18:00                           ` Kaz Kylheku
2002-01-26 17:37                             ` Patrick Doyle
2002-01-28  3:08                           ` Robert Dewar
2002-01-28 18:47                             ` Patrick Doyle
2002-01-23  1:43                       ` True faiths ( was Re: The true faith ) Larry Kilgallen
     [not found]                       ` <9jtu3u8cq92b05j47uOrganization: LJK Software <FfppBdBcNxcL@eisner.encompasserve.org>
2002-01-23  2:04                         ` Jim Rogers
2002-01-23 17:02                           ` Darren New
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox