You are here: Re: process versus thread « All PHP « IT news, forums, messages
Re: process versus thread

Posted by Steve on 04/16/07 18:01

"Dennis van Weelden" <d.vanweelden@yahoo.com> wrote in message
news:45859$4623b38d$3ec38777$24221@news.chello.nl...
| Dear reader,
|
| If I look in the PHP manual at setlocale, I read the following warning:
| The locale information is maintained per process, not per thread. If you
are
| running PHP on a multithreaded server api like IIS or Apache on Windows
you
| may experience sudden changes of locale settings while a script is running
| although the script itself never called setlocale() itself. This happens
due
| to other scripts running in different threads of the same process at the
| same time changing the processwide locale using setlocale().
|
| I think that a thread is reading and processing a script.
|
| But what is a process???

linux, great as it is, is still trying to come up with a good threading
model to implement. the current solution for linux is to create a process
for every thread.

windows uses apartment-model threading, where one process is spawned and can
contain many threads.

a process is a space of memory holding a set or sets of instructions that
will be cycled through your pc's cpu. when you execute an application,
script, or whatever, a process is begun.

a thread is the set of instructions (in the process) waiting to get cpu
time.

a process, in windows, is like an apartment complex and a thread is the
renter. linux is more like a new housing development where a single thread
will be the occupant. i'm guessing you are running on windows if your are
having setlocale problems as you describe. your problem is then created
because iis/apache runs in one process (the apartment complex). one of your
renters (a php thread) is doing his laundry and setting the washer on
different settings than another renter...however, different from real life,
the cpu essentially allows BOTH renters to use the washing machine at the
same time - atually, a small portion of time is given each renter and the
cpu switches back and forth between whos clothes are being washed until one
of them is done.

anyway, linux creates two washers...so the thread setting the local has no
effect on a neigboring process/thread. in windows, you have to keep this
effect in mind as how your neighbors set global settings on your shared
washing machine will directly impact how clean your clothes come out. :)

clear as mud?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация