Data writing method and device and electronic equipment

文档序号:1021366 发布日期:2020-10-27 浏览:19次 中文

阅读说明:本技术 数据写入方法、装置和电子设备 (Data writing method and device and electronic equipment ) 是由 付鹏 于 2020-04-17 设计创作,主要内容包括:本发明提供一种数据写入方法、装置和电子设备。数据写入方法包括以下步骤:获取待写入高速缓冲存储器的数据;提取所述数据中写操作未命中的未命中数据;若所述未命中数据为只写数据且所述未命中数据的写操作对应的写入地址首次写入数据,则将所述未命中数据写入高速缓冲存储器。这样,通过将未命中、对应的写入地址为首次写入数据且为只写数据的直接写入高速缓冲存储器,而不经过主存,能够减少对于主存的访问次数,从而提高数据写入效率。(The invention provides a data writing method and device and electronic equipment. The data writing method comprises the following steps: acquiring data to be written into a cache memory; extracting the missed data which is not hit by the write operation in the data; and if the missed data is write-only data and the data is written into the cache for the first time by the write address corresponding to the write operation of the missed data, writing the missed data into the cache. In this way, by directly writing the miss and the corresponding write address as the first write data and as the write-only data into the cache memory without passing through the main memory, the number of accesses to the main memory can be reduced, and the data write efficiency can be improved.)

1. A data writing method, comprising the steps of:

acquiring data to be written into a cache memory;

extracting the missed data which is not hit by the write operation in the data;

and if the missed data is write-only data and the data is written into the cache for the first time by the write address corresponding to the write operation of the missed data, writing the missed data into the cache.

2. The data writing method of claim 1, wherein the cache memory includes a plurality of rows of write addresses, and before the extracting of the missed data of the data that is missed by the write operation, further comprising:

and generating an indication mark corresponding to the write address of each row, wherein the indication mark is used for indicating whether the corresponding write address is the first write data.

3. The data writing method of claim 2, wherein the missed data is write-only data, comprising:

and the write address corresponding to the write operation of the missed data is data of a write-only address, wherein the write-only address is a write address which accords with a preset range of the cache memory.

4. The data writing method of claim 3, wherein said writing the missed data to a cache memory comprises:

and writing the missed data into a target address, and switching an indication identifier corresponding to the target address into corresponding non-first-time written data, wherein the target address is a written address in the write-only address.

5. The data writing method of claim 4, wherein after writing the missed data to cache, further comprising:

and if the write operation of all the missed data is completed, switching the indication identifier corresponding to the first write data in the indication identifiers of the write-only address into the indication identifier corresponding to the non-first write data.

6. The data writing method according to claim 5, wherein after the indication flag corresponding to the first-time written data in the indication flags of the write-only address is switched to correspond to the non-first-time written data, the method further comprises:

and extracting hit data hit by the write operation in the data to be written, and writing the hit data into the cache memory in a write-back mode.

7. The data writing method according to any one of claims 1 to 6, wherein after the extracting of the miss data that is not hit by the write operation in the data, further comprising:

and if the write operation of all the write-only data is completed, switching the indication identifier corresponding to the first write data in the indication identifiers of the write-only addresses into the corresponding non-first write data.

8. A data writing apparatus, comprising:

the acquisition module is used for acquiring data to be written into the cache memory;

the extraction module is used for extracting the missed data which is not hit by the write operation in the data;

and the writing module is used for writing the missed data into a cache if the missed data is write-only data and the data is written for the first time by a write address corresponding to the write operation of the missed data.

9. An electronic device, comprising a processor, a memory, and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the data writing method according to any one of claims 1 to 7.

10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the data writing method according to any one of claims 1 to 7.

15页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种存储设备访问方法、装置和系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类