Mailinglist Archive: opensuse (2459 mails)

< Previous Next >
Re: [opensuse] GSOC 2008
  • From: debayan <debayanin@xxxxxxxxx>
  • Date: Fri, 21 Mar 2008 02:04:41 +0530
  • Message-id: <1206045281.6860.14.camel@xxxxxxxxxxxxxx>
No but even if you fork off separate processes, you get non-blocking IO
programs using pipes.... why use threads just for that then??
On Thu, 2008-03-20 at 21:30 +0100, Anders Johansson wrote:
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
--
Debayan Banerjee
NIT Durgapur, West Bengal, India
debayanin@xxxxxxxxx
http://debayan.wordpress.com


--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >