multithreading - Threads or asynch? -


how make application multithreaded ? use asynch functions ? or spawn new thread ? think asynch functions spawning thread if job doing file reading, being lazy , spawning job on thread "waste" ressources... there kind of design when using thread or asynch functions ?

spawning threads going waste resources if start spawning tons of them, 1 or 2 threads isn't going effect platforms proformance, infact system has on 70 threads me, , msn using 32 (i have no idea how messenger can use many threads, exspecialy when minimised , not doing anything...)

useualy time spawn thread when take long time, need keep doing else.

eg calculation take 30 seconds. best thing spawn new thread calculation, can continue update screen, , handle user input because users hate if app freezes untill finished doing calculation.

on other hand, creating threads can done instantly pointless, since overhead of creating (or passing work existing thread using thread pool) higher doing job in first place.

sometimes can break app couple of seprate parts run in own threads. example in games updates/physics etc may 1 thread, while grahpics another, sound/music third, , networking another. problem here have think how these parts interact or else may have worse proformance, bugs happen seemingly "randomly", or may deadlock.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -