Re: Package for classes that wrap shared memory primitives

From: Date: Tue, 21 Jan 2003 09:53:24 +0000
Subject: Re: Package for classes that wrap shared memory primitives
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-3380@lists.php.net to get a copy of this message
Mike, Shm_Protected_Var is almost suited for this. It aggregates one Shm_Semaphore and Shm_Var. The semaphore is used to guard the operations with the shared memory. 4 methods are exposed : startSection, endSection, getVal and putVal. They are self explanatory. startSection is used to enter critical section and end section to exit it. getVal and putVal are permitted only in criticla section. I said that it is almost suited because the script has to enter critical section to access the var. This leads me to that a new class can be created which will allow read from the shared memory without entering critical section. However when a process wants to write an semaphore will be used to protect the var from reading. Finally, I want to say that the use of the classes is extremely easy and thus it won't be hard for someone who is involved into the development of PEAR cache to write a class that uses these classes. Because there were no suggestions for its name I think to name it Shm, add add it to PEAR soon. These days I am writing an article on that how to use these classes thus I am rethinking some details(cosmetic, the interface will stay the same) of the implementation. If this article won't get into paper I will publish it on the web. Regards, Andrey ----- Original Message ----- From: "Mike Carter" <mcarter@quantiv.com> To: <pear-general@lists.php.net> Sent: Tuesday, January 21, 2003 11:29 AM Subject: RE: [PEAR] Package for classes that wrap shared memory primitives > > > > -----Original Message----- > > From: Andrey Hristov [mailto:andrey@webgate.bg] > > > > Hello, > > 9 days ago I sent a message to this list with proposal for > > such package. I asked whether somone will PEAR-ify the code I > > had written. Today I did this (hope that it is by the PEAR's > > coding standards). The file is (shm.php) is attached. The > > code provides class wrappers for shm_var, semaphore, shm_var > > guarded with semaphore and implementation of a class that is > > useful for protecting a server from loading too much > > instances of a script. In fact the script is loaded but a > > shm_var guarded with semaphore is used to protect the server > > from running too many instances of this script. This class is > > useful for backend scripts that directly communicate with > > some frontend like Java applet(or application). However it > > may be useful in the traditional web enviroment. A test case > > is included in the file. Prerequisite is that php must be > > compiled with --enable-sysvshm and --enable-sysvsem. Please > > advice a name for this package. I cannot find appropriate > > category for it thus for now it is Shm. > > Would be great if you could use your SystemV skills to write a sub-class of > the PEAR cache class to use the servers memory to cache things rather than a > file or dbase table. Is that possible though....? > > Regards, > > > Mike C > > ________________________________________________________________________ > This e-mail has been scanned for all viruses by Star Internet. The > service is powered by MessageLabs. For more information on a proactive > anti-virus service working around the clock, around the globe, visit: > http://www.star.net.uk > ________________________________________________________________________ > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.pear.general (#3380) next »