1

我需要知道如何找到我的计算机的内存对齐(Windows 7)。这是因为我正在写论文,而我使用的第四方 DSP 通信板的 dll 数据以 4096 对齐方式发送和接收,但问题是为什么会这样?为了首先找到它,我必须知道我的 PC 的对齐方式是什么。

4

2 回答 2

0

从'man memalign' - 从这里开始。DSP 组件可以使用来自 PC 的另一种对齐方式,这取决于其内部架构以及将其与主机连接的总线。

   On many systems there are alignment restrictions, for example,  on  buffers  used  for  direct  block
   device  I/O.  POSIX specifies the pathconf(path,_PC_REC_XFER_ALIGN) call that tells what alignment is
   needed.  Now one can use posix_memalign() to satisfy this requirement.

   posix_memalign() verifies that alignment matches the requirements detailed above.  memalign() may not
   check that the boundary argument is correct.

   POSIX  requires  that memory obtained from posix_memalign() can be freed using free(3).  Some systems
   provide no way to reclaim memory allocated with memalign() or valloc() (because one can only pass  to
   free(3) a pointer gotten from malloc(3), while, for example, memalign() would call malloc(3) and then
   align the obtained value).  The glibc implementation allows memory obtained from any of  these  three
   routines to be reclaimed with free(3).

   The glibc malloc(3) always returns 8-byte aligned memory addresses, so these routines are only needed
   if you require larger alignment values.
于 2013-12-25T14:08:34.970 回答
0

嗨,正如我在上面的评论中提到的,但只是为了澄清我的问题已经解决,因为我知道 PCIe 的最大对齐是 4096 字节。

谢谢

于 2013-12-26T13:39:50.877 回答