0

What is better approach threading or asynchronous programming.

I have read both especially in database operations we can use both of this approaches.

Is my understanding is correct?

please give some guidelines?wat all scenarios we ca use threading and waht all scenarios asynchronous programming is good?

Thanks SC

1
  • 3
    +close: No semblance of a question here. Commented Jun 10, 2009 at 1:58

2 Answers 2

2

Threading and asynchronous programming are essentially the same thing. Threading is the engine which makes asynchronous programming possible.

Use it in situations where you need to start a background task, so that the user can move on to other things instead of having to wait for your task to complete.

Joseph Albahari's tutorial on threading in C# is a good place to start learning.

Sign up to request clarification or add additional context in comments.

Comments

0

If you need substantial scalability with small hardware resources, the async model excels, but at the expense of complexity. If you don't need to scale, then focusing on blocking I/O with threads might meet your needs. The notion of scalability varies widely. This can quickly become a rather deep subject that needs research based on what you want to achieve. Some basics on async IO can be found here. Do you need to service thousands of network requests simultaneously with a single server? If so, async I/O might be what you need. You mention database operations...in general, most DB implementations will not give you an async option. Given your vague question, I don't think there a specific answer. As with just about everything...it depends.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.