Threads and the like
Moderator: General Moderators
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Threads and the like
Ok, in response to my apparent lack of knowledge of servers and such, would anyone be willing to take a moment to explain to me what threads are, why PHP in some cases is not thread-safe and what the differences between a thread and a process are? I am certain I should know this well by now, but I don't (there, I said it, I admitted it, I don't know my shizzle) so any thoughts and opinions would be much appreciated in the 'Education of Everah Event'.
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
Is "lint" simply a collection of zombie sub-sub-processes? 'Cause I get that!
Thread-safety: http://en.wikipedia.org/wiki/Thread-safety
Thread-safety: http://en.wikipedia.org/wiki/Thread-safety
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
So Apache for example runs as an instance, which spawns a process which spawn threads (that is if I understand this correctly). So it is feasible to have an instance with many processes, and within each process, have many threads?
/ dablabit wikipedia. It seems to not want to let me into the door today.
/ dablabit wikipedia. It seems to not want to let me into the door today.
Wikipedia wrote: Threads are distinguished from traditional multi-tasking operating system processes in that processes are typically independent, carry considerable state information, have separate address spaces, and interact only through system-provided inter-process communication mechanisms. Multiple threads, on the other hand, typically share the state information of a single process, and share memory and other resources directly. Context switching between threads in the same process is typically faster than context switching between processes. Systems like Windows NT and OS/2 are said to have "cheap" threads and "expensive" processes; in other operating systems there is not so great a difference.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA