copy-on-write Questions

2

Solved

My understanding of copy-on-write is that "Everyone has a single, shared copy of the same data until it's written, and then a copy is made". Is a shared copy of the same data comprised of a heap ...

2

Solved

I have read about the copy-on-write principle which occurs when a new process is being forked in Linux. I have also read about the fact that if multiple instances of one program are running at the...
Ulmaceous asked 23/8, 2015 at 19:34

2

Solved

I was just reading a Wikipedia article on Copy-on-write (curious if there are any filesystems that support it), and was surprised by the following passage: COW is also used outside the kernel, i...
Stonybroke asked 25/6, 2013 at 13:6

1

According to GCC 5 release changes page (https://gcc.gnu.org/gcc-5/changes.html): A new implementation of std::string is enabled by default, using the small string optimization instead of copy-o...
Brandtr asked 5/7, 2015 at 8:39

1

Solved

I there any way to avoid copy-on-modify for in-place modifications of matrices in R? I am trying to copy a smaller matrix to a slice of larger matrix as follows. library(data.table) y <-...
Loden asked 21/6, 2015 at 19:23

1

How do I prevent the GC from provoking copy-on-write, when I fork my process ? I have recently been analyzing the garbage collector's behavior in Ruby, due to some memory issues that I encountered ...
Popgun asked 20/5, 2015 at 14:53

2

Solved

I want to know how copy-on-write happens in fork(). Assuming we have a process A that has a dynamical int array: int *array = malloc(1000000*sizeof(int)); Elements in array are initialized to s...
Llano asked 27/11, 2014 at 0:52

1

Solved

I've been playing around with copy-on-write buffers on Linux and the following example seems to work as intended: #include <stdio.h> #include <stdlib.h> #include <sys/mman.h> #in...
Navicert asked 13/3, 2015 at 16:16

4

I noticed that in python, string object keeps only one copy. Like below code: >>> s1='abcde' >>> s2='abcde' >>> s1 is s2 True s1 and s2 point to the same object. When...
Whiplash asked 25/2, 2015 at 5:34

2

Solved

I have classes like below class A { @Override public boolean equals(Object other) { return true } } Class B extends A { } Class C extends A { @Override public boolean equals(Object other) { ...
Guyon asked 23/7, 2014 at 20:42

2

Solved

I get the idea behind copy-on-write. When I fork, the heap is marked as CoW, and when any process tries to change it, a copy is made. The question is: do I have to free it in a child's process none...
Berkelium asked 24/2, 2014 at 18:11

1

Solved

I've recently discovered that using references in PHP is generally (although not always) a bad idea from a memory management or performance point of view, because of Copy On Write and the way...
Provencher asked 23/2, 2014 at 21:10

2

Solved

I have a class that returns large NumPy arrays. These arrays are cached within the class. I would like the returned arrays to be copy-on-write arrays. If the caller ends up just reading from the ar...
Bumbailiff asked 20/2, 2014 at 1:6

2

Solved

It's known that Qt classes use copy-on-wite when passing by value. So copy isn't done until its needed. I have seen many times passing Qt classes by const reference when only needed read-only acces...
Wold asked 12/6, 2013 at 17:20

2

Solved

Is a shared memory/copy on write implementation for general containers (like that found in Qt's containers) superseded by C++11 move semantics and rvalue references? Where does one fail and the ot...

3

Solved

PHP uses a copy-on-modification system. Does $a = (string) $a; ($a is a already string) modify and copy anything? Especially, this is my problem: Parameter 1 is mixed / I want to allow to pass...
Capricorn asked 28/2, 2013 at 15:43

2

Solved

According to wikipedia (which could be wrong) When a fork() system call is issued, a copy of all the pages corresponding to the parent process is created, loaded into a separate memory location by...
Mapes asked 11/12, 2012 at 4:26

3

Solved

How to get sparse block size and check if data is present at the given offset in sparse file in reiserfs/ext3 in Linux? I want to use it to implement simple copy-on-write block device using FUSE. ...
Junko asked 1/4, 2010 at 20:5

5

Solved

If I have an unsynchronized java collection in a multithreaded environment, and I don't want to force readers of the collection to synchronize[1], is a solution where I synchronize the writers and ...
Alesandrini asked 15/8, 2012 at 4:5

2

Solved

If we consider a std::string implementation that uses reference counting, consider this scenario: int main() { string english = "Hello"; string german = english; //refcnt = 2 string german2 = g...
Splasher asked 21/6, 2012 at 23:39

1

Solved

I am implementing cp(file copy) command using mmap(). For that I mapped the source file in MAP_PRIVATE (As I just want to read)mode and destination file in MAP_SHARED mode(As I have to writeback th...
Ferrule asked 21/6, 2012 at 6:18

2

Solved

I stumbled about a method which seems to be present in all data objects like QList, QQueue, QHash... I even investigated so far I can see the source code of it, which is inline void setSharable(b...
Lacustrine asked 26/3, 2010 at 21:48

2

Solved

I am programming a web API client in PHP that parses CSV data into associative arrays and I want to protect my users from data-duplication when using these arrays. My users will never be writing t...
Keyway asked 17/6, 2012 at 21:34

1

Solved

I have a large buffer: char *buf = malloc(1000000000); // 1GB If I forked a new process, it would have a buf which shared memory with the parent's buf until one or the other wrote to it. Even th...
Linkboy asked 12/6, 2012 at 14:38

5

I want to implement a copy-on-write on my custom C++ String class, and I wonder how to. I tried to implement some options, but they all turned out very inefficient.
Stealthy asked 30/10, 2009 at 10:29

© 2022 - 2024 — McMap. All rights reserved.