Sturla Molden | 1 Jan 04:03
Picon

Re: [Cython] Cython 0.12 not working on Windows XP


[This is perhaps OT on the Cython list. Please forgive me the noise.]

Stefan,

CreateProcess in Win32 API and fork in Interix (SUA/SFU) both call the
kernel function ZwCreateProcess in ntdll.dll. If NULL is passed as section
handle to ZwCreateProcess, it will clone the current process. The
copy-on-write optimization actually happen in hardware. Most modern
processors have a paging memory-management unit that can tag pages as
shared and copy-on-write. The reason that early versions of Unix or Linux
did not copy-on-write optimize fork but modern do, is that CPUs have
evolved. You can read about Windows kernel programming in Nebbet's book on
NT kernel internals. It even has example code for a boiler-plate
implementation of fork.

Cygwin's problem is that hooking up a process created by ZwCreateProcess
to the Win32 or SUA subsystem is undocumented; neither MS documentation or
Nebbet cover that. That is why Cygwin does not implement a copy-on-write
fork yet, although most modern hardware supports it.

I recommend using Interix (SFU/SUA) instead of Cygwin. You will need 
Windows XP professional or enterprice, or Windows Vista / Windows 7
Ultimate. The codebase of Interix is mostly derived from OpenBSD. This
means it is very safe. The old POSIX subsystem form Windows NT4 is
deprecated in favour of Interix. You'll find more information at
www.interix.com. Prebuilt binaries for common Unix tools can be downloaded
from the Warehouse in SUA community.

Note that SUA is UNIX, not Windows, it just happens to share kernel. This
(Continue reading)

Picon
Picon

[Cython] [OT] Windows and Unix

Sturla Molden wrote:
> [This is perhaps OT on the Cython list. Please forgive me the noise.]

Well, I for one think it is interesting, so continuing OT...

> 
> Stefan,
> 
> CreateProcess in Win32 API and fork in Interix (SUA/SFU) both call the
> kernel function ZwCreateProcess in ntdll.dll. If NULL is passed as section
> handle to ZwCreateProcess, it will clone the current process. The
> copy-on-write optimization actually happen in hardware. Most modern
> processors have a paging memory-management unit that can tag pages as
> shared and copy-on-write. The reason that early versions of Unix or Linux
> did not copy-on-write optimize fork but modern do, is that CPUs have
> evolved. You can read about Windows kernel programming in Nebbet's book on
> NT kernel internals. It even has example code for a boiler-plate
> implementation of fork.
> 
> Cygwin's problem is that hooking up a process created by ZwCreateProcess
> to the Win32 or SUA subsystem is undocumented; neither MS documentation or
> Nebbet cover that. That is why Cygwin does not implement a copy-on-write
> fork yet, although most modern hardware supports it.
> 
> I recommend using Interix (SFU/SUA) instead of Cygwin. You will need 
> Windows XP professional or enterprice, or Windows Vista / Windows 7
> Ultimate. The codebase of Interix is mostly derived from OpenBSD. This
> means it is very safe. The old POSIX subsystem form Windows NT4 is
> deprecated in favour of Interix. You'll find more information at
> www.interix.com. Prebuilt binaries for common Unix tools can be downloaded
(Continue reading)

Sturla Molden | 3 Jan 07:23
Picon

Re: [Cython] [OT] Windows and Unix

Dag Sverre Seljebotn wrote:

> In my experience, Cygwin is often used as an
> easy way out for porting open source software to Windows, and SFU/SUA
> seem to exclude at least most of the home users and quite a few laptop
> users.

First, note that Cygwin is GPL unless you buy a commercial license (for a
fee undisclosed by Red Hat).

The Cygwin fork call is not copy-on-write optimized, which makes Cygwin
unsuited for fork-based internet servers. Also, programs that require
inter-process read-only access to huge memory buffers can avoid using
shared memory by forking. This trick will not work on Cygwin.

And then there is the security issue. How safe is Cygwin against various
exploits? As far as I can tell, there is no auto-update of system
components.

> Can one compile gcc for SFU/SUA? Does that have less or more problems
> than gcc for Cygwin?

gcc is the system C compiler on Interix. Microsoft is for some reason not
using their own C compiler, but rather relying on gcc. Perhaps Visual C++
did not pass UNIX certification; or perhaps this is a decision to make
porting from Linux easier. I don't know. But in any case, gcc is
preinstalled, you can build your own, or download one here:

http://www.suacommunity.com/tool_warehouse.htm

(Continue reading)

Robert Bradshaw | 7 Jan 10:26
Favicon

Re: [Cython] [OT] Windows and Unix

On Jan 2, 2010, at 10:23 PM, Sturla Molden wrote:

> Dag Sverre Seljebotn wrote:
>
>> In my experience, Cygwin is often used as an
>> easy way out for porting open source software to Windows, and SFU/SUA
>> seem to exclude at least most of the home users and quite a few  
>> laptop
>> users.
>
> First, note that Cygwin is GPL unless you buy a commercial license  
> (for a
> fee undisclosed by Red Hat).
>
> The Cygwin fork call is not copy-on-write optimized, which makes  
> Cygwin
> unsuited for fork-based internet servers. Also, programs that require
> inter-process read-only access to huge memory buffers can avoid using
> shared memory by forking. This trick will not work on Cygwin.
>
> And then there is the security issue. How safe is Cygwin against  
> various
> exploits? As far as I can tell, there is no auto-update of system
> components.
>
>> Can one compile gcc for SFU/SUA? Does that have less or more problems
>> than gcc for Cygwin?
>
> gcc is the system C compiler on Interix. Microsoft is for some  
> reason not
(Continue reading)

Picon
Picon

Re: [Cython] [OT] Windows and Unix

On Thu, 2010-01-07 at 01:26 -0800, Robert Bradshaw wrote:
> On Jan 2, 2010, at 10:23 PM, Sturla Molden wrote:
> 
> > Dag Sverre Seljebotn wrote:
> >
> >> In my experience, Cygwin is often used as an
> >> easy way out for porting open source software to Windows, and SFU/SUA
> >> seem to exclude at least most of the home users and quite a few  
> >> laptop
> >> users.
> >
> > First, note that Cygwin is GPL unless you buy a commercial license  
> > (for a
> > fee undisclosed by Red Hat).
> >
> > The Cygwin fork call is not copy-on-write optimized, which makes  
> > Cygwin
> > unsuited for fork-based internet servers. Also, programs that require
> > inter-process read-only access to huge memory buffers can avoid using
> > shared memory by forking. This trick will not work on Cygwin.
> >
> > And then there is the security issue. How safe is Cygwin against  
> > various
> > exploits? As far as I can tell, there is no auto-update of system
> > components.
> >
> >> Can one compile gcc for SFU/SUA? Does that have less or more problems
> >> than gcc for Cygwin?
> >
> > gcc is the system C compiler on Interix. Microsoft is for some  
(Continue reading)

Sturla Molden | 7 Jan 12:25
Picon

Re: [Cython] [OT] Windows and Unix

> On Jan 2, 2010, at 10:23 PM, Sturla Molden wrote:

> And I prefer running a modern Linux or Unix natively on my system :).

Fair enough, but it is always a PITA to make things compile. :-(

On Windows we can rely on nice guys like David Cournapeau to make binary
installers for us :-)

> Of course, from the developers point of view, no matter how nice we
> set up our own environment of choice, the issue remains that we don't
> want to require users to have to upgrade Windows Ultimate to compile/
> run our code.

I guess that depends on the user. If we are programming for the masses:
no. If we are programming for a particular client, we can often require
whatever system setup we want.


Gmane