Differences between Copy on Write (COW) and counted reference

M

mosfet

Hi,

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.
 
J

Joe Seigh

mosfet said:
Hi,

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.
 
J

Juha Nieminen

mosfet said:
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.

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...)
 
C

Chris Thomasson

mosfet said:
Hi,

I read an article about COW implementation and issues in multithreaded
environments.

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top