Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Beginners threading in C# [closed]

Can you recommend a good series of articles or preferably a book on how to get started with threading in general and in C# in particular? I am primarily looking for the use of threads in console applications and in ASP.Net apps.

I understand only the very basics of threads and know that "here be dragons", so want to get a good grounding in it before I start using them.

Things I am curious about are things like the concept of having a threadpool, how you manage the size of it, how you choose for things to be queued until a thread is available vs forcing a new thread to start etc. Also, I understand that IIS has lots of built-in thread handling, so anything that explains how to work with threads in ASP.Net under IIS and how it differs from threading in a console C# applicaion is interesting.

My intended usage includes things like;

  • The user does something on the ASP.Net page that causes my server-side code to need to connect to another system and carry out lengthy operations, so I want to return control to the user quickly by firing that action to another thread. The user can keep watching progress through AJAX or simply move away - the web is stateless after all :)

  • Use of Fire and Forget patterns (lots of sample code out there, I want to understand more about how they work)

Thanks

like image 271
flytzen Avatar asked Feb 10 '09 16:02

flytzen


1 Answers

As well as my own articles linked by Andrew, Joe Albahari has another tutorial.

If you want a really thorough examination, read Joe Duffy's Concurrent Programming in Windows.

like image 75
Jon Skeet Avatar answered Oct 07 '22 00:10

Jon Skeet