Fork not available?

I am running windows 2000 using the PragProgs install.

I have tried fork but get an unimplemented on this machine error. I
have tried this on multiple windows 2000 machines and get the same
error.

I have tried IO.popen("-") but just get an error stating that “-” is
not recognized.

I am trying to get a long running program to use 2 separate
processors. I have tried using Ruby’s threads but the code is very
database intensive and appears to block a lot so I do not see a speed
improvement. The code is separated enough that I should be able to
cut the overall time significantly if I can get the 2 parts to run on
separate processors.

I am missing something stupid? Any thoughts?

Thanks,

Walt

···

Walter Szewelanczyk
IS Director
M.W. Sewall & CO. email : walter@mwsewall.com
259 Front St. Phone : (207) 442-7994 x 128
Bath, ME 04530 Fax : (207) 443-6284


Ok so I sent this out a bit too early.

after looking in the archives some more I see that fork and popen("-
") do not work with Windows. I see ri does mention that IO.popen is
Not available on all platforms, but it does not mention this for
Kernel.fork.

I basically have some setup code, then would like two separate
threads (real threads or processes, unless someone can point me in a
way to get around the blocking issues), and then join and perform
some finishing code.

Currently the total process take about 20 hours. I want to get it so
that it can run in less than 12 basically overnight. Do I have to
split the parts up as separate programs and deal with the sharing of
data on my own?

any insight would be greatly appreciated.

Thanks,

Walt

···

I am running windows 2000 using the PragProgs install.

I have tried fork but get an unimplemented on this machine error. I
have tried this on multiple windows 2000 machines and get the same
error.

I have tried IO.popen(“-”) but just get an error stating that “-” is
not recognized.

I am trying to get a long running program to use 2 separate
processors. I have tried using Ruby’s threads but the code is very
database intensive and appears to block a lot so I do not see a speed
improvement. The code is separated enough that I should be able to
cut the overall time significantly if I can get the 2 parts to run on
separate processors.

I am missing something stupid? Any thoughts?

Thanks,

Walt


Walter Szewelanczyk
IS Director
M.W. Sewall & CO. email : walter@mwsewall.com
259 Front St. Phone : (207) 442-7994 x 128
Bath, ME 04530 Fax : (207) 443-6284



Walter Szewelanczyk
IS Director
M.W. Sewall & CO. email : walter@mwsewall.com
259 Front St. Phone : (207) 442-7994 x 128
Bath, ME 04530 Fax : (207) 443-6284


I believe that Windows doesn’t support fork().

-austin

···

On Sat, 20 Sep 2003 01:50:32 +0900, walter@mwsewall.com wrote:

I am running windows 2000 using the PragProgs install.

I have tried fork but get an unimplemented on this machine error. I have
tried this on multiple windows 2000 machines and get the same error.


austin ziegler * austin@halostatue.ca * Toronto, ON, Canada
software designer * pragmatic programmer * 2003.09.19
* 13.30.37

walter@mwsewall.com graced us by uttering:

I am running windows 2000 using the PragProgs install.

I have tried fork but get an unimplemented on this machine
error. I have tried this on multiple windows 2000 machines and
get the same error.

I am trying to get a long running program to use 2 separate
processors. I have tried using Ruby’s threads but the code is very
database intensive and appears to block a lot so I do not see a speed
improvement. The code is separated enough that I should be able to
cut the overall time significantly if I can get the 2 parts to run on
separate processors.

I am missing something stupid? Any thoughts?

I also had a hard time finding the reason for this, but it would
seem to be the main: MS Windows operating systems do not support
the fork() call.

I thought there might be a hack to emulate forking on Win32, like
Perl 5.6 (buggily) did, but all I could find was a paragraph in
the online docs saying, “fork is available on operating systems
which support it.”

I did manage to find this in the Ruby FAQs. It partially
addresses this.

http://www.rubygarden.org/iowa/faqtotum/abpj6eTY2skY/d/1.13.3.2.5

HTH,
Tim Hammerquist

···


It’s astonishing how much trouble one can
get oneself into, if one works at it.
– Destruction, The Sandman

You might want to look at taskmaster:
http://raa.ruby-lang.org/list.rhtml?name=taskmaster

With this, you could set things up so that you can run the tasks on one
computer or multiple computers.

-austin

···

On Sat, 20 Sep 2003 02:26:15 +0900, walter@mwsewall.com wrote:

Ok so I sent this out a bit too early.

after looking in the archives some more I see that fork and popen("- ")
do not work with Windows. I see ri does mention that IO.popen is Not
available on all platforms, but it does not mention this for Kernel.fork.

I basically have some setup code, then would like two separate threads
(real threads or processes, unless someone can point me in a way to get
around the blocking issues), and then join and perform some finishing
code.

Currently the total process take about 20 hours. I want to get it so
that it can run in less than 12 basically overnight. Do I have to split
the parts up as separate programs and deal with the sharing of data on my
own?

any insight would be greatly appreciated.


austin ziegler * austin@halostatue.ca * Toronto, ON, Canada
software designer * pragmatic programmer * 2003.09.19
* 14.02.35

Hi,

walter@mwsewall.com wrote in message

Ok so I sent this out a bit too early.

after looking in the archives some more I see that fork and popen("-
") do not work with Windows. I see ri does mention that IO.popen is
Not available on all platforms, but it does not mention this for
Kernel.fork.

I basically have some setup code, then would like two separate
threads (real threads or processes, unless someone can point me in a
way to get around the blocking issues), and then join and perform
some finishing code.

You may want to take a look at the Windows version of popen3 on RAA:

http://raa.ruby-lang.org/list.rhtml?name=win32_popen

It is still in its beta version, but I can tell you from my personal
experience
that the author of this package (Park Heesob) is very responsive and
will be willing to work with you through bugs and all.

(Park, I know I have spoken on your behalf …please excuse me if I have
overstated and encroached on your busy schedule)

– shanko

“Austin Ziegler” austin@halostatue.ca schrieb im Newsbeitrag
news:2003919133052.522296@PADD…

I am running windows 2000 using the PragProgs install.

I have tried fork but get an unimplemented on this machine error. I
have
tried this on multiple windows 2000 machines and get the same error.

I believe that Windows doesn’t support fork().

I know there’s a problem with popen() but AFAIK fork() does work on
Windows. The attached script produced expected output with ruby on
cygwin:

13:58:35 [ruby]: ruby -w forks.rb
1.8.0
Testing: /bin/ls
CHILD 2228
forks.rb:23: warning: Insecure world writable dir /cygdrive/c, mode 040777
blah.rb extract.rb.bak forks.rb.bak fw.rb.bak ip.rb.bak
client.rb fact.rb fw-http.rb garble.rb junctions.rb
client.rb.bak fact.rb.bak fw-http.rb.bak garble.rb.bak
junctions.rb.bak
extract.rb forks.rb fw.rb ip.rb keynames.txt
FINISH 2032 - 2228
Testing: /bin/sleep 1000
CHILD 2692
forks.rb:23: warning: Insecure world writable dir /cygdrive/c, mode 040777
TIMEOUT
13:58:46 [ruby]:

Regards

robert

forks.rb (452 Bytes)

···

On Sat, 20 Sep 2003 01:50:32 +0900, walter@mwsewall.com wrote:

I know there’s a problem with popen() but AFAIK fork() does work on

Windows. The attached script produced expected output with ruby on

cygwin:

···

On Mon, 22 Sep 2003, Robert Klemme wrote:

I’m taking a stab in the dark here, but might this be because Cygwin
supplies fork()?

Chad

Cygwin isn’t standard Windows. fork() is not available unless you use
cygwin, which requires that your programs be GPL-compatible. I don’t
consider cygwin an acceptable requirement.

-austin

···

On Mon, 22 Sep 2003 21:49:44 +0900, Robert Klemme wrote:

“Austin Ziegler” austin@halostatue.ca schrieb im Newsbeitrag

I believe that Windows doesn’t support fork().
I know there’s a problem with popen() but AFAIK fork() does work on
Windows. The attached script produced expected output with ruby on
cygwin:


austin ziegler * austin@halostatue.ca * Toronto, ON, Canada
software designer * pragmatic programmer * 2003.09.22
* 09.30.36

I know there’s a problem with popen() but AFAIK fork() does work on

Windows. The attached script produced expected output with ruby on

cygwin:

I’m taking a stab in the dark here, but might this be because Cygwin
supplies fork()?

Chad

It appears that cygwin does supply form, but it is not part of the
standard Windows install.

I just wanted to thank everyone for all of your input. At least I
know I have not missed something stupid.

Walt

···

Walter Szewelanczyk
IS Director
M.W. Sewall & CO. email : walter@mwsewall.com
259 Front St. Phone : (207) 442-7994 x 128
Bath, ME 04530 Fax : (207) 443-6284


Cygwin isn’t standard Windows. fork() is not available unless you
use
cygwin, which requires that your programs be GPL-compatible. I
don’t
consider cygwin an acceptable requirement.

I don’t want to start this holy war again, but are you saying that if
I write a ruby script that uses fork() and thus requires the cygwin
build to run, it has to be GPL? I’m honestly curious, as I don’t
understand the licensing stuff as well as I should.

thanks

Michael

···

Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

Austin Ziegler wrote:

···

On Mon, 22 Sep 2003 21:49:44 +0900, Robert Klemme wrote:

“Austin Ziegler” austin@halostatue.ca schrieb im Newsbeitrag

I believe that Windows doesn’t support fork().

I know there’s a problem with popen() but AFAIK fork() does work on
Windows. The attached script produced expected output with ruby on
cygwin:

Cygwin isn’t standard Windows. fork() is not available unless you use
cygwin, which requires that your programs be GPL-compatible. I don’t
consider cygwin an acceptable requirement.

-austin

austin ziegler * austin@halostatue.ca * Toronto, ON, Canada
software designer * pragmatic programmer * 2003.09.22
* 09.30.36

If cygwin can emulate fork() under windows then why can’t ruby?

walter@mwsewall.com schrieb im Newsbeitrag
news:3F6EC1BC.22827.27FE3C@localhost…

I know there’s a problem with popen() but AFAIK fork() does work on

Windows. The attached script produced expected output with ruby on

cygwin:

I’m taking a stab in the dark here, but might this be because Cygwin
supplies fork()?

Well, yes. Obviously Windows does support fork functionality without
having the exact same function in its stdlib.

popen is different since AFAIK you can’t multiplex pipes on Windows (2nd
hand info here, I think it was from Nobu Nakada) so the basic
functionality seems to be lacking.

It appears that cygwin does supply form, but it is not part of the
standard Windows install.

True.

I just wanted to thank everyone for all of your input. At least I
know I have not missed something stupid.

You didn’t. And you’re welcome.

Regards

robert

That’s an interesting question, and I fear that the answer is maybe.
Anything that links against the cygwin DLL must be GPL-compatible, as it is
GPLed (not LGPLed). Ruby itself is dual-licensed with the GPL, so Ruby
doesn’t have this problem – and nominally, programs that are run against
Ruby aren’t affected by the licence of Ruby itself. However, your program is
depending on functionality exposed by cygwin (e.g., fork()) and thus
requires that particular binding), so … does it have to be GPLed? I
honestly don’t know.

I suspect not, in this case. However, while I have cygwin for my own
reasons, I wouldn’t dare think about requiring anyone to install cygwin just
to run a program of mine. You also have to use the cygwin build of Ruby –
you can’t use the Windows Installer version.

-austin

···

On Mon, 22 Sep 2003 23:13:57 +0900, Michael Campbell wrote:

Cygwin isn’t standard Windows. fork() is not available unless you use
cygwin, which requires that your programs be GPL-compatible. I don’t
consider cygwin an acceptable requirement.
I don’t want to start this holy war again, but are you saying that if I
write a ruby script that uses fork() and thus requires the cygwin build
to run, it has to be GPL? I’m honestly curious, as I don’t understand
the licensing stuff as well as I should.


austin ziegler * austin@halostatue.ca * Toronto, ON, Canada
software designer * pragmatic programmer * 2003.09.22
* 12.38.46