For example if I write to a particular memory location (ex: DMA transfer) how does it get affected in my cache?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The cache is a CPU feature; if you write to memory via the CPU, the cache will be updated and will remain consistent.
If you write to memory some other way (e.g. a DMA transfer, as you suggest) you will need to (possibly) flush the cache beforehand, and then tell the CPU that the cache is invalid. How you do this depends on your system – for example see INVD and WBINVD for x86.
Two good articles to read on cache coherency and DMA are Understanding Caching and Using DMA (both by James Bottomley, published in Linux Journal; “Caching” in issue 117, January 2004 and “DMA” in issue 121, May 2004).