So yeah,title says it all.
I want to know what kind of program has it to be in order multithreading could be used,or in which cases it is necessary.
For example I can make calc but there is no need of threads...
thnx
So yeah,title says it all.
I want to know what kind of program has it to be in order multithreading could be used,or in which cases it is necessary.
For example I can make calc but there is no need of threads...
thnx
Why not?For example I can make calc but there is no need of threads...
Now the message is not too short.
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
Like what?
I mean the program is quite small to adjust threads..wouldn't it slow it?
I ask about bigger projects.
It depends what you calculate. If your calc does some fourier transform or some iterative problem solving threads could be useful.
Since you said the Calc as an example would not need threads, it points to it that you have an idea when threads are not needed (which means, that if you use the opposite to these reasons you would know when thread are needed).Like what?
I mean the program is quite small to adjust threads..wouldn't it slow it?
But I wanted to see why you think threads are not needed for Calc.
When one should use threads has nothing to do with the size of the project, but with what and how the application needs to do.
There is no cook-book recipe answer to this.
One example that comes very often is:
If you have a very long operation that needs to be done, and you have a gui too, it makes sense to but the long operation in a separate thread, so that the GUI stays responsive.
Or, when you need asynchronous behavior.
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
There are basically two cases where multi-threading is usefull and effective:
1) You need to accomplish some long-running activity without impacting the responsiveness of the rest of the application.
2) You have several conceptually linear activities that you want to occur simultaneously, possibly with interaction between them at selected places.
There are ways (eg, the ever-popular "event loop") to do the above without multi-threading, but multi-threading can (in skilled hands) be a more elegant, efficient, and reliable way to do it. In poorly skilled hands multi-threading can be an utter disaster, though.
Bookmarks