Ok please answer this, say i ping the broadcast address 10.0.255.255 (on my lan) on the terminal, how does the OS execute the ping? Does it fork off new processes or does it use threads? I am sure it is not sequential because it is pretty fast. Now if it is not sequential, i dont really need to use threads in my program. I just have to execute a broadcast ping. The switch takes care of the rest i think. On Thu, 2008-03-20 at 21:42 +0100, Anders Johansson wrote:
debayan wrote:
No but even if you fork off separate processes, you get non-blocking IO programs using pipes.... why use threads just for that then??
Wait, I just read what you actually wrote and not what I thought you wrote
Forking off multiple processes to do the scanning would be hideously ineffective compared to using threads. Unlike what "Sam" told you, threads are far more efficient than multiple processes on linux (on any operating system). There is a reason why threads are sometimes referred to as "light weight processes".
Also, what does "non-blocking IO using pipes" have to do with anything? I'm not even sure what it means. Are you talking about the select() call not blocking? It wasn't IPC I was talking about when I said that things blocked. Multithreaded programming is just a basic tool all programmers use to make the most of the hardware we have.
Some programs don't need it, but very many do. Almost all you see on your desktop uses multithreaded programming. Linux would suck on SMP if it didn't
Anders -- Debayan Banerjee NIT Durgapur, West Bengal, India debayanin@gmail.com http://debayan.wordpress.com
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org