Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: A Perl vs. Java fight brews

by emazep (Priest)
on Jul 25, 2006 at 07:27 UTC ( #563444=note: print w/ replies, xml ) Need Help??


in reply to Re^2: A Perl vs. Java fight brews
in thread A Perl vs. Java fight brews

If you really need processes, this could be a big selling point in favour of Perl.

Java fork emulation is a real pain in the ass: you basically have no easy way to fork the current process, so you have to call Runtime.exec() and pass it the Java class to execute. This fires up a new JVM, which takes a lot of CPU and memory. Then, you'll also have major problems in communicating between the various JVMs, since Java does not (natively) offer anything like pipe or the inter-process communication tools offered by the various IPC::* modules, so you basically have to resort to JNI, or you have to use sockets, RMI, or even CORBA (one can also resort to EJB, that's true, but this could be an overkill and an unmistakable source of major headaches).

As for threads, though it's true that Java prefers threads over real processes (and their implementation in Java is robust), it is important to stress that threads are not real processes.
For instance, real processes will seamlessly migrate over an SSI cluster of machines (as long as they don't use shared memory), while threads will not.
Also, an application based on real processes rather than on threads is much more robust, since each process runs in a separate address space while threads all live in the same address space, so that a single thread crash can bring down the whole application.
And forking a new process is only marginally slower than creating a new thread, on systems that use Copy-On-Write (basically any modern *nix).

Ciao, Emanuele.


Comment on Re^3: A Perl vs. Java fight brews

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://563444]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (11)
As of 2014-08-22 12:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (156 votes), past polls