I read an article about COW implementation and issues in multithreaded
environments.
Then I found another article about counted reference and now I don't
understand anything. For instance CString on windows use counted
reference but it seems it's different from COW.
COW is a reader/writer solution. Reference counting is a storage
management technique used to keep track of the old copies of an
object. You could use GC or something else instead of reference
counting.
--
Joe Seigh
When you get lemons, you make lemonade.
When you get hardware, you make software.
AFAIK the only difference between reference-counting and COW is
that the latter is an extension of the former. In other words, COW
*is* reference-counted, but additionally if a non-const function is
called, it makes a deep copy of the data.
So if something uses COW, it uses reference-counting. Perhaps that's
what you read about CString? (Unless CString indeed doesn't make deep
copied if non-const functions are called...)
COW is used in conjunction with some sort of lifetime management scheme. Its
just means that a full blown copy of an object is created in order to ensure
thread-safety wrt the reader/writers problem in general.
One should consider using PCOW instead... This is "Partial Copy-On-Write",
which usually turns out to be more efficient then the various COW
techniques; marked improvements wrt COW vs. PCOW can be realized most of the
time.