comp.lang.ada
 help / color / mirror / Atom feed
From: Warren <ve3wwg@gmail.com>
Subject: Re: Threadpool with priority version 1.1 ...
Date: Fri, 26 Mar 2010 19:35:13 +0000 (UTC)
Date: 2010-03-26T19:35:13+00:00	[thread overview]
Message-ID: <Xns9D479E8FDF69BWarrensBlatherings@188.40.43.245> (raw)
In-Reply-To: 7b059d0f-791b-4ac9-bf64-c50448ec99f7@b30g2000yqd.googlegroups.com

Maciej Sobczak expounded in
news:7b059d0f-791b-4ac9-bf64-c50448ec99f7@b30g2000yqd.googlegroups.com: 
..
> The difference between application and OS is in the amount of
> knowledge about what the software will do and applications tend to
> know more than OS in this aspect.

Yes.

> That is why it is more realistic to have applications allocating their
> resources during initialization phase than to see that at the OS
> level.

I would generally agree with that, unless the cost of resource
management was cleverly reduced.

> I'm not a big fan of programs that allocate and deallocate the same
> resource repeatedly - this is an obvious candidate for caching and
> object reuse, where the cost of allocation is amortized.

As a general principle this is right. But memory is another
resource that sometimes needs careful management. With only
1 thread, you have a heap growing up to the stack and a stack
that grows towards the heap. Either stack or heap can be huge
(potentially at least), as long as both are not at the same
time (overlapping).

The moment you add 1 [additional] thread, you've now drawn
the line in the sand for the lowest existing stack, and
putting a smaller limit on it.

This disadvantage is ok for probably most threaded programs,
but perhaps not for a video rendering program that might 
hog resources on both heap and stack sides at differing
times.

In the end, the application programmer must plan this out,
but this is a limitation that I dislike about our current
execution environments. I suppose, just increasing the
size of your VM address space, postpones the problem 
until we hit limits again. ;-)

> Fortunately,
> it is not even necessary for a user code to do that - think about a
> caching memory allocator, there are analogies. And the language
> standard does not prevent implementations from reusing physical
> threads, if they are used as implementation foundations for tasks.
> Maciej Sobczak * http://www.inspirel.com

From an efficiency pov, this is all well and good. But
if you want maximum dynamic allocation of heap+stack,
then you might prefer fewer (if any) pre-allocated threads
(implying additional stacks).

Warren



  reply	other threads:[~2010-03-26 19:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <21e6697e-fd7c-4c5e-93dc-8d894449b5e6@f8g2000yqn.googlegroups.com>
     [not found] ` <ff3671a8-cf19-4cee-8b71-305bb6b1e9c1@l25g2000yqd.googlegroups.com>
     [not found]   ` <4ba9e189$0$6886$9b4e6d93@newsspool2.arcor-online.net>
     [not found]     ` <1id5xnuz0x892$.1odbic5ppiv07.dlg@40tude.net>
2010-03-24 14:55       ` Threadpool with priority version 1.1 Georg Bauhaus
2010-03-24 16:40         ` Warren
2010-03-24 18:27           ` Ada parallelism (was: Re: Threadpool with priority version 1.1 ...) Georg Bauhaus
2010-03-24 20:04             ` Warren
2010-03-25  8:24               ` Ada parallelism Dmitry A. Kazakov
2010-03-25 13:44                 ` Robert A Duff
2010-03-25 14:09                   ` Dmitry A. Kazakov
2010-03-24 21:46           ` Threadpool with priority version 1.1 Maciej Sobczak
2010-03-25 17:21             ` Warren
2010-03-25 17:30             ` Warren
2010-03-26  8:19               ` Dmitry A. Kazakov
2010-03-26  9:30                 ` Maciej Sobczak
2010-03-26 19:35                   ` Warren [this message]
2010-03-25  8:39         ` Dmitry A. Kazakov
replies disabled

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