multithreading - Asynchronous operation and thread in C# -


asynchronous programming technique calls long running method in background ui thread remains responsive. should used while calling web service or database query or i/o bound operation. when asynchronous method completes, returns result main thread. in way, program's main thread not have wait result of i/o bound operation , continues execute further without blocking/freezing ui. ok.

as far know asynchronous method executes on background worker thread. runtime makes availabe thread either threadpool or may create brand new thread execution.

but have read in many posts asynchronous operation may execute on separate thread or without using thread. confused.

1) please clarifying in situation asynchronous operation not use thread?

2) role of processor core in asynchronous operation?

3) how different multithreading? know 1 thing multithreading usefult compute-bound operation.

please help.

io (let's database-operation on network) example three:

  1. you register callback os call (maybe on newly created thread) when io-operation finished. there no thread sitting around , waiting - resurrection triggered hardware-events (or @ least os process outside user-space)

  2. it might have none (see 1)

  3. in multithreading use more 1 thread (your background-thread) , there 1 might idle sit there doing nothing (but using system-resources) - of course different if have compute (so thread not idle waiting external results) - there makes sense use background-worker-thread


Comments