一种新的环形缓冲区设计与实现方法  被引量:2

A New Ring Buffer Design and Implementation Method

在线阅读下载全文

作  者:杨凯乔 YANG Kai-qiao(Department of Civil Engineering, CHANG’AN University of XINGHUA College, Xi’an 710077, China)

机构地区:[1]长安大学兴华学院土木工程系,陕西西安710077

出  处:《电脑知识与技术》2019年第3X期55-58,共4页Computer Knowledge and Technology

摘  要:针对环形缓冲区传统实现中判断"满"状态采用保留缓冲区元素或者引入缓冲区有效数据变量导致的缓冲区空间利用率较低问题,本文提出了一种新的不引入计数变量、不存在内存浪费的缓冲区实现方法,其核心思想是借助于读写索引之间的关系,使得读写索引一直递增而不清零,直到递增溢出后自动清零,该读写索引的差值就是缓冲区有效数据的个数。基于以上原理给出了不可覆盖和可覆盖环形缓冲区的实现过程,缓冲区"满"状态时,内存利用率为100%,并且仿真实验表明代码执行效率优于传统方法。According to problem involving in the ring buffer in the traditional implementation judgment "full" state with retaining an element without introducing cache data or effective number of variables makes utilization rate of the buffer space lower, a new the realization method of a new buffer is proposed in this paper without counter variables introduced and memory waste. The main ideas is based on the relationship between reading and writing index, the read-write index always increase until automatic reset when overflow. The number of valid data in buffer is read and write index difference. Based on the above principle gives the realiza. tion process for the ring buffer override or not override. The method of memory utilization rate is 100% when the buffer is in "full" state. The simulation experiment shows that the code execution efficiency is better than the traditional method.

关 键 词:环形缓冲区 嵌入式系统“ 满”状态 读写索引 

分 类 号:TP212.9[自动化与计算机技术—检测技术与自动化装置]

 

参考文献:

正在载入数据...

 

二级参考文献:

正在载入数据...

 

耦合文献:

正在载入数据...

 

引证文献:

正在载入数据...

 

二级引证文献:

正在载入数据...

 

同被引文献:

正在载入数据...

 

相关期刊文献:

正在载入数据...

相关的主题
相关的作者对象
相关的机构对象