is php "safe-thread"?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
newmember
Forum Contributor
Posts: 252
Joined: Fri Apr 02, 2004 12:36 pm

is php "safe-thread"?

Post by newmember »

hi


In programming there are system internal mechanisms that guaranty that only one and one only thread uses shared resource...
How php handles concurrent actions?
like reading from the same file
or two instances of the same script are launched then what happens to global variables? and etc.

for example, is it possible that while first instance of script locks the file,
another user comes, and second instance of script is launched.
and it also succesfully aquires file lock. so in the end two instances of script have locks and not aware that they write to/from the same file?


thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

each page is a single instance, unaffected by all others, unless you are using shared memory. A script can ask the file system to lock a file, however, the actual locking is up to the OS.
User avatar
newmember
Forum Contributor
Posts: 252
Joined: Fri Apr 02, 2004 12:36 pm

Post by newmember »

thanks:)
Post Reply