Creation of 1.3 GB file takes only 1 second. How?

44

4

I have folder which contains over 200 files and has size of over 1.3 GB:

enter image description here

I use Gizmo Drive software to create an .iso file from that folder.

enter image description here

The interesting thing is it takes only 1 or 2 seconds!

enter image description here

I have tried that several times. I even tried to create the .iso file on another volume. Again it takes only 1 or 2 seconds.

I tried to mount the .iso file, everything works fine. I thought that it might be an .iso file referencing the source folder then I moved the source folder to another place but no luck. Even copying the produced .iso file takes minutes!

So how come creating the .iso file takes only 1 second! Do you have any explanation for that?

Notes

  1. All tests conducted on a regular HDD, no SSD.
  2. Using Windows 7 x64, have 16 Gig memory, Core i5 CPU.

I have used sync.exe to flush all file system data to disk just after the .iso file is created and sync.exe took 14 seconds to flush the data. That means it actually takes 14 seconds to create the .iso file. A quick benchmark on my D: drive shows that it can write the same .iso file from an SSD to my D: drive in 14 seconds and that confirms the source folder is in RAM and it takes 14 seconds to flush the data.**

Ramazan Polat

Posted 2014-10-29T01:50:24.710

Reputation: 930

What is the size of the .ISO file itself? – Ramhound – 2014-10-29T01:52:44.460

The size of .iso image is almost the same as source folder (1.37 GB) – Ramazan Polat – 2014-10-29T01:54:20.983

28You know... caching. – mg30rg – 2014-10-29T11:12:15.253

1Did you try repeating after a full restart of the computer? – ADTC – 2014-10-30T03:44:02.297

1I also suggest trying another software like CDBurnerXP to create an ISO, and check if you get the same results. Also I hope D: is not a RAM Drive - unlikely but possible. – ADTC – 2014-10-30T03:50:37.120

@ADTC Yes I was able to reproduce it after restarting. It works again and again. And no, D: is not a ram drive. D: is a regular HDD. – Ramazan Polat – 2014-10-30T11:51:14.297

1

Try running the Sync command mentioned here after creating the ISO, see how long it takes.

– Barmar – 2014-10-31T19:12:30.037

1@Barmar I have used Sync and you can see the result in the last paragraph of the question. Thank you. – Ramazan Polat – 2014-11-01T20:13:03.720

Answers

69

With 16GB of RAM, you probably have a lot of it free for disk caching. The ISO has most likely just been buffered entirely in RAM by the operating system; it'll be written to disk later, but applications don't have to wait for that.

Wyzard

Posted 2014-10-29T01:50:24.710

Reputation: 5 832

So that means somehow computer powers off, I will not be able to access that file or it will be corrupted. Are you sure it is cached to RAM? It doesn't make sense. – Ramazan Polat – 2014-10-29T01:57:31.373

42Yes, if you turn off your computer without doing a proper shutdown, data that was recently written by applications may not have actually been written to disk yet. – Wyzard – 2014-10-29T01:59:30.420

3It doesn't take long to 'reserve' space on a file system, I've done this for very large files in C++ (several TB) by seeking to the last byte of the file offset from the origin - instant multi terrabyte file allocation; actually writing that much information takes a little while but with windows 7 files are cached in 'free' memory - files previously read or written will be retained as pages until there is memory pressure to release the pages under the premise that the most likely file to be needed was the most recent to be used - this is new in Windows 7. – Michael Stimson – 2014-10-29T04:21:42.647

1Caching to RAM is best explanation here. But even if it is cached in RAM first then lazily written to disk, then how come a process read the 1.37 GB size of files in 1 second from an ordinary HDD? I create the .iso file then immediately delete the source folder. It still works! – Ramazan Polat – 2014-10-29T16:44:14.713

10It didn't read the source files... they are already cached in ram because you accessed them recently. Reboot to clear the cache, then try to create the iso and it will be slower. – psusi – 2014-10-29T19:23:13.097

8Microsoft intern chiming in. My manager worked a lot on NTFS, and told me (IIRC) that it can take a whole sixteen seconds from the time you call WriteFile to the time that data starts to hit the disk controller. During that time, read/write calls will refer to the in-memory version. The write-through flag will let you bypass the Windows cache, but you're still at the mercy of the disk controller's cache. – zneak – 2014-10-30T01:24:53.347

1But even if the source is cached, I'm not sure how writing that large an ISO file could be done in 1 second, unless it's all zeros. It could be misleading if the write is cached by the software/OS and it says it's done (while it's still flushing the cache). I could start copying the ISO to a thumb drive even before the cache is fully flushed, thus end up with an incomplete corrupt copy. – ADTC – 2014-10-30T03:48:31.467

2If you copy your file to another drive, you'll be copying the correct data from the cache, even if it hasn't been written to disk yet. All file access goes through the operating system's disk cache, so the OS can present a correct and consistent view of what's been written to the filesystem, even if the actual write to the underlying physical disk hasn't finished yet. (And I'm not sure what you mean about writing all zeros — the value of the bytes doesn't affect how quickly they can be stored to RAM.) – Wyzard – 2014-10-30T03:53:30.817

1@Wyzard I meant a large, even a very large file can be "written" or rather created, in just milliseconds if the file contains very little valid data. That's what I meant. I didn't mean it affects RAM storage speed, I meant it affects hard disk write speed. Technically it's not "all zeros", I was wrong to use the term, but it's more "(almost) all ignored data".. this typically happens when creating a "virtual hard disk" (VHD) file which could be many gigabytes, but wouldn't take more than a couple of seconds to create. – ADTC – 2014-10-30T10:11:58.737

2@RamazanPOLAT We are interested to know if you were able to reproduce this after restarting the computer (to clear the RAM), and I also want to know if you can reproduce this using a different software you can use to create ISO files (again, after restart). Please see my comments on the question. – ADTC – 2014-10-30T10:12:58.407

1This write-caching behaviour is configurable in the Device Manager settings page for the disk, under Policies tab "Enable write caching on the device". – RJFalconer – 2014-10-30T12:44:45.033