dimanche 20 mars 2016

Double-checked locking vs. locking pattern scenario

I'm new to design patterns and I have this scenario that was given to me:

A client has a database designed to hold prices for various stocks which are traded at the NYSE. Each stock price may be updated (written) or evaluated (read) by a variety of different pricing firms around the globe (e.g. Goldman Sachs, Mitsubishi Financial Group, UBS). Data integrity is of utmost importance, but availability is equally as important. This means the latest price should be available as soon as possible, and the systems trying to update the price should not be blocked, if at all possible. Here is the question: consider pattern usage for both the updater/writer and the evaluator/reader; given the options of Lock, Double-checked Locking, or None (no pattern to be used), explain what you would use in the case of the writer and the reader, and why.

I'm really not sure if the best option is the double-checked locking pattern or to use no pattern at all, can anyone give me any insight as to which method is the safest but also most efficient?

Aucun commentaire:

Enregistrer un commentaire