Here is my new and more efficient invention that is scalable and that
is composable and that solves the problem of race conditions in
imperative and object oriented languages.
About C++ or ADA or Java etc. and my following enhancement to them...
C++ or ADA or Java etc. must add properties that you can access only
from the constructor and can not be accessed from the methods of the object.
This way you will be able to implement more cleanly my following
First you have to call a constructor that will put a number of times the
same global shared variables or all the properties of the object as
pointers for example in there respective FIFO thread-safe queues, many
times because this will scale well for the reader and this is for the
reader side, and for the writer side you have to put only one pointer to
the global shared variable or the property.
And now you have to synchronize like a scalable reader-writer lock the
two queues, one for the readers and one for the writer with locks,
so if you grap the pointer of a property from the readers queue, the
writer queue must contain one item, but if the writer queue doesn't
contain an item the readers will block and wait, and if there is an item
in the writer queue and there is no item in the readers queue, so
the reader will block and wait, and if the writer grap the pointer of a
property from the writer queue , the other writers will block and wait.
This way you will solve the problem of race conditions efficiently for
imperative and object oriented programming, and this solution is
composable, because you can put all the properties of the object this
way on there respective reader and writer queues.
For Deadlocks use this:
Use Lock Hierarchies to Avoid Deadlock
Amine Moulay Ramdane.