What is Pinned memory?
Memory locked so the OS will not move or evict its physical pages. Transfers to the GPU no longer need an extra intermediate copy, and it can be used for asynchronous transfers.
Japanese name: ピン留めメモリ
Memory locked so the OS will not move or evict its physical pages. Transfers to the GPU no longer need an extra intermediate copy, and it can be used for asynchronous transfers.
Japanese name: ピン留めメモリ
With memory allocated in the ordinary way, the OS may write pages out to storage or move them to different physical pages. A page is the unit in which the OS manages memory. Pinned memory is memory fixed so that this eviction and relocation cannot happen. It is also called page-locked memory. Because the data stays at a fixed place in physical memory, a device can read and write it directly.
A GPU cannot read directly from memory that might be evicted or moved. The CUDA driver therefore first copies the data into a temporary pinned area and sends it to the GPU from there. If the data is placed in pinned memory from the start, this extra copy is not needed. In CUDA, asynchronous copies require pinned host memory. An asynchronous copy may be able to overlap with kernel execution.
Pinned memory cannot be put to other uses by the OS. Using too much reduces the physical memory left for the OS and other programs, and the whole system can slow down. The pinning operation itself is also heavier than an ordinary allocation. How much is too much is hard to know in advance, so it is checked on the actual system. Pinning is kept to the areas used to exchange data between the host and the GPU.
Answer: A. The OS will not move or evict those pages, so the GPU can DMA directly without an intermediate copy, and asynchronous transfers become possible
The OS can move ordinary memory to another physical page or evict it to storage at any time, so letting the GPU's DMA access it directly would be unsafe. Normally, therefore, the data is first copied into a temporary pinned buffer before transfer. Using pinned memory from the start removes that extra copy and also allows asynchronous transfers that overlap with CPU work.
That is not advisable. Too much pinned memory leaves less physical memory for the OS, and overall system performance can fall. It is kept to the areas used for transfers.
The way data moves differs. Pinned memory only fixes memory on the host side, and the program still issues the copies to the GPU. With unified memory, data migrates automatically in response to accesses.
As an Amazon Associate I earn from qualifying purchases.
This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.