473,397 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

General thread question

Newbie question: Hopefully I worded this correctly...

Does each instance of an aspx page spawn its own thread? If so are the
threads protected? I assume each aspx page is processed in a synchronized
method and each instance has to finish processing before the next instance
is queued? If an aspx page has a class that requires lengthly processing are
all other instances of the page queued. If more than one aspx page uses the
modFoo class (simple sample before) would I be headed for trouble?

public class modFoo
{
public static Int32 lClient = 0;

public modFoo()
{
}
}
May 23 '06 #1
5 1122
> Does each instance of an aspx page spawn its own thread?
ASP.NET dispatches pool threads as the load of requests increase.
(Process ASPNET_WP.EXE).
Generally there's a maximum pool size so a page doesn't always spawn a
new thread.
A page is processed by a worker thread that may already have been
launched before (that is called thread pooling).

I assume each aspx page is processed in a synchronized
method A page is totally processed by only one thread.
So the question is no use.

If an aspx page has a class that requires lengthly processing are
all other instances of the page queued With IIS sure and fortunately ! Again that is thread pooling that
enables parallelizing page processing.
With personal WebServer not sure.
If more than one aspx page uses the
modFoo class (simple sample before) would I be headed for trouble?

public class modFoo
{
public static Int32 lClient = 0;

public modFoo()
{
}
}


If each page instantiate a modFoo object, there'll be multiple threads
that will share IClient member so'll have to synchronize access to it.
If you want each thread have it's own copy of IClient, you should write
:

[ThreadStaticAttribute]
public static Int32 lClient = 0;
But it might not be what you want.

May 23 '06 #2
Exactly what I wanted..Thanks

"olrt" <ol**@ifrance.com> wrote in message
news:11**********************@y43g2000cwc.googlegr oups.com...
Does each instance of an aspx page spawn its own thread?

ASP.NET dispatches pool threads as the load of requests increase.
(Process ASPNET_WP.EXE).
Generally there's a maximum pool size so a page doesn't always spawn a
new thread.
A page is processed by a worker thread that may already have been
launched before (that is called thread pooling).

I assume each aspx page is processed in a synchronized
method

A page is totally processed by only one thread.
So the question is no use.

If an aspx page has a class that requires lengthly processing are
all other instances of the page queued

With IIS sure and fortunately ! Again that is thread pooling that
enables parallelizing page processing.
With personal WebServer not sure.
If more than one aspx page uses the
modFoo class (simple sample before) would I be headed for trouble?

public class modFoo
{
public static Int32 lClient = 0;

public modFoo()
{
}
}


If each page instantiate a modFoo object, there'll be multiple threads
that will share IClient member so'll have to synchronize access to it.
If you want each thread have it's own copy of IClient, you should write
:

[ThreadStaticAttribute]
public static Int32 lClient = 0;
But it might not be what you want.

May 24 '06 #3
Why do you say "But it might not be what you want"? Do you have another
thought?

I also assume this would accomblish the same thing and have the same problem
(without [ThreadStatisAttribute]):
public class modFoo
{
private Int32 lClient = 0;

public modFoo()
{
}

public Int32 Client
{
get { return lClient; }
put { lClient = value; }
}
}


"olrt" <ol**@ifrance.com> wrote in message
news:11**********************@y43g2000cwc.googlegr oups.com...
Does each instance of an aspx page spawn its own thread?

ASP.NET dispatches pool threads as the load of requests increase.
(Process ASPNET_WP.EXE).
Generally there's a maximum pool size so a page doesn't always spawn a
new thread.
A page is processed by a worker thread that may already have been
launched before (that is called thread pooling).

I assume each aspx page is processed in a synchronized
method

A page is totally processed by only one thread.
So the question is no use.

If an aspx page has a class that requires lengthly processing are
all other instances of the page queued

With IIS sure and fortunately ! Again that is thread pooling that
enables parallelizing page processing.
With personal WebServer not sure.
If more than one aspx page uses the
modFoo class (simple sample before) would I be headed for trouble?

public class modFoo
{
public static Int32 lClient = 0;

public modFoo()
{
}
}


If each page instantiate a modFoo object, there'll be multiple threads
that will share IClient member so'll have to synchronize access to it.
If you want each thread have it's own copy of IClient, you should write
:

[ThreadStaticAttribute]
public static Int32 lClient = 0;
But it might not be what you want.

May 24 '06 #4
If you code :
public class modFoo
{
private Int32 lClient = 0;

public modFoo()
{
}

public Int32 Client
{
get { return lClient; }
put { lClient = value; }
}
}

Each page served has it's own IClient ...
If you code :
public class modFoo
{
[ThreadStaticAttribute]
public static Int32 lClient = 0;

public modFoo()
{
}
}

each thread has its own IClient...

That's different...

Suppose there are two worker threads (Th1 and Th2) that serve the page.
Suppose
Th1 serves client1, client2, client3
Th2 serves client4

With [ThreadStaticAttribute] and static modifier :
Th1 and Th2 have their own IClient.

Without :
client1, client2, client3, client4 have their own IClient.

May 24 '06 #5
Thanks...very much for explanation

"olrt" <ol**@ifrance.com> wrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
If you code :
public class modFoo
{
private Int32 lClient = 0;

public modFoo()
{
}

public Int32 Client
{
get { return lClient; }
put { lClient = value; }
}
}

Each page served has it's own IClient ...
If you code :
public class modFoo
{
[ThreadStaticAttribute]
public static Int32 lClient = 0;

public modFoo()
{
}
}

each thread has its own IClient...

That's different...

Suppose there are two worker threads (Th1 and Th2) that serve the page.
Suppose
Th1 serves client1, client2, client3
Th2 serves client4

With [ThreadStaticAttribute] and static modifier :
Th1 and Th2 have their own IClient.

Without :
client1, client2, client3, client4 have their own IClient.

May 24 '06 #6

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

Similar topics

3
by: Brad Wood | last post by:
As I'm studying up on threading, I'm reading about the various mechanisms in place to serialize access to various objects. From what I can tell, the following scenario is safe: - Create...
2
by: Beeeeeves | last post by:
Hi I am looking for any articles anyone may know of on developing a finite state machine in a gui application? Basically what I have is a fairly complex gui which needs to go through several (3 -...
2
by: ZorpiedoMan | last post by:
I'm new to the world of sockets, and this question is not VB specific: If multiple clients access the same server on the same port, and the server is set up to do some async communication, does...
0
by: Yong | last post by:
I'm not getting any reply to my previous thread so I'm stating a new one. I get a General Network Error due to my SqlCommand object not having a big enough CommandTimeout to complete very long...
0
by: bazzer | last post by:
hey, i am using visual basic.net 2003 and have an ASP.NET webform application thats accessing a microsoft access 2003 database. i kept getting the following error when i tried to run it: ERROR ...
0
by: bazzer | last post by:
hey, im trying to access a microsoft access database from an ASP.NET web application in visual basic 2003.NET. i get the following error when i try running it: Server Error in...
11
by: dhan | last post by:
please give answer
4
by: Viviana Vc | last post by:
Hi all, I've read the WindowsVistaUACDevReqs.doc documentation and I have done different small tests on Vista to understand the bahaviour and now I have a few questions. 1) If I create a...
40
by: RvGrah | last post by:
I've been writing in C# for about 4 years now, coming from VB.net and VB6 before that, in which I know I'm not alone. I found learning C#, at least to the extent that I use it in developing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.