Michel Fortin, el 12 de febrero a las 19:47 me escribiste: > >Cool. Hadn't thought of something so simple. I just watched a > >channel 9 blog > >(http://channel9.msdn.com/shows/Going%20Deep/Mark-Russinovich-Inside-Windows-7-Redux/) > >and about half-way through they talk about new process reflection > >capabilities in Windows 7, which are an extension of fork, which > >they've had for a while (for posix compatibility, etc). Also, the > >PAGE_WRITECOPY protection should also allow this to work on > >Windows, at a finer grain. > > It looks cool indeed. I was a little wary for ill effects at first, > so I attempted to insert an innocuous: > > if (fork() == 0) { > sleep(1); // do mark and sweep and return the result to the > parent process. > exit(0); > } > > in a (single-threaded) Cocoa application. No ill effect found (as > long as you don't forget the exit(0)). I wonder how it'd fly on > Windows though, isn't process creation a little more heavyweight?
I know Linux is very fast at fork()ing, you can even use clone() directly to avoid copying file descriptor tables for example. Even more, you get all the threads stopped in the cloned process for free ;) -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ ---------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ----------------------------------------------------------------------
