There's another problem with Unix programming in Ruby that I'll just touch on
briefly: Java people and Windows people. They're going to tell you that
fork(2) is bad because they don't have it on their platform, or it sucks on
their platform, or whatever, but it's cool, you know, because they have
native threads, and threads are like, way better anyways.
Fuck that.
Don't ever let anyone tell you that fork(2) is bad. Thirty years from now,
there will still be a fork(2) and a pipe(2) and a exec(2) and smart people
will still be using them to solve hard problems reliably and predictably,
just like they were thirty years ago.
(http://tomayko.com/writings/unicorn-is-unix)
Under Linux, fork() is implemented using copy-on-write pages, so the only
penalty that it incurs is the time and memory required to duplicate the
parent's page tables, and to create a unique task structure for the child.
(linux fork(2) manpage)
Dovolte, abych vam predstavil cosi, co vas zcela jiste zaujme, mate-li radi
filosofii UNIXu a vite neco o systemovem programovani. Unicorn je webovy HTTP
server, ktery prichazi s velmi napaditou architekturou vyuzivajici radu
UNIXovych idiomu -- v rade situaci vyuziva inteligenci jadra misto toho, aby
vymyslel kolo, jako to delaji jine pre-fork servery.
Ctete a divte se, jaktoze to nikoho nenapadlo driv:
http://github.com/blog/517-unicorn
Zde jde o Ruby a jeho Rack interface. Porty se uz ale rodi.
T.
|