From: MiG Date: 2004-08-26T18:10:42+09:00 Subject: Re: Ruby interpreter as client-server Okay, if it is so, that's great and I'll try it as soon as possible. thank you :-) Jan Molic Dne 26/8/2004, napsal "Bill Kelly" : >Hi, > >> I thing forking creates new interpreter instance, so this is not what I >> want (why do not run normal /usr/bin/ruby then?). >> I don't need client-server for something like RPC but I need less memory >> usage (run only one instance and scripts in it's threads). > >fork() is optimized, though. It's a standard Unix idiom for spawning >child server proceses from the parent. It uses copy-on-write memory >management so the parent's memory space doesn't have to be >duplicated for the child. They share the "same" memory pages >until such time as the parent or child modifies a page, at which point >a private/unique copy of that page is made for the modifying >process; so the parent and child really are separate semantically, >but in a very efficient way. > >So forking is much more efficient, both in speed and memory usage, >than running a separate /usr/bin/ruby. > >You could try a quick test and see how many times you can fork() >in a second.... Should be a lot. > > >Hope this helps, > >Regards, > >Bill > > >