1

Can two requests to IIS run on the same thread at the same time (i.e., interleaving instructions)? If so, how could this affect a lock that tries to limit access to a shared resource?

ConditionRacer
  • 4,418
  • 6
  • 45
  • 67

1 Answers1

0

If I'm understanding your question correctly, they would run, but both wouldn't be able to lock the same resource at the same time:

Similar question here: What happens when two threads ATTEMPT to lock the same resource at the exact same time?

In this situation, you'd really want to make use of the async keyword and have one await the other.

Community
  • 1
  • 1
  • I'm more interested in if IIS allows this situation to occur, in which case I'd assume a lock would be granted for both requests. – ConditionRacer Apr 18 '16 at 19:27
  • In that case, here's a decent explanation of how threads in IIS work: http://stackoverflow.com/questions/4910159/how-are-iis7-threads-assigned – Gorton Fishman Apr 18 '16 at 20:15