473,785 Members | 3,285 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Max. Thread Amount of Windows XP and / or Windows Server 2003

Hi @ll,

I'm working on a web project which has to use multiple channels to
connect to receive several sources at once. The problem is, that I'm
not aware of the maximum amount of Threads i can allocate to my
channels.

Can i open 10 threads, 100 threads even 1000?

is there a general answer to it. my dev. environment runs on win. xp
and the application will run on a ms server 2003.

Kind regards,
Roni Schuetz

May 1 '06 #1
9 1856
While you can open as many as you like, each thread taxes system resources
moderately. .NET makes the threadpool class available to help perform thread
related tasks without having to manage creation and destruction of threads.

--

_______________ _________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Professional VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------

<sc*****@gmail. com> wrote in message
news:11******** *************@y 43g2000cwc.goog legroups.com...
Hi @ll,

I'm working on a web project which has to use multiple channels to
connect to receive several sources at once. The problem is, that I'm
not aware of the maximum amount of Threads i can allocate to my
channels.

Can i open 10 threads, 100 threads even 1000?

is there a general answer to it. my dev. environment runs on win. xp
and the application will run on a ms server 2003.

Kind regards,
Roni Schuetz

May 1 '06 #2
It is around 2000, but is a function of memory and stack size.
http://blogs.msdn.com/oldnewthing/ar...29/444912.aspx

--
William Stacey [MVP]

<sc*****@gmail. com> wrote in message
news:11******** *************@y 43g2000cwc.goog legroups.com...
| Hi @ll,
|
| I'm working on a web project which has to use multiple channels to
| connect to receive several sources at once. The problem is, that I'm
| not aware of the maximum amount of Threads i can allocate to my
| channels.
|
| Can i open 10 threads, 100 threads even 1000?
|
| is there a general answer to it. my dev. environment runs on win. xp
| and the application will run on a ms server 2003.
|
| Kind regards,
| Roni Schuetz
|
May 1 '06 #3
It is a function of stack size, but you can change the stack size by calling
the CreateThread API directly (not sure if its in your link or not)
"William Stacey [MVP]" <wi************ @gmail.com> wrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
It is around 2000, but is a function of memory and stack size.
http://blogs.msdn.com/oldnewthing/ar...29/444912.aspx

--
William Stacey [MVP]

<sc*****@gmail. com> wrote in message
news:11******** *************@y 43g2000cwc.goog legroups.com...
| Hi @ll,
|
| I'm working on a web project which has to use multiple channels to
| connect to receive several sources at once. The problem is, that I'm
| not aware of the maximum amount of Threads i can allocate to my
| channels.
|
| Can i open 10 threads, 100 threads even 1000?
|
| is there a general answer to it. my dev. environment runs on win. xp
| and the application will run on a ms server 2003.
|
| Kind regards,
| Roni Schuetz
|

May 2 '06 #4
So this is really interesting to me. I completely agree with the analysis
but for curiosity sake, I wrote a small app to test the theory. My code
follows. With the catch block commented out, studio 05 explodes with a bang
indicating some sort of package error and then disappears from screen.
Subsequent runs do not even provide an error message, visual studio 2005 on
XP simple disappears. Can anyone reproduce this?

As an aside, without the .start() call, the application will actually run to
completion. I'm not entirely sure what's happening there. Under the
debugger, I can only see 4 threads so it seems the threads aren't *actually
being created, it appears that they are created when start() is called - at
least that's my initial analysis. With the catch block i was able to create
and run 1401 threads. I'll accept that as close enough.

using System;

using System.Collecti ons.Generic;

using System.Text;

using System.Threadin g;

namespace ConsoleApplicat ion1

{

public class Threaded

{

public void DoWork()

{

System.Threadin g.Thread.Sleep(-1);

return;

}

}

class Program

{

static void Main(string[] args)

{

Threaded mythread = new Threaded();

int i = 0;

Thread var = null;

//try

{

for (; i < 1000000; i++)

{

var = new Thread(new ThreadStart(myt hread.DoWork));

if (var == null)

{

break;

}

var.Name = i.ToString();

var.Start();

}

}

//catch

{

}

Console.Write(i .ToString());

System.Threadin g.Thread.Sleep( 1500);

}

}

}
--

_______________ _________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Professional VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------

"Greg Young" <Dr************ *@hotmail.com> wrote in message
news:en******** ******@TK2MSFTN GP03.phx.gbl...
It is a function of stack size, but you can change the stack size by
calling the CreateThread API directly (not sure if its in your link or
not)
"William Stacey [MVP]" <wi************ @gmail.com> wrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
It is around 2000, but is a function of memory and stack size.
http://blogs.msdn.com/oldnewthing/ar...29/444912.aspx

--
William Stacey [MVP]

<sc*****@gmail. com> wrote in message
news:11******** *************@y 43g2000cwc.goog legroups.com...
| Hi @ll,
|
| I'm working on a web project which has to use multiple channels to
| connect to receive several sources at once. The problem is, that I'm
| not aware of the maximum amount of Threads i can allocate to my
| channels.
|
| Can i open 10 threads, 100 threads even 1000?
|
| is there a general answer to it. my dev. environment runs on win. xp
| and the application will run on a ms server 2003.
|
| Kind regards,
| Roni Schuetz
|


May 2 '06 #5
"Alvin Bruney" <www.lulu.com/owc> wrote in message
news:ef******** *****@TK2MSFTNG P05.phx.gbl...
| So this is really interesting to me. I completely agree with the analysis
| but for curiosity sake, I wrote a small app to test the theory. My code
| follows. With the catch block commented out, studio 05 explodes with a
bang
| indicating some sort of package error and then disappears from screen.
| Subsequent runs do not even provide an error message, visual studio 2005
on
| XP simple disappears. Can anyone reproduce this?
|

No, I don't. I can create 1948 threads when run in VS2005, at that point the
CLR throws an OOM exception.
Guess you are exhausting your available Virtual Memory space (pageable RAM +
free page file space), before you reach the maximum Virtual Address Space
for a Win32 process (~2GB).
You can increase the page file size and try again.
| As an aside, without the .start() call, the application will actually run
to
| completion. I'm not entirely sure what's happening there. Under the
| debugger, I can only see 4 threads so it seems the threads aren't
*actually
| being created, it appears that they are created when start() is called -
at
| least that's my initial analysis. With the catch block i was able to
create
| and run 1401 threads. I'll accept that as close enough.
|

The OS thread is created when Start() is called, don't know why you see 4
threads in the debugger, you should only have 3 threads before you start the
first auxiliary thread.

Willy.
May 2 '06 #6
This definitely seems to be a bug in studio. I could reproduce this
everytime with the catch block commented out.
Guess you are exhausting your available Virtual Memory space (pageable RAM
+
free page file space), before you reach the maximum Virtual Address Space I don't think so. I did play with the page file a bit but the best I could
get on my dell laptop was 1843 with page file set to 2 meg.

--

_______________ _________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Professional VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------

"Willy Denoyette [MVP]" <wi************ *@telenet.be> wrote in message
news:uU******** ******@TK2MSFTN GP05.phx.gbl... "Alvin Bruney" <www.lulu.com/owc> wrote in message
news:ef******** *****@TK2MSFTNG P05.phx.gbl...
| So this is really interesting to me. I completely agree with the
analysis
| but for curiosity sake, I wrote a small app to test the theory. My code
| follows. With the catch block commented out, studio 05 explodes with a
bang
| indicating some sort of package error and then disappears from screen.
| Subsequent runs do not even provide an error message, visual studio 2005
on
| XP simple disappears. Can anyone reproduce this?
|

No, I don't. I can create 1948 threads when run in VS2005, at that point
the
CLR throws an OOM exception.
Guess you are exhausting your available Virtual Memory space (pageable RAM
+
free page file space), before you reach the maximum Virtual Address Space
for a Win32 process (~2GB).
You can increase the page file size and try again.
| As an aside, without the .start() call, the application will actually
run
to
| completion. I'm not entirely sure what's happening there. Under the
| debugger, I can only see 4 threads so it seems the threads aren't
*actually
| being created, it appears that they are created when start() is called -
at
| least that's my initial analysis. With the catch block i was able to
create
| and run 1401 threads. I'll accept that as close enough.
|

The OS thread is created when Start() is called, don't know why you see 4
threads in the debugger, you should only have 3 threads before you start
the
first auxiliary thread.

Willy.


May 2 '06 #7

"Alvin Bruney" <www.lulu.com/owc> wrote in message
news:eI******** ******@TK2MSFTN GP05.phx.gbl...
| This definitely seems to be a bug in studio. I could reproduce this
| everytime with the catch block commented out.
|

Well, I can't, running VS2005 Team System.

| > Guess you are exhausting your available Virtual Memory space (pageable
RAM
| > +
| > free page file space), before you reach the maximum Virtual Address
Space
| I don't think so. I did play with the page file a bit but the best I could
| get on my dell laptop was 1843 with page file set to 2 meg.

Hmm... 2MB, must be your problem :-)
How much RAM do you have available? What else do you have running?

The code you posted both, Debug and release version:
Stop with console message:
Unhandled Exception: OutOfMemoryExce ption.

after 1949 threads created and a VM size 2.005.132K

1949 threads, that is 3 initial threads + 1946 auxiliary.

Run debug mode (CTRL F5) debug version:

stop at var.Start() with unhandle exception dialog (debugger)
Exception of type 'System.OutOfMe moryException' was thrown.

after 1889 threads created and VM 1.954.748K

Note that in all cases Commited memory > 2.3GB on an empty system (not
running anyhing else then VS).

Willy.
May 2 '06 #8
I'm running 512megs.
Console exception:
Commit Charge
T 2542844
L 2566648
P 2561452

Everything works similar to what you reported except when I run straight F5.
The exception on screen is Package Load Failure GUID =
{8D8529D3-625D-4496-8354-3DAD630ECC1B} prompt follows to disable devenv
/resetskippkgs
Sometimes this is followed by the OOM error, other times its the VS studio
crapping out. I'm not running Team System.

Digging a little deeper, it seems this problem was around before and may
have been caused by earlier versions. See
http://forums.microsoft.com/MSDN/Sho...26741&SiteID=1.
However, this is a new laptop and the only version of studio is VS 2005.
I've run a tool built by MS to detect and fix that type of error, however
the tool found nothing wrong. I guess this is a nasty issue. why me why me
--

_______________ _________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Professional VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------

"Willy Denoyette [MVP]" <wi************ *@telenet.be> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..

"Alvin Bruney" <www.lulu.com/owc> wrote in message
news:eI******** ******@TK2MSFTN GP05.phx.gbl...
| This definitely seems to be a bug in studio. I could reproduce this
| everytime with the catch block commented out.
|

Well, I can't, running VS2005 Team System.

| > Guess you are exhausting your available Virtual Memory space (pageable
RAM
| > +
| > free page file space), before you reach the maximum Virtual Address
Space
| I don't think so. I did play with the page file a bit but the best I
could
| get on my dell laptop was 1843 with page file set to 2 meg.

Hmm... 2MB, must be your problem :-)
How much RAM do you have available? What else do you have running?

The code you posted both, Debug and release version:
Stop with console message:
Unhandled Exception: OutOfMemoryExce ption.

after 1949 threads created and a VM size 2.005.132K

1949 threads, that is 3 initial threads + 1946 auxiliary.

Run debug mode (CTRL F5) debug version:

stop at var.Start() with unhandle exception dialog (debugger)
Exception of type 'System.OutOfMe moryException' was thrown.

after 1889 threads created and VM 1.954.748K

Note that in all cases Commited memory > 2.3GB on an empty system (not
running anyhing else then VS).

Willy.

May 3 '06 #9
Package Unload Error Troubleshooter Guide (searchable title)

For those of you running into package unload problems Microsoft (Aaron
Stebner) recommends using this definitive package unload trouble-shooter
guide to resolve the issue.

http://blogs.msdn.com/astebner/archi...16/504906.aspx

--

_______________ _________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Professional VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------

"Alvin Bruney" <www.lulu.com/owc> wrote in message
news:ej******** ******@TK2MSFTN GP02.phx.gbl...
I'm running 512megs.
Console exception:
Commit Charge
T 2542844
L 2566648
P 2561452

Everything works similar to what you reported except when I run straight
F5. The exception on screen is Package Load Failure GUID =
{8D8529D3-625D-4496-8354-3DAD630ECC1B} prompt follows to disable devenv
/resetskippkgs
Sometimes this is followed by the OOM error, other times its the VS studio
crapping out. I'm not running Team System.

Digging a little deeper, it seems this problem was around before and may
have been caused by earlier versions. See
http://forums.microsoft.com/MSDN/Sho...26741&SiteID=1.
However, this is a new laptop and the only version of studio is VS 2005.
I've run a tool built by MS to detect and fix that type of error, however
the tool found nothing wrong. I guess this is a nasty issue. why me why
me
--

_______________ _________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Professional VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------

"Willy Denoyette [MVP]" <wi************ *@telenet.be> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..

"Alvin Bruney" <www.lulu.com/owc> wrote in message
news:eI******** ******@TK2MSFTN GP05.phx.gbl...
| This definitely seems to be a bug in studio. I could reproduce this
| everytime with the catch block commented out.
|

Well, I can't, running VS2005 Team System.

| > Guess you are exhausting your available Virtual Memory space
(pageable
RAM
| > +
| > free page file space), before you reach the maximum Virtual Address
Space
| I don't think so. I did play with the page file a bit but the best I
could
| get on my dell laptop was 1843 with page file set to 2 meg.

Hmm... 2MB, must be your problem :-)
How much RAM do you have available? What else do you have running?

The code you posted both, Debug and release version:
Stop with console message:
Unhandled Exception: OutOfMemoryExce ption.

after 1949 threads created and a VM size 2.005.132K

1949 threads, that is 3 initial threads + 1946 auxiliary.

Run debug mode (CTRL F5) debug version:

stop at var.Start() with unhandle exception dialog (debugger)
Exception of type 'System.OutOfMe moryException' was thrown.

after 1889 threads created and VM 1.954.748K

Note that in all cases Commited memory > 2.3GB on an empty system (not
running anyhing else then VS).

Willy.


May 7 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
3664
by: BlackHawke | last post by:
Hello! This is my second post. Ppl really helped me with the first. I hope there are answers for this one as well I own a game company (www.aepoxgames.net) releasing the beta for our first sci-fi space game in about 2 weeks (www.andromedaonline.net) We have multiple servers, but the game engine (Game Server Program) is a Java program (don't ask why) on a windows 2003 enterprise system with dual
0
2069
by: Marco Nicosia | last post by:
Hello gang, My coworker and I are writing a Python class for the other developers within our team. This class is supposed to encapsulate several things, including daemonizing, setting up logging, and spawning a thread to host an XML-RPC server. I'm having a real problem with logging.Logger and threading.Thread. In the main thread, we set up two loggers, each with file handlers. We then spawn the xml-rpc server thread, and allow the...
0
2300
by: Santa | last post by:
I am using Fritz Onion's "Asynchronous Pages" approach as mentioned in the article http://msdn.microsoft.com/msdnmag/issues/03/06/Threading/default.aspx to increase the performance of my ASPX page.I am using the Custom thread pool as given in the article's sample. Implementation: =============== In AsyncPage.aspx I inhereted AsyncPage class instead of System.Web.UI.Page. SyncPage.aspx is like any other Web page which inherits
6
2328
by: Tony Proctor | last post by:
Hi everyone We're experiencing some serious anomalies with the scheduling of ASP threads. I'd be interested to hear if anyone knows what algorithm is used (e.g. simple round-robin, or something more sophisticated), and what situations might perturb it. Even a hint as to what would be considered normal scheduling might help. The root of our problem is that we observed a normally well-behaved web application suddenly limit itself to a...
13
2069
by: Paul | last post by:
Hi, How do I wait until a thread is finished his job then continue to the original thread? public void main(string args) { Thread t = new Thread(new ThreadStart(DoWork)); t.Start();
5
1260
by: tonyreynolds | last post by:
I have an asp.net application that needs to spawn a new thread but return the response back to the user before the thread finishes. My application works fine on my machine (XP pro) and on a win 2000 server, but I can't get a thread to start on a new win 2003 server. I've posted some sample code below. I've made sure that the user this runs under has permission to write the test file to the c: drive. This code works on all the servers...
1
1471
by: Razvan | last post by:
This problem occurs in ASP.Net application, only on Windows 2000. Everything works fine on Windows Server 2003. Here is the scenario: I configured the application to use impersonation and integrated security to connect to the database. These are the corresponding lines in web.config <identity impersonate="true" userName="our_domain\our_user" password="the_password" />
5
7261
by: roni schuetz | last post by:
Hi @ll, I'm working on a web project which has to use multiple channels to connect to receive several sources at once. The problem is, that I'm not aware of the maximum amount of Threads i can allocate to my channels. Can i open 10 threads, 100 threads even 1000? is there a general answer to it. my dev. environment runs on win. xp
4
2331
by: =?iso-8859-1?q?Eir=EDkur_Fannar_Torfason?= | last post by:
I'm wrestling with a problem that I'm hoping someone can help me with. I have a web application written in VS.2003 and running on version 1.1 of the .NET Framework on XP pro and Windows server 2003 that connects to a SQL server database and authenticates itself using windows authentication. The web application is configured to impersonate a local user account that has been granted access to the database. Here's the impersonation snip...
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.