Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^4: Windows System Command

by Anonymous Monk
on Jun 27, 2012 at 19:27 UTC ( [id://978751]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Windows System Command
in thread Windows System Command

However, all that is by the by on windows systems because Windows passes the entire command line to the process as a single string.

You know, as a *nix person, I found the function signature for CreateProcess shocking. "How is that better than fork()? It's not going to be easy to make it do anything similar!"

(I was trying to write an IPC test program and had the bright idea of putting the two halves in the same .exe. Which would not be any problem whatsoever on *nix.)

Ah well, WINAPI is strange and alien to me.

Replies are listed 'Best First'.
Re^5: Windows System Command
by BrowserUk (Patriarch) on Jun 27, 2012 at 20:12 UTC
    "How is that better than fork()?

    It's not better than fork(), just different. It's closer to exec(3).

    For some uses, those typified by the fork&exec pattern, CreateProcess() can be said to be better. Why bother duplicating (even minimal) information and data from the current process if the next thing you are going to do is throw almost all of it away to do the exec.

    For other uses, fork comes into its own. Like airplanes and helicopters, they both achieve similar goals; they just approach them from different angles.

    I've often wished that WinAPI had a proper built-in fork. It wouldn't be hard to add it internally to the OS. I think the reason it doesn;t exist is more political than practical.

    Hell, it's almost(*) possible using the published API's, including COW and the other subtleties, there is just a soupçon of missing functionality that prevents it being done efficiently as a third-party library.

    (*)I'm aware that both cygwin (and that MS toolkit I've forgotten the name of) provide such an api, but only in the context of a POSIX(1) emulation layer and they are not (even vaguely) efficient.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2024-04-16 15:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found