views:

73

answers:

3

In an asp.net web application, say everytime the user makes the request, and the page loads, a thread is fired off that uses thread.join() to block execution until it's finished.

Say this thread takes 10 seconds to complete.

Does this mean that if 5 totally seperate users make a request to this page, mere miliseconds after the last, does this mean the last user is going to wait 50 seconds to finish their request? Or is each client request threaded?

+3  A: 

Typically, other users will not be blocked.

However, the call to Join ties up a thread pool thread. Once all threads are in use, subsequent requests must wait for a thread to become available.

binarycoder
+2  A: 

Join itself just blocks the current thread until the thread you want to join finishes executing, so normally calling it only blocks the current request, not other users.

If for some ungodly reason you're calling join within a lock on a shared resource, that would block other users trying to access the shared resource.

Jeff Sternal
A: 

It sounds like you are describing a scenario where every user request creates a new Thread which executes a task during Page Load. Page Load does a few operations and then calls thatThread.Join. If so then ...

How much time it will take 5 users simultaneously accessing the page depends a lot on what thatThread is doing. In particular if the separately spawned threads interact with each other. For example if they took a lock on a shared resource for a portion of the execution then yes, simultaneous requests will impact performance. If the lock is held for the duration of the operation then yes it could have a linear impact on performance.

On the other hand if they do completely independent tasks then they won't have a linear impact on performance.

If you could provide more details on what the thread was doing we could better answer the question.

JaredPar