473,800 Members | 2,342 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

concurrency, locks, multi-user app.

I'm investigating this subject, particularly DB interactions, and could
use input.
It seems the dominant consensus, in these discussions is "use flock()
...."
I guess this would be similar to, in Java terms, using synchronized
(objLock) { ... }

This lends itself to OOP modularization, localization of reads and
writes, using locks.

Also, MySQL might say in the manual,
this storage engine locks at the [page | row | ...] level.

But what does this get you ?
If the goal is consistent data, and no simultaneous writes, its a
worthy goal.
But how should the application be designed ?
Do you limit access to reports, displays, forms on data that is
currently being written ?
If a PHP flock() or DB lock impedes access, what then ?
Does it wait a time slice then try ? or throw error ? fatal error ?
recover ?

Any good articles, references ? any from Wrox, O'Reilly ? TIA for
responses

Jan 6 '06 #1
1 1737
awebguynow wrote:
I'm investigating this subject, particularly DB interactions, and could
use input.
It seems the dominant consensus, in these discussions is "use flock()
..."
I guess this would be similar to, in Java terms, using synchronized
(objLock) { ... }
True.

Problem with flock is however that W$-machines have no clue what you are
talking about. :-(

This lends itself to OOP modularization, localization of reads and
writes, using locks.

Also, MySQL might say in the manual,
this storage engine locks at the [page | row | ...] level.
Yes.

But what does this get you ?
If the goal is consistent data, and no simultaneous writes, its a
worthy goal.
It means that mySQL will manage this for you where and when appropriate.
You do not have to worry about the details yourself, unless you want to
optimize (you can give mySQL hints), or want to lock some tables/rows for
some other reason.

In general: Just trust your database engine to do its job right.
But how should the application be designed ?
Well...
How can we answer such a question?

Some shots in the dark:

If you are doing webstuff: Just include a connection-file above every script
that gives you a valid connection to the datatabase.
Use this connection in your script for select/update/delete/etc.

I am unsure if mySQL understands transactions.
If you want a better database, switch to Postgresql: it is a lot more
mature.
Do you limit access to reports, displays, forms on data that is
currently being written ?
Most database engines have a maximum number of connections, if that is what
you mean. Ofter 32 or 64. But that number can easily be modified by some
ini-file.
If a PHP flock() or DB lock impedes access, what then ?
flock and database row/table lock are two different things. They share the
word 'lock' but that is about it.
But for both goes that the script that trying it waits and tries again.
Maybe they use some fancy sheduling behing the scenes (like monitor
functionality found in Java), but I am unsure about the how and when.
Does it wait a time slice then try ? or throw error ? fatal error ?
recover ?
For flock: just try it yourself.
Make 1 script that flocks a file.
Make another that tries this too.

Any good articles, references ? any from Wrox, O'Reilly ? TIA for
responses


www.php.net is a good resource. Be sure to read all usercontributio ns too.
They help a lot understanding what is going on.

Hope this helped you a bit.

Regards,
Erwin Moller
Jan 6 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

31
26652
by: Derek Fountain | last post by:
Does Python have a timer mechanism? i.e. an "after 500 milliseconds, run this bit of code" sort of thing?
16
2903
by: aurora | last post by:
Hello! Just gone though an article via Slashdot titled "The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in Software" http://www.gotw.ca/publications/concurrency-ddj.htm]. It argues that the continous CPU performance gain we've seen is finally over. And that future gain would primary be in the area of software concurrency taking advantage hyperthreading and multicore architectures. Perhaps something the Python interpreter...
7
4156
by: chessplayer | last post by:
Greetings Folks, I am trying to understand how DB2 locks data and can't believe my eyes. Have read the literature about the difference isolation levels and have a general understanding about intent, update, share and exclusive locks. I am working on the sample database tables and using the default isolation level of CS.
1
1274
by: Shawn B. | last post by:
Greetings, First of all, I'm not exactly sure how seriously to take the C-Omega project (http://research.microsoft.com/Comega/). It appears to be a potential glimpse into what C# 3.0 might become. It has had some press recently and I have taken a small interest in it. Particularily, I am interested in the embedded SQL-like syntax that it provides for accessing objects and to a lessor extent (with regards to my interst in it)...
4
1670
by: Yoram Biberman | last post by:
I have a few questions concerning concurrency control. I shall thank whoever can help me. Question #1 ========= Assume the following (concurrent) schedule, in which both transactions run in a serializable isolation level: T1 begin T2 begin T1 modifies an item A
2
7658
by: Jürgen Devlieghere | last post by:
Hi, We are creating event-driven multi-threaded applications on a daily basis. To help us solving deadlocks, we implemented a CriticalSection class that does dead-lock detection: an attempt to Enter() the critical section that would cause a deadlock logs the complete deadlock loop (thread / Critical section) and raises an exception. It has helped us a lot in the past. However, to prevent further deadlocks, and to get a higher...
9
2037
by: corey.coughlin | last post by:
Alright, so I've been following some of the arguments about enhancing parallelism in python, and I've kind of been struck by how hard things still are. It seems like what we really need is a more pythonic approach. One thing I've been seeing suggested a lot lately is that running jobs in separate processes, to make it easy to use the latest multiprocessor machines. Makes a lot of sense to me, those processors are going to be more and...
10
3606
by: Hunk | last post by:
Hi I would like some ideas on way to solve the concurrency issue. The problem is , I have an object say X which multiple readers need to access and also to update. They do so by say two functions : // simplistic view of the problem Read() { return X; }
9
1848
by: Anthony Paul | last post by:
Hello everyone! I've been reading a great book on SOA called "Enterprise SOA" and found that it answered many questions. However, there's one particular scenario (involving business-rules) that I'm not sure how to implement under optimistic concurrency control. Let's use a Phone-book in our scenario. We can break this down into
2
2002
by: Pallav singh | last post by:
Hi Kindly Provide me Link about Concurrency patterns in C++ Thanks Pallav Singh
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10276
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10253
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10035
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9090
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7580
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.