Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: Jeff Denham <jdenham@brighttiger.com>
Subject: Re: Lots of Threads = Death?
Date: 1998/05/01	[thread overview]
Message-ID: <3549EB07.297782BA@brighttiger.com> (raw)
In-Reply-To: 3547819c.27638403@149.174.211.108


Ron Heiby wrote:

> Thanks to Dirk and Jeff for their quick responses. I have not had a chance
> to re-tune my kernel yet, to try either of their suggestions.
>
> Jeff suggested that I bump vm-vpagemax. Since the problem I ran into happens
> quite close to 128Meg, and the vm-vpagemax parameter is set at its default
> value of 16384 pages (128Meg), I'm guessing that that is the immediate
> problem.
>
> Dirk suggested that I bump vm-mapentries. The vm-mapentries parameter
> certainly sounds like it would / should be involved here, as well. But, I am
> confused by what I read in Dirk's article and the "System Tuning and
> Performance Management" manual (AA-Q0R3D-TE).
>
> Dirk Grunwald wrote:
> > each stack entry requires one or more 'pmap' entries. A pmap is a
> > range of virtual -> physical mappings that share the same acccess
> > permissions.
> >
> > Threads tend to chew up a lot of map entries because each heap uses
> > two protection areas (one that is writable, and the guard page that is
> > not accessable).
>
> This makes sense.
>
> > I think that kernel parameter is called 'vm-mapentries'.
>
> According to the manual, that is, indeed, the parameter involved in this.
>
> My confusion is that my parameter is currently set at the default value of
> 200. Yet, I'm managing to create over 3700 threads before getting into
> trouble. I would think that each thread would require 2 of the 200
> vm-mapentries (at least) -- one for the stack and one for the guard. This
> would tend to say to me that I should have been able to create just under
> 100 threads. I hope that the source of my confusion is evident.

The vpagemax value is what's helping you here. The issue
is the creation of guard pages (red zones) for each stack
to detect stack overrun. The guard pages (which come
out of the heap like the rest of the thread stack) are
marked no-access, of course. I believe in the original Mach
VM (2.5 era), that would have forced the creation of
a new map entry, because of the "discontiguous" nature
of changing the guard page's protection in the midst
of all those read/write pages. You'd chew up a lot of map
entries this way with lots of threads! A big lists of map
entries can cause long list traversals in certain situations.

The Digital rewrite of the Mach VM for DEC OSF/1 V1.2,
introduced the vpagemax concept to avoid increasing
the number of map entries in response to "minor"
changes in a group of otherwise like pages of VM.
Instead of creating a new map entry, a virtual page
list is created in the entry to hold up to 'vpagemax'
page descriptors for the pages in the VM range covered
by the map entry. This list is much easier to manage
than map entries, and allows pages with, say, different protections to coexist
side-by-side in the map entry.

Anyway, in spite of this murky description, I want to
make clear that the vm-vpagemax parameter is much more
likely to be involved in thread-creation problems
than vm-mapentries is.

[That said, I should muddy the waters even more by saying that
in an upcoming release of Digital UNIX, that story is reversed with the advent
of a completely new method of creating user
thread stacks. These nifty little stack objects will make
life much easier by allowing huge thread stacks at much
lower cost in VM -- they won't take up VM/swap resources
for pages you're not using. If I recall, the default
stack size will be 5 meg. Something like that...]

Apologies in advance for any distorted facts and recollections!

__________________________________________________
Jeff Denham (jdenham@brighttiger.com)

Bright Tiger Technologies
SmartCluster� Software for Distributed Web Servers
http://www.brighttiger.com

125 Nagog Park
Acton, MA 01720
Phone: (978) 263-5455 x177
Fax:   (978) 263-5547





  parent reply	other threads:[~1998-05-01  4:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-04-28  4:00 Lots of Threads = Death? Ron Heiby
1998-04-28  4:00 ` Dirk Grunwald
1998-04-29  4:00   ` Jeff Denham
1998-04-29  4:00     ` Charles M Richmond
1998-04-30  4:00     ` Ron Heiby
1998-04-30  4:00       ` Darron Shaffer
1998-05-01  4:00         ` Casper H.S. Dik - Network Security Engineer
1998-05-01  4:00       ` Jeff Denham [this message]
1998-05-05  4:00     ` Ron Heiby
1998-05-06  4:00       ` Rik van Riel
1998-05-06  4:00         ` Ron Heiby
1998-05-06  4:00           ` Rik van Riel
1998-05-07  4:00         ` Ron Heiby
1998-05-08  4:00       ` Lots of Threads = Digital Unix. Period Srikanth Throvagunta
1998-05-11  4:00         ` Ron Heiby
read-only archive

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