Sam Clemens wrote:
debayan wrote:
Well Sam, doing scans sequentially is a problem because if there is a timeout, i must kill the process, so the subsequent scans get killed. Forking off separate processes is a good idea, but i have used lan scanners that use threads. I guess forking off new processes would be fine because i am just pinging the broadcast address and the routing software does the rest of the work. Also i am kinda interested to work on threads. A while back i tried to make a ip address based lan scanner, and i never got to finish it. Read up on threads later. Wanted to implement it. I am aware that it is generates bugs. But just wanted to try.
Threading is something you use when the operating system has extremely inefficient context switches (i.e. windows). There's very little need for threading in the Unix/Linux world.
However, if you want to share some information between the various processes, then grab some shared memory, and use that, or use some sockets, or even named pipes out in /tmp.
Basically, threading is a hack designed to overcome the grevious design flaws of the windows scheduler and context switcher. And, as I said before, debugging threaded code can be extremely difficult due to race conditions.
Just because a programming technique exists doesn't mean that it should be used for your particular problem, in the same way that you don't see anyone driving garbage trucks in a grand prix race.
What on earth are you talking about? Threading is very useful, and extremely ubiquitous, even more so in these days of multicore CPUs But even on a single core, I find it very nice to know that my programs don't have to stop and wait for I/O to finish processing before moving on to the next task. Higher utilization is a good thing Anders -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org