5

I have always wondered why my computer would copy files to an external drive at first at high speed, and then 'hang' for a while before continuing. When I upgrade RAM from 1GB to 2GB I noticed this 'hanging' happened way less. I have now come to a 'conclusion' that RAM is used to store the data and then copy it to the drive, so when I copy something bigger than my RAM, it needs to go in 'batches'. Does this make any sense? Is this what happens? And also, does this mean that if I would add a few GB RAM, that I could most likely copy larger files and have more constant speeds?

I am using Ubuntu Linux.

2 Answers 2

3

You are witnessing a "Data Buffer", which is a standard part of (practically) all computers.

From that Wikipedia link:

In computer science, a buffer is a region of a physical memory storage used to temporarily hold data while it is being moved from one place to another.

Buffers are often used in conjunction with I/O to hardware, such as disk drives...

In short: Yes you are on-track in your thinking, and getting more RAM will help speed up file transfers. The difference depends on a lot of things beyond RAM though (file sizes, number of files, etc.) and the long-term storage mediums (disks) are the bottleneck to speed 99% of the time.

1
  • "Buffers are often used ..." - The Wikipedia article is not very accurate. Rather than "often used", buffers are rarely not used. About the only time buffers are not needed is when transferring very small units of data, such as a byte value. Otherwise data for block transfers, sectors and message frames/packets are always buffered in main memory prior to transmission/writing and while received/read. There is also (hidden) buffering going on internally in peripheral devices such as disk controllers (between SATA interface and R/W heads) and Ethernet (store & forward) switches.
    – sawdust
    Nov 28, 2012 at 1:22
3

You are correct that the data is read into RAM and then the write to disk is scheduled. So long as there is more free RAM, the reading does not need to be delayed to let the writing catch up. However, the actual writing speed is not affected. The writing actually has not finished when the copy finishes. The operating system continues flushing the data from RAM to disk.

1
  • This is most apparent when reading something from the RAM cache at a later date. If you restart your computer,start a program, exit it, and start it again, you'll probably notice that it started much quicker the second time. Oct 23, 2011 at 3:03

You must log in to answer this question.