jeudi 14 avril 2016

How to saftley change update a simple database (dictionary) if Multithreading is used?

I am working on python project that uses multithreating and a database.

We are concerned that multiple processes might try to access the database at the same time. Which would be the best approach in such a case?

In my opinion we should use getters and setters to access the database. The set() function should some how put new values in a queue and process each of then sequentially. In my mind this make sense but It is not clear how to implement it. I'm concerned we would end up having multiple instances of the database, so no way to queue data.

For our particular project we are using a dictionary as a database, MVC architecture and pubsub for multithreating.

Aucun commentaire:

Enregistrer un commentaire