/    Sign up×
Community /Pin to ProfileBookmark

Multithreading Issues

hi,

does php guards me from multithreading issues, like writing to the same file ?

how it is implemented?
all the web servers has a thread pool, so php doesn’t run in a serial manner.

what will happen if two apache threads, for example, which runs two php requests will try to execute fopen on the same file?

thanks in advance,
Guy.

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@bokehNov 09.2005 — All computers run in a serial manner, multithreading or not. Regarding the file issue you could use file locking.[URL=http://es.php.net/flock][B]flock[/B][/URL]
Copy linkTweet thisAlerts:
@ZanaauthorNov 09.2005 — "All computers run in a serial manner, multithreading or not",

what do you mean by that?

thanks.
Copy linkTweet thisAlerts:
@bokehNov 09.2005 — CPUs only do one task at a time. Multitasking allows steps of various tasks to be carried out in rotation giving the impression they are occuring at the same time. By the way php is a single thread language although of course multiple iterations of the same script can be run at the same time.
×

Success!

Help @Zana spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...