Faster is not always better

All off topic discussions go here. Everything from the funny thing your cat did to your favorite tv shows. Non-programming computer questions are ok too.
Post Reply
Congdm
Member
Member
Posts: 48
Joined: Wed Aug 01, 2012 10:53 am

Faster is not always better

Post by Congdm »

A few weeks ago, my hard disk crashed so I have to using my old 10 GB backup hard disk. Using hard disk benchmarking software, I got some information about it speed: Running at UDMA-66, Read sequential speed 16 MB/s, Read cache speed 66 MB/s. File copying, file decompressing were slow but I noticed no GUI or applications delay, latency or lag.

Last week, I bought a dirt cheap 40 GB ATA Hard disk. This disk run at UDMA-100, Read sequential speed 50 MB/s, Read cache 80 MB/s. I use a PCI ATA RAID card, 815 mainboard with 512 PC133 SDRAM, so I guess 80 MB/s is the maximum I can get from my system.

This hard disk of course performs better than the old hard disk in file copying but GUI and applications are lagging when file copying happens.

I think the main reason is: The DMA channel is working at maximum capacity, it steals a lot of memory access time from CPU so the latency of the other applications is worse. Am I wrong?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Faster is not always better

Post by Combuster »

I quickly looked up the i815, it seems to have a memory bandwidth of 400MB/s. Your harddrive will still not be stealing more than 20% of it and the cache should provide enough for the rest of it.

However at 50MB/s assuming 64-sector transfers you end up with 1500 harddisk interrupts per second and an equal number of resulting context switches and driver invocations. That also interferes with your scheduling, and the interrupts are likely to happen in a different task's context than the process that is waiting for the data to be read.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
turdus
Member
Member
Posts: 496
Joined: Tue Feb 08, 2011 1:58 pm

Re: Faster is not always better

Post by turdus »

Congdm wrote:I think the main reason is: The DMA channel is working at maximum capacity, it steals a lot of memory access time from CPU so the latency of the other applications is worse. Am I wrong?
Wrong, the whole idea of DMA is not to use CPU. When a device is working, cpu can handle different things, as soon as it finishes, it will interrupt the cpu to process the data from device, and no memory access for that buffer is made by the cpu before that. I'd assume parsing the data is more time consuming than the freq of interrupts on your new fast device, that's why apps lag (so the ISR takes more time to complete than the controller to locate and load a sector into memory. Meaning the ISR haven't finished by the time the next interrupt would fire, causing accumulation, which makes the kernel to increase priority of overloaded task, that ultimately leads to inresponsible system). But I'm just guessing.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: Faster is not always better

Post by JamesM »

No; while the dma engine is using memory, the CPU cannot. That is his point. This would affect io bound applications such as gui stuff more than compute bound.
Congdm
Member
Member
Posts: 48
Joined: Wed Aug 01, 2012 10:53 am

Re: Faster is not always better

Post by Congdm »

Combuster, you are so right! There is no way the DMA Busmaster can steal all the memory bandwidth. I rechecked everything and found the culprit.

I forgot that I had compressed the NTFS partition... I create 2 new folders that aren't compressed, and then copy file between 2 folders. Now, the web browser doesn't lag anymore. The reason that the slow hard disk doesn't cause lag is it only feeds 16 MB to the CPU each second to decompress.

But what make I puzzled is why Windows NT need to decompress in order to copy compressed file inside a compressed partition? So ineficient.
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: Faster is not always better

Post by bluemoon »

That's the philosophy of windows - If you think about how they handle installation - they feel good when the same file copied THREE times around(*), decompress during copy sound comfortable.

1) copy the installation source file to temp
2) extract the temp file into yet another temp
3) copy the extracted file to destination (instead of move)


The equally bad design goes for IE download - it download to temp, and copy to destination even they are on the same drive.
Post Reply