473,396 Members | 1,777 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Differences between Copy on Write (COW) and counted reference

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.
May 10 '07 #1
3 2087
mosfet wrote:
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.

--
Joe Seigh

When you get lemons, you make lemonade.
When you get hardware, you make software.
May 10 '07 #2
mosfet wrote:
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...)
May 10 '07 #3
"mosfet" <jo******@anonymous.orgwrote in message
news:46**********************@news.free.fr...
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.
May 11 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Søren Johansen | last post by:
Hi, I was wondering how to go by making classes that allocate resources such as files, windows etc. Usually, I make a private assignment operator and copy constructor. The reason is that I think...
42
by: Edward Diener | last post by:
Coming from the C++ world I can not understand the reason why copy constructors are not used in the .NET framework. A copy constructor creates an object from a copy of another object of the same...
16
by: bluekite2000 | last post by:
I want Matrix A(B) to create shallow copy of B but A=B to create deep copy of B. Is that bad design? Why and why not?
3
by: Tony Johansson | last post by:
Hello!! Is it correct to say that THE ONLY TIME it's absolute necessary to define a copy constructor and a destructor when implementing a class is when allocating dynamic memory //Tony
5
by: Matthias Kaeppler | last post by:
Hi, I was wondering, since STL containers are based around copying, whether it's a good idea to use reference counted smart pointers, such as boost::shared_ptr in STL containers. I can't store...
7
by: simkn | last post by:
Hello, I'm writing a function that updates an array. That is, given an array, change each element. The trick is this: I can't change any elements until I've processed the entire array. For...
8
by: coredumperror | last post by:
Hi all you C++ gurus out there, I've got what may be an unusual question. What's the best way to get a shallow copy of a class that you've programmed to prevent accidental shallow copying? I've...
3
by: thecount | last post by:
What implemetation for a copy on write pointer do you recommend that I use, since it's not a completely standard thing? I found the link to http://code.axter.com/cow_ptr.h, used it, and it crashed. I...
1
by: Angus | last post by:
Hello If I have a function which creates a pointer like this: int number = 44; //global void MyFunction() { int* pNum = &number; }
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.