hi friends, i am trying to think of real world situation where this Threading is a MUST. could someone please come up and educate me a real world situation that's only solved by Threading? thank. namaste
Web Server has to process requests from lots of clients simultaneously. Graphical User Interface re-drawing a large <something> without locking up the menus, mouse, buttond. I am playing an MP3 and yet still I can type. Speeding up sections of a program where you have a CPU-bound process and an I/O-bound process. If you do them at the same time, the overall speed is increased. Periodically check for new mail while you are also reading mail and composing a reply and downloading a virus. Drawing the fly buzzing around the Moose's noze while I am typing this at the same time. Etc.
I can't think of any example of a program that must use threads. Any program that you make with multiple threads could instead be made with one thread. However, there are many situations where it is more appropriate to use multiple threads.(Some good examples are given in Dave's post above.) It is like the decision to use loops or recursion. Any algorithm can be implemented using either, but there are some situations where one works out better than the other.
:roll: :roll: Real World situations :roll: :roll: My very first post to the javaranch was to this forum and I think its a good example. BTW, I am still waiting for an answer :( Maybe the gurus are hiding here