Understanding copy and pasting.

Rickster

EVGA Fanatic
Joined
Jul 31, 2012
Messages
23,082
Reaction score
5,349
Location
Joe'berg
Here is what happened, I was told than when you copy (right click copy) a file it immediately makes a copy of the file into your RAM. But as I discovered it doesnt work this way, I copied some files and then proceeded to format the flash drive where I just copied from and then pasted the files to the newly formatted flashdrive and it said some error about file origin not found. Aaaand I facepalmed.


Luckily it was my useless files and not a clients work, now i know not to do it.

By the way, it should be saved in RAM.
 
By the way, it should be saved in RAM.
Well, sure - but then you'd need a copying progress bar as it reads those files from the device and allocates them to memory. Then you'd need another copying progress bar when you paste and it writes those files. And 64GB of files won't fit into 32GB of RAM.
 
Well, sure - but then you'd need a copying progress bar as it reads those files from the device and allocates them to memory. Then you'd need another copying progress bar when you paste and it writes those files. And 64GB of files won't fit into 32GB of RAM.

So is it possible given you have more RAM than the size of the files you are copying and you give it time for the "invisible" copy progress bar?
 
So is it possible given you have more RAM than the size of the files you are copying and you give it time for the "invisible" copy progress bar?
I'm sure it's possible, just not practical. Without a progress bar how would you know when to remove the device? Then you'd still need a notification telling you it's ready to remove - in which case that progress bar may as well be visible.
 
I was told than when you copy (right click copy) a file it immediately makes a copy of the file into your RAM.

Whoever told you that told you crap.

When you copy a file into your clipboard (i.e ctrl-c), it only copies the file's path to system memory. It will then copy the actual source data across from the source location to the target location. It doesn't sit in RAM.
 
Way back in the 1980's MS-DOS used to work like that when copying from A: to B: (single drive PC). Some early versions of Windows would accidentally delete files when you messed up the path while doing a copy! More recent versions could move instead of copy when you dragged across the desktop. If you have multiple drives mapped on a network, the potential for error increases exponentially!

Moral of the story: Copy, then verify, then remove drive (and label it), and format only once you are sure!
 
Last edited:
I'm sure it's possible to do that, but despite how it might sound, it'll be pretty inefficient in most cases. A lot of design went into computers to actually cut out the CPU for the bulk of work like copying files in the form of DMA. If you copy the file to memory first, the operating system (using the CPU) would have to keep track of memory usage etc. By copying from disk-to-disk, the CPU and memory is mostly involved in figuring out where the source is located, and where the destination is (maybe some checks to see if the files will actually fit etc). After that, the DMA hardware takes over and the CPU is free to do some "useful" computing...

On top of this, skipping memory, your source and destination drives can be active at the same time. If you went to memory first, you'd have to wait for the read operation to complete (which for large files even on fast media like SSDs and flash disks, takes time). Then you'd have to wait for the write operation to complete, which for most media is significantly slower.

So yes, it sounds cool, but it just does not make sense really...
 
So is it possible given you have more RAM than the size of the files you are copying and you give it time for the "invisible" copy progress bar?
Copying and pasting files is not the same as copying and pasting text, or an image.
For small items like text or a picture, it copies to RAM. For the file system it only starts copying when you paste - as you can imagine, a file can get into the gigabytes size wise and would be impractical to use up your RAM and swap file when it only needs to read from the source file when you paste it.
 
Why would you move the files, format and move the files back to begin with?
 
Open Task Manager, Monitor currently used RAM, initiate copy, monitor RAM usage, wait for the dip to indicate data cache complete, Use the Safely remove hardware method,do whatever you need to do, click paste and initiate read/write.

Reading and writing pages of memory is 'paging' which is common among all virtual memory management operating systems.
 
Copy and paste or drag and drop stores a reference to the object(s) selected in RAM, then when Paste or Drop is actioned, the OS queries the "drop target" to ask what sort of formats it supports. If the source and destination can agree on a format, the paste goes ahead - the target is informed of the paste details (filename, and related metadata, for instance), and it can then import the data.

If just copying files, importing the data is essentially creating the files in a new location, and updating the metadata (file permissions, dates, etc) accordingly.
 
Top
Sign up to the MyBroadband newsletter
X