Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"The second catch is that every new thread is very expensive to create. The interpreter is not small, and duplicating it with every thread makes for a lot of overhead."

There have been a lot of misconceptions about threading in perl, most likely because of the two different implementations.

The modern implementation, which has been around literally for years, is seemingly pthread based. According to strace, the clone(2) system call is used on linux to create a thread, and all memory is shared between the threads (CLONE_VM is specified). "Duplicating the interpreter" is roughly the same as for any other thread based program, where what needs to be allocated is a stack for the thread and some other TLS areas.

However, the time it takes to start up a thread is often why a "pre-fork" thread model is used. One should take into account the limits of the platform they are using when they are designing the application, to work around/avoid any perceived weaknesses.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: