Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Lots of Threads = Death?
@ 1998-04-28  4:00 Ron Heiby
  1998-04-28  4:00 ` Dirk Grunwald
  0 siblings, 1 reply; 15+ messages in thread
From: Ron Heiby @ 1998-04-28  4:00 UTC (permalink / raw)



Hi! I'm seeing some strange goings on with creation and destruction of lots
of threads.

I'm using a DEC Alpha system with 128Meg of RAM running 3.2G. Before the
start of each test, the system had approximately 9250 pages of free memory,
according to vmstat. As a test, I wrote a program that creates a thread
(pthread_create), passing it a value that came from the command line (int).
The initial thread then does a join on the thread it created, effectively
blocking until that thread terminates.

The newly created thread checks to see if the value it got is zero. If it's
zero, it just blocks on a gets() call. If it's > 0, then the thread creates
a thread and does a join on that thread. The new new thread is passed a
value one less than its parent received, and is instructed to start
executing the same function that its parent was executing.

This has the effect of causing N threads to be created, with no more than
one thread created by each thread.

I used vmstat to monitor the progress of this process' execution and the
system resources that were being used along the way. At an appropriate
point, after vmstat showed the system stable again, I press Enter,
satisfying the last thread's gets() call. It exits, causing its parent
thread's join to return. When the join returns, the thread exits. Thus, the
satisfaction of the gets() causes (eventually) all of the threads to
terminate. The initial thread, when its join returns, displays a message and
waits on another gets() call.

So, we've got something fairly simple here. A bunch of threads get created
and do nothing but create a thread and wait for it to exit. Eventually, the
waits are satisfied and all the threads exit, leaving just the initial
thread.

After running this program with just a few to a dozen threads, to verify its
correct operation, I opened it up. I tried 2000 threads. (We had earlier
tuned the kernel to allow 4000 threads per user.)

Watching vmstat's output, I saw pretty much what I expected to see. I saw
the number of waiting threads increase by 2000. I saw the amount of free
memory drop. I saw a lost of user and system cpu time. But, all the threads
got created in about 10 seconds. The system stayed pretty happy throughout
the several minutes I allowed it to sit there with the extra 2000 waiting
threads. Then, I hit the Enter key and watched the threads self-destruct.
First, I was surprised to see even more memory being used as the threads
exited. There was a spike in zero-fill page requests of at least one per
thread. Also, the thread destructions took significantly longer to finish
than their creation had. Another thing that surprised me was that the
available memory did not all return until the initial thread (and the
process as a whole) terminated. This implies that the pages allocated for
the threads were being allocated within the context of the process, and were
not being given back to the system until process termination.

Deciding to push the envelope a bit, I fired up my program for 2500 threads.
This behaved much like the 2000 thread case, except that it drove available
memory lower.

Based on something I'd seen in an earlier test, I pushed a bit further, to
2600 threads. This time, the number of free pages was reduced to about 100,
at which point it appears that a kernel process kicked in to attempt to
recover free memory space. After a while, it had managed to return the free
memory reading to a little over 3500 pages. During the time it was doing its
thing, however, the number of waiting threads changed. The number stopped
reflecting the 2600 threads in my program, returning to the value it had
before I started the test. When the memory recover operation concluded, the
number of waiting threads returned to its value indicating my waiting
threads. It's as though they vanished for a minute or so, then re-appeared.
They did not appear on either of the other two columns in vmstat.

I continued to push things until a run where I asked for 5000 threads. It
didn't make it. I got an error message where I ran the program:

$ ./tc 5000
Main Thread 5000 started - Thread ID= -1071781384
%DECthreads bugcheck (version V3.12-311), terminating execution.
% Running on DEC OSF/1 AXP [OSF1 alpha V3.2(62); cpu type 30,
	configured for 1
%  cpu, 1 cpu in box, 128Mb]
% Reason: set_noaccess: 12 protecting 0x8010000 to 0x8011fff
% See 'cma_dump.log' for state information.
Resources lost(coredump)

I found both a cma_dump.log file (about 4,700,000 bytes) and a (quite large)
core. According to the cma_dump.log, everything was going along pretty well
until I got to thread 3761. It's information from the log file is:

  Thread 3761 (running) "<pthread user@0x8007b40>" (0x7eb8018)
    Scheduling: throughput policy at priority 19
    There is 1 thread waiting to join
    Thread specific data: 1: 0x7ea3f88
    Stack: 0x800f788; base is 0x8010000, guard area at 0x8009fff
    General cancelability enabled, asynch cancelability disabled
    Current vp is 11285, synch port is 11286
      VP state is run: Mach policy throughput, priority 19 (RT kernel),
state
        running; synch port has 0 messages out of 1
    Join uses mutex 7598 and condition variable 7521; wait uses mutex 7599
and
      condition variable 7522
    The thread's start function and argument are 0x120013cc0 (0x4d8)
    The thread's latest errno is 12

So, it looks like I ran out of some kind of space for thread stacks. To try
to work around this, I set the thread attributes for thread creation to use
a stack size of 16000 (figuring I'd get 16K instead of 32K, allowing me
about twice as many threads). Although I can confirm that this value was
set, 32K was still given to each thread, causing my next test to blow up at
exactly the same point.

So, what's up? What am I running out of? What do I need to do to fix it?
What should I be doing differently, smarter, better?

Thanks!




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Lots of Threads = Death?
  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
  0 siblings, 1 reply; 15+ messages in thread
From: Dirk Grunwald @ 1998-04-28  4:00 UTC (permalink / raw)




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).

You can duplicate the same effect by using 'mmap' to allocate
bazillions of pages, and make certain adjacent pages don't have the
same permissions.

My guess is you're running over the limit of the number of pmap
regions you can have.

I think that kernel parameter is called 'vm-mapentries'.  You should
see it's current setting if you do a 'sysconfig -q vm | grep -i map'.
You should be able to reconfigure it using /etc/sysconfigtab.

-- 
Dirk Grunwald                 Assoc. Prof, Univ. of Colorado at Boulder



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Lots of Threads = Death?
  1998-04-28  4:00 ` Dirk Grunwald
@ 1998-04-29  4:00   ` Jeff Denham
  1998-04-29  4:00     ` Charles M Richmond
                       ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Jeff Denham @ 1998-04-29  4:00 UTC (permalink / raw)



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).
>
> You can duplicate the same effect by using 'mmap' to allocate
> bazillions of pages, and make certain adjacent pages don't have the
> same permissions.
>
> My guess is you're running over the limit of the number of pmap
> regions you can have.
>
> I think that kernel parameter is called 'vm-mapentries'.  You should
> see it's current setting if you do a 'sysconfig -q vm | grep -i map'.
> You should be able to reconfigure it using /etc/sysconfigtab.

Also, why you're at it, increase the vpagemax parameter -- say double or
tripleit. See the documentation on kernel tuning.

__________________________________________________
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





^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Lots of Threads = Death?
  1998-04-29  4:00   ` Jeff Denham
@ 1998-04-29  4:00     ` Charles M Richmond
  1998-04-30  4:00     ` Ron Heiby
  1998-05-05  4:00     ` Ron Heiby
  2 siblings, 0 replies; 15+ messages in thread
From: Charles M Richmond @ 1998-04-29  4:00 UTC (permalink / raw)
  To: heiby_u


Jeff Denham wrote:
> 
> 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).
> >
> > You can duplicate the same effect by using 'mmap' to allocate
> > bazillions of pages, and make certain adjacent pages don't have the
> > same permissions.
> >
> > My guess is you're running over the limit of the number of pmap
> > regions you can have.
> >
> > I think that kernel parameter is called 'vm-mapentries'.  You should
> > see it's current setting if you do a 'sysconfig -q vm | grep -i map'.
> > You should be able to reconfigure it using /etc/sysconfigtab.
> 
> Also, why you're at it, increase the vpagemax parameter -- say double or
> tripleit. See the documentation on kernel tuning.

The original poster was asking about his DEC Alpha with D Unix 3.2g
Download the sys_check package from ftp://ftp.digital.com/pub/DEC/IAS/

It will make some recommendations. For my machine it recommended:

 vfs:
        name-cache-hash-size = 512
vm:
        vm-mapentries = 16384
        vm-vpagemax = 65536
        vm-ubcseqpercent=20
        new-wire-method=0

Caveat: My machine is running 4.0b

-- 
***********************************************************************
*  Charles Richmond    Integrated International Systems Corporation   *
*  cmr@iisc.com        cmr@koibito.iisc.com  cmr@shore.net            *
*  UNIX Internals, I18N, L10N, X, Realtime Imaging, and  Custom S/W   *
*  One Longfellow Place Suite 3309 , Boston , Ma. USA 02114-2431      *
*  (617) 723 7695    (617) 367 3151        FAX (617) 723 6861         *
***********************************************************************



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Lots of Threads = Death?
  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       ` Jeff Denham
  1998-05-05  4:00     ` Ron Heiby
  2 siblings, 2 replies; 15+ messages in thread
From: Ron Heiby @ 1998-04-30  4:00 UTC (permalink / raw)



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.




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Lots of Threads = Death?
  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
  1 sibling, 1 reply; 15+ messages in thread
From: Darron Shaffer @ 1998-04-30  4:00 UTC (permalink / raw)




heiby_u@falkor.chi.il.us (Ron Heiby) writes:

> 
> 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.
> 

How does that operating system allocate thread stacks?  Does it
support stack growth for threads?

Some Unices (Unixen?) use malloc/sbrk to acquire stacks for new
threads and no stack growth is allowed.  In this case, no mapentries
would be needed for these stacks.  In addition, thread termination
would not necessarily return memory to the kernel.

Almost any user space implementation of threads would have these
characteristics.  Many half kernel/half user implementations would as
well.

Darron Shaffer


-- 
 __  __  _          
 _ ) ___ _\ 		 			
 __) __    \  Enterprise Middleware Solutions	Darron J. Shaffer
              BEA Systems Inc.			Sr. Software Engineer
              17101 Preston Rd			darron.shaffer@beasys.com 
              LB# 115, Ste 260	 		Voice: (972) 738-6137     
              Dallas, TX 75248 			Fax:   (972) 738-6111     
	      http://www.beasys.com



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Lots of Threads = Death?
  1998-04-30  4:00       ` Darron Shaffer
@ 1998-05-01  4:00         ` Casper H.S. Dik - Network Security Engineer
  0 siblings, 0 replies; 15+ messages in thread
From: Casper H.S. Dik - Network Security Engineer @ 1998-05-01  4:00 UTC (permalink / raw)



[[ PLEASE DON'T SEND ME EMAIL COPIES OF POSTINGS ]]

Darron Shaffer <darron.shaffer@beasys.com> writes:

>Almost any user space implementation of threads would have these
>characteristics.  Many half kernel/half user implementations would as
>well.


Well, even if you allow stack growth (Solaris maps the stacks unreserved),
you still have the problem of running out of address space)


Defautl Solaris trhead stack size is 1MB, so with 3000 threads you've
consumed 3GB of address space and that's about all you've got.

You can change the defautl stacksize to something smaller.

Casper
--
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Lots of Threads = Death?
  1998-04-30  4:00     ` Ron Heiby
  1998-04-30  4:00       ` Darron Shaffer
@ 1998-05-01  4:00       ` Jeff Denham
  1 sibling, 0 replies; 15+ messages in thread
From: Jeff Denham @ 1998-05-01  4:00 UTC (permalink / raw)



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





^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Lots of Threads = Death?
  1998-04-29  4:00   ` Jeff Denham
  1998-04-29  4:00     ` Charles M Richmond
  1998-04-30  4:00     ` Ron Heiby
@ 1998-05-05  4:00     ` Ron Heiby
  1998-05-06  4:00       ` Rik van Riel
  1998-05-08  4:00       ` Lots of Threads = Digital Unix. Period Srikanth Throvagunta
  2 siblings, 2 replies; 15+ messages in thread
From: Ron Heiby @ 1998-05-05  4:00 UTC (permalink / raw)



I've re-tuned my kernel according to both suggestions I'd received. Sure
enough, I am able to create more threads. However, there is a part of this
experiment that still has me puzzled.

When I started, I knew that the system tunable parameter limit on the number
of threads I could have would stop me before I was anywhere near where I
wanted to test. So, I configured max-proc-per-user to 4000. The command
"/sbin/sysconfig -q proc" confirmed that it (and max-threads-per-user) was
set to 4000.

After receiving the advice here on the other tunables to increase, I decided
that I wanted to push things a bit, and try up to 6000 threads. So, I
re-configured max-proc-per-user to 8000. When I again did a "/sbin/sysconfig
-q proc", I expected to see 8000 for max-proc-per-user and
max-threads-per-user, but I did not. Instead, each was set to 4107.

Now, I think that 4107 is an interesting number for two reasons.

1) It isn't what I asked for.
2) It isn't a power of 2 (loved by us computer types).

Instead, it's (37 * 37 * 3). I don't get it.

1) Why isn't my system getting tuned for the values I'm setting?
2) How do I tune my system for more than 4107 threads?

Thanks!




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Lots of Threads = Death?
  1998-05-05  4:00     ` Ron Heiby
@ 1998-05-06  4:00       ` Rik van Riel
  1998-05-06  4:00         ` Ron Heiby
  1998-05-07  4:00         ` Ron Heiby
  1998-05-08  4:00       ` Lots of Threads = Digital Unix. Period Srikanth Throvagunta
  1 sibling, 2 replies; 15+ messages in thread
From: Rik van Riel @ 1998-05-06  4:00 UTC (permalink / raw)



On Tue, 5 May 1998, Ron Heiby wrote:

> After receiving the advice here on the other tunables to increase, I decided
> that I wanted to push things a bit, and try up to 6000 threads. So, I
> re-configured max-proc-per-user to 8000. When I again did a "/sbin/sysconfig
> -q proc", I expected to see 8000 for max-proc-per-user and
> max-threads-per-user, but I did not. Instead, each was set to 4107.
> 
> Now, I think that 4107 is an interesting number for two reasons.
> 
> 1) It isn't what I asked for.
> 2) It isn't a power of 2 (loved by us computer types).
> 
> Instead, it's (37 * 37 * 3). I don't get it.
> 
> 1) Why isn't my system getting tuned for the values I'm setting?
> 2) How do I tune my system for more than 4107 threads?

The hardware has support for 8192 LDT entries on one
page. Unless the OS supports soft switching (there was
a softswitching patch for Linux) you can't have more
threads.

Each thread uses two entries and the other ones are used
by the system...

Rik.
+-------------------------------------------+--------------------------+
| Linux: - LinuxHQ MM-patches page          | Scouting       webmaster |
|        - kswapd ask-him & complain-to guy | Vries    cubscout leader |
|     http://www.phys.uu.nl/~riel/          | <H.H.vanRiel@phys.uu.nl> |
+-------------------------------------------+--------------------------+




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Lots of Threads = Death?
  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
  1 sibling, 1 reply; 15+ messages in thread
From: Ron Heiby @ 1998-05-06  4:00 UTC (permalink / raw)



On Wed, 6 May 1998 07:30:36 GMT,
Rik van Riel <riel@phys.uu.nl> wrote:
>The hardware has support for 8192 LDT entries on one
>page. Unless the OS supports soft switching (there was
>a softswitching patch for Linux) you can't have more
>threads.

Rik, Thank you very much for your response. One thing I'd like you to
clarify is whether your response is specific to Linux or is more general. As
I said in the message that started this thread, I am running on a DEC Alpha
machine running Digital UNIX 3.2G.

Thanks!




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Lots of Threads = Death?
  1998-05-06  4:00         ` Ron Heiby
@ 1998-05-06  4:00           ` Rik van Riel
  0 siblings, 0 replies; 15+ messages in thread
From: Rik van Riel @ 1998-05-06  4:00 UTC (permalink / raw)



On Wed, 6 May 1998, Ron Heiby wrote:
> On Wed, 6 May 1998 07:30:36 GMT,
> Rik van Riel <riel@phys.uu.nl> wrote:
> >The hardware has support for 8192 LDT entries on one
> >page. Unless the OS supports soft switching (there was
> >a softswitching patch for Linux) you can't have more
> >threads.
> 
> Rik, Thank you very much for your response. One thing I'd like you to
> clarify is whether your response is specific to Linux or is more general. As
> I said in the message that started this thread, I am running on a DEC Alpha
> machine running Digital UNIX 3.2G.

Well, since you didn't manage to get more than 4k-something
threads, I suspect that the same thing might be going on for
Digital Unix...

You might want to check this though on:
http://www.partner.digital.com/www-swdev/pages/Home/TECH/
documents/Digital_UNIX/

for more (loads more) info. I suspect that all their
manuals are on-line, with perhaps even some extra's...
I got some _great_ ideas from the DU documentation and
am currently implementing some for Linux :)

succes,

Rik.
+-------------------------------------------+--------------------------+
| Linux: - LinuxHQ MM-patches page          | Scouting       webmaster |
|        - kswapd ask-him & complain-to guy | Vries    cubscout leader |
|     http://www.phys.uu.nl/~riel/          | <H.H.vanRiel@phys.uu.nl> |
+-------------------------------------------+--------------------------+




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Lots of Threads = Death?
  1998-05-06  4:00       ` Rik van Riel
  1998-05-06  4:00         ` Ron Heiby
@ 1998-05-07  4:00         ` Ron Heiby
  1 sibling, 0 replies; 15+ messages in thread
From: Ron Heiby @ 1998-05-07  4:00 UTC (permalink / raw)



Rik van Riel <riel@phys.uu.nl> wrote:
>The hardware has support for 8192 LDT entries on one
>page. Unless the OS supports soft switching (there was
>a softswitching patch for Linux) you can't have more
>threads.
>
>Each thread uses two entries and the other ones are used
>by the system...

Hey, WAIT A MINUTE! If each thread requires 2, and some are used by the
system, and there are only 8192 to start with, then how do I end up getting
4107, which is greater than 8192/2?

Also, this does appear to be a per-USER limit. If I try my test to create
3000 threads in each of two processes under my user id, then I get stopped
when the second one hits the 4107 limit. If I try my test to create 3000
threads in each of two processes under different user ids, then it proceeds
beyond the 4107 limit. (I ran out of swap space before reaching 6000, but
had over 5000 at that point.)

Still looking for the answer on this one....




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Lots of Threads = Digital Unix. Period.
  1998-05-05  4:00     ` Ron Heiby
  1998-05-06  4:00       ` Rik van Riel
@ 1998-05-08  4:00       ` Srikanth Throvagunta
  1998-05-11  4:00         ` Ron Heiby
  1 sibling, 1 reply; 15+ messages in thread
From: Srikanth Throvagunta @ 1998-05-08  4:00 UTC (permalink / raw)



Ron Heiby wrote:

> I've re-tuned my kernel according to both suggestions I'd received. Sure
> enough, I am able to create more threads. However, there is a part of this
> experiment that still has me puzzled.
>

Digital Unix supports real-time scheduling of threads. There is also another feature of
Digital Unix which is called two-level scheduling. It basically maps user threads on to
kernel execution contexts (what are known as LWPs in Solaris). Kernel execution
contexts are the kernel threads. There can be any number of user threads mapping on
to kernel threads. The number of kernel threads is limited by Digital Unix configuration.
I feel you should take these factors into consideration, when you are playing with Digital Unix.

Regards
Srikanth





^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Lots of Threads = Digital Unix. Period.
  1998-05-08  4:00       ` Lots of Threads = Digital Unix. Period Srikanth Throvagunta
@ 1998-05-11  4:00         ` Ron Heiby
  0 siblings, 0 replies; 15+ messages in thread
From: Ron Heiby @ 1998-05-11  4:00 UTC (permalink / raw)



Srikanth Throvagunta <sthrovag@cisco.com> wrote:
>There is also another feature of
>Digital Unix which is called two-level scheduling.
>It basically maps user threads on to
>kernel execution contexts (what are known as LWPs in Solaris).
>...
>I feel you should take these factors into consideration,
>when you are playing with Digital Unix.

You make a very good point. However, I am concerned about how widespread
this feature is. There is no guarantee that I am going to be using Digital
UNIX for the life of the application. For that matter, there is no guarantee
that it's even going to be rolled out on Digital UNIX in the first place!

Also, and my understanding here may be cloudy, since the main impetus behind
having lots of threads is to be able to efficiently handle lots of
concurrent and always-connected sockets, I don't know that user mode threads
would do me much good. I had been thinking that I wanted to be able to do
blocking I/O on those sockets. If I do, am I not causing one of my (more
limited number of) kernel contexts to block, making it unavailable for other
use until the I/O completes?

Thanks!




^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~1998-05-11  4:00 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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