mardi 29 septembre 2015

How one can use locks atomics when programming simple database? [on hold]

Suppose we have simplified key value database using std::map and each client is served by thread.

If several clients select data there is nothing to worry about.

If some client updates / delete data, there must be no selects, also there must be no two updates running at the same time.

How this can be done with locks? What will the lock looks like? What part of the code will need to check the lock?

Thing like this is done in MyISAM. How MySQL (MyISAM) is doing it?

Can this be done with atomics? Single atomic per "record" is not an option, because will be definitely expensive.

Aucun commentaire:

Enregistrer un commentaire