development version newLISP v.8.5.9

Started by Lutz, May 22, 2005, 06:32:46 AM

Previous topic - Next topic

rickyboy

#15
Thanks Peter!  Thanks Lutz!



I will try to find some time tomorrow to start on the port.



--Rick
(λx. x x) (λx. x x)

HPW

#16
Quotethe next flavor to drop will be Borland BCC, I only keep it because of the nice turbo debugger helping me out.


You forgot that the BCC-DLL is the only one which runs under .NET as unmanaged code! Should we loose this ability? Could you think of other options for .NET?
Hans-Peter

Lutz

#17
Oh yes, I forgot, then it stays, BTW timer doesn't work in with BCC.



Lutz

pjot

#18
Quote
Unfortunately I dont's see a UNIX style fork (which creates an exact copy of the parent process) any time soon. The only version I ever saw is the one in cygwin, but I didn't find it to be reliable enough. Its just something Windows isn't build for. The Win32 thread facility turned out nice for the timer, but else doesn't have much use in newLISP.


1) Indeed the Win32 platform just does not have something like 'fork', it's not part of the OS. Still I wonder: is it not possible to simulate a 'fork' using threads, similar to the 'timer' function?



2) The Cygwin implementation is also a simulation, but is it really that bad? At least there is the possibility to use the 'fork' command in Windows. Besides Cygwin, also Perl uses a 'fork' emulation in a Win32 environment:



http://www.xav.com/perl/lib/Pod/perlfork.html">http://www.xav.com/perl/lib/Pod/perlfork.html



Though it has certain limitations, it will make newLisp more complete.



Peter

Lutz

#19
UNIX fork gives you a copy of all the whole parent process, which is what I need. For that reason simple threads won't work.



Lutz

pjot

#20
So what do you think about an implementation similar to Perl?

Lutz

#21
I believe Perl and newLISP are doing the same thing, using a UNIX fork().



Lutz

pjot

#22
Yes, in Unix probably. But how about the Windows emulation for a 'fork'...? Could you use the Windows emulation of 'fork' for Perl also for newLisp? It will make newLisp more complete...  :-)

Lutz

#23
They seem to do a similar thing CYGWIN is doing, Perl has a 'perl-clone' function copying all memory from the parent process when simulating fork() on Win32.



Lutz

pjot

#24
Well, so that is good news! :-)



...but serious, I am a little bit confused here... because a few messages back, you say:


Quote
UNIX fork gives you a copy of all the whole parent process, which is what I need.


And here you say:


Quote
Perl has a 'perl-clone' function copying all memory from the parent process when simulating fork() on Win32.


So isn't this exactly what you want for Windows then? Or do I misunderstand you somewhere?



Sorry to be so nagging, but it seems that a Cygwin-like 'fork' seems to work for many other Unix tools ported to Windows, including Perl. So why not use it for newLisp as well?



Peter

Lutz

#25
Yes the 'perl-clone' or the cygwin fork() are both Win32 implementations of the UNIX fork() by using Win32 threads and code to replicate/clone the parents memory.



I went to the source code of both Perl and Cygwin, its not a small task to understand it and rip it out, usable for newLISP. Anybody who wants to help out here is welcome to work on this, it requires both, good Win32 internals knowledge and UNIX knowledge and it has to be done in a way that thread-process communications by means of shared memory and syncronized by semaphores still work well, open file handles have to be duped etc.



Everything has to be small enough not to change newLISP's small footprint on disk and in memory, which is one of the reasons people like using newLISP.



Lutz

pjot

#26
I am just wondering if there was a particular reason why there is no 'fork' emulated in newLisp for Windows. Of course I am willing to help you out but my Win32 knowledge unfortunately is limited... :-(



If it appears too difficult, too much work, or if the resulting newLisp binary becomes too large, well, then probably it might not be a wise thing to do.



Peter

Lutz

#27
It is a bigger piece of work, thats why I have not come around doing it. I also believe that most people wanting to do a multithreaded application in newLISP will be found not on Windows but in the UNIX world. So for the Win32 flavor 'fork' doesn't have the same priority as it has on UNIX.



Lutz

pjot

#28
Is there maybe a possibility to write a 'fork' emulation with newLisp? The commands 'cpymem', 'process' and so on could be used for it, I suppose?



The whole thing can be put in a separate context, so your newLisp binary will not grow larger.



Still it is an emulation, but it's better than nothing.



Peter



(PS your suggestion about those Unix people I agree with. The whole 'fork' idea for Windows is not that urgent.)

Lutz

#29
Yes, you could do that theoretically, interesting idea, although it would be slow.



Lutz