Giter Site home page Giter Site logo

skyformat99 / ring-buffer-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from home-coder/ring-buffer

0.0 1.0 0.0 391 KB

Ring Buffer, 循环缓冲区的编写和测试,标准kfifo和POSIX的ring buffer.并使用/dev/mem代替实际物理设备来实现mmap方式数据读取

Makefile 15.90% C 84.10%

ring-buffer-1's Introduction

ring-buffer

1.最终参考下面通过时间 构造测试数据,首先测试kfifo性能 http://www.cnblogs.com/Anker/p/3481373.html

2.结合mmap函数,将mmap出来的数据当做测试数据,来测试kfifo的性能 注意mmap对应块设备如磁盘 USB等,但是不能对应流设备如串口等 另外参数length的长度必须是4096 的整数倍

目前已通过helper目录下测试代码,测试mmap的使用,并使用内存设备直接代替具体的物理设备如dongle等。

下面就可以通过把helper的代码集成到test.c中就可以完全实现kfifo与mmap的综合应用了

未解决问题: 1.为什么要用环形缓冲区kfifo 2.内核数据写入,与mmap后的用户空间取走这个buffer的数据如何同步 3.内核模块的地址如何在用户空间操作

《针对上面的问题,如下思考》 经过x86测试,得知写入数据大于ringbuffer给出的最大尺寸4096后,剩余的数据虽然走kfifo_put方法,但是数据并没有写入或者覆盖掉起始处的buffer,导致数据丢失, 所有后续 需要针对这个问题进行判断:如果缓冲区满了就等待,当读者将数据取走腾出空间了,写者再写入。这样写线程可以让出cpu,让他在这个等待间隙做其它的事情。 当然我的测试方法是写者很快,而读者很慢的情景

测试: 需要针对helper中的生产者消费者 模型熟练掌握以后,在将kfifo的项目代码改编成包含这种模式的,目的是解决上面的问题 《针对上面的问题,如下思考》。

ring-buffer-1's People

Contributors

home-coder avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.