Re: [mod_python] Sessions performance and some numbers
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache Mod-Python > Re: [mod_python] Sessions performance and some numbers




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Re: [mod_python] Sessions performance and some numbers  
Gregory (Grisha) Trubetskoy


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-08-05 10:45 PM



On Fri, 8 Apr 2005, Barry Pearce wrote:
 
>
> errr. no. here is the code snippet:
>
> persist = os.open(self.m_file, os.O_CREAT | os.O_EXCL | os.O_WRONLY, 0660)
>
> O_CREAT | O_EXCL ensures that any race is coped with by the operating syst
em
> kernel

you say "no" then say it is "coped with by the operating system" ;-)

this is flock(2), BTW

> - works equally well on mac/win32/unix/linux if two threads try it at
> precisely the same time one will win one will fail - the failed one simply
> re-evaluates the random and tries again. As yet though I have yet to see a
> collision on my code...I could only test by manufacturing the situation.
> 
>
> Fair do. But its not complex - given that part of the day job is linux ker
nel
> development - locking is not that bad!!! 

Well, may be how the actual locking is done in the OS isn't complex
(though I believe it actually has to be supported in hardware).

The messy part is that different types of locks beave differently when it
comes to the same process or its children accessing the same lock, and on
top of that the definitions may differ across different OS's. E.g. I don't
think flock would be usable in a multi-threaded environment since appying
a new lock from the same process is a noop. Also while flock is a
lock-per-file, an fcntl(2) lock can lock regions of a file... Then there
are SysV IPC semaphores which behave differently - finding and correctly
using the locks is the problem that the APR solves.

Grisha






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 11:10 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register