![Spectrum M2i.3010 Hardware Manual Download Page 160](http://html.mh-extra.com/html/spectrum/m2i-3010/m2i-3010_hardware-manual_1344389160.webp)
160
M2i.30xx / M2i.30xx-exp Manual
Continuous memory for increased data transfer rate
Continuous memory for increased data transfer rate
The continuous memory buffer has been added to the driver version 1.36. The continuous buffer is not avail-
able in older driver versions. Please update to the latest driver if you wish to use this function.
Background
All modern operating systems use a very complex memory management strategy that strictly separates between physical memory, kernel mem-
ory and user memory. The memory management is based on memory pages (normally 4 kByte = 4096 Bytes). All software only sees virtual
memory that is translated into physical memory addresses by a memory management unit based on the mentioned pages.
This will lead to the circumstance that although a user program allocated a larger memory block (as an example 1 MByte) and it sees the
whole 1 MByte as a virtually continuous memory area this memory is physically located as spread 4 kByte pages all over the physical memory.
No problem for the user program as the memory management unit will simply translate the virtual continuous addresses to the physically
spread pages totally transparent for the user program.
When using this virtual memory for a DMA transfer things become more complicated. The DMA engine of any hardware can only access
physical addresses. As a result the DMA engine has to access each 4 kByte page separately. This is done through the Scatter-Gather list. This
list is simply a linked list of the physical page addresses which represent the user buffer. All translation and set-up of the Scatter-Gather list is
done inside the driver without being seen by the user. Although the Scatter-Gather DMA transfer is an advanced and powerful technology it
has one disadvantage: For each transferred memory page of data it is necessary to also load one Scatter-Gather entry (which is 16 bytes on
32 bit systems and 32 bytes on 64 bit systems). The little overhead to transfer (16/32 bytes in relation to 4096 bytes, being less than one
percent) isn’t critical but the fact that the continuous data transfer on the bus is broken up every 4096 bytes and some different addresses
have to be accessed slow things down.
The solution is very simple: everything works faster if the user buffer is not only virtually continuous but also physically continuous. Unfortu-
nately it is not possible to get a physically continuous buffer for a user program. Therefore the kernel driver has to do the job and the user
program simply has to read out the address and the length of this continuous buffer. This is done with the function spcm_dwGetContBuf as
already mentioned in the general driver description. The desired length of the continuous buffer has to be programmed to the kernel driver
for load time and is done different on the different operating systems. Please see the following chapters for more details.
Next we’ll see some measuring results of the data transfer rate with/without continuous buffer. You will find more results on different mother-
boards and systems in the application note number 6 „Bus Transfer Speed Details“. Also with M4i cards the gain in speed is not as impressive,
as it is for older cards, but can be useful in certain applications and settings. As this is also system dependent, your improvements may vary.