Cache知识整理-Read-Allocate/Write-Allocate

1.CPU读Cache时:

●若hit,则CPU直接从Cache中读取数据即可。

●若miss,有两种处理方式:

Read through,即直接从内存中读取数据;

Read allocate,先把数据读取到Cache中,再从Cache中读数据。

2.CPU写Cache时:

●若hit,有两种处理方式:

>Write through:把数据同时写到Cache和内存中;

>Write back:先把数据写到Cache中,再通过flush方式写入到内存中。

●若miss,有两种处理方式:

>Write allocate:先把要写的数据载入到Cache中,写Cache,然后再通过flush方式写入到内存中;

>No write allocate:直接把要写的数据写入到内存中

一般,Write Allocate与Write Back一起使用,No Write Allocate与Write Through一起使用。

### FlsLoader_read Windows API Function Usage and Issues The `FlsLoader_Read` is not a standard documented function within the official Microsoft Windows API documentation, which suggests this might be either an internal or misnamed reference related to Fiber Local Storage (FLS) operations. For FLS-related functions, typically one would encounter APIs such as `FlsAlloc`, `FlsFree`, and `TlsGetValue`. However, assuming that there's some confusion with naming conventions here, let’s focus on how fiber local storage works in general[^1]. For resolving potential issues associated with what could possibly be referred to by "FlsLoader_read", installing updates like those mentioned can help address compatibility problems between different versions of system libraries used for thread-local or fiber-local data management. When dealing with any undocumented or less commonly known API calls: - Ensure all relevant patches are applied. - Review application behavior changes after updating components involved in threading models. - Consult community forums where developers share experiences about similar challenges faced when working outside well-documented areas of WinAPI. If encountering specific errors while using presumed functionalities around fibers/local storages, consider checking whether these apply only under certain conditions—such as running applications compiled against older SDK headers—or if they indicate broader bugs requiring attention from software maintainers. ```cpp // Example code showing typical use of TLS rather than hypothetical 'FlsLoader_read' DWORD tlsIndex; tlsIndex = TlsAlloc(); // Allocate index for thread-local variable if(tlsIndex != TLS_OUT_OF_INDEXES){ BOOL success = TlsSetValue(tlsIndex, &someData); // Set value at allocated index } ``` --related questions-- 1. How does Thread Local Storage differ from Fiber Local Storage? 2. What common pitfalls should programmers avoid when implementing custom storage mechanisms? 3. Can outdated development environments cause unexpected behaviors with newer OS features? 4. Are there alternative methods recommended over direct manipulation of low-level storage APIs?
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值