Code Monkey home page Code Monkey logo

learn_from_ceph's Introduction

learn_from_ceph

some code snippets from ceph

1. simulation_crush_algorithm.cc

这是从Ceph中提取出来的crush straw算法. 对增加/减少OSD的情景进行了模拟.

hash函数,表查找:http://burtleburtle.net/bob/hash/evahash.html

2. ThreadPool.cc/ThreadPool.h

工作队列和线程池 将任务推入工作队列,而线程中的线程负责从工作队列中取出任务进行处理.
工作队列和线程池的关系:
工作队列中保存任务,线程池从工作队列中领取任务并完成.正是因为有了任务,才需要雇佣线程来完成任务. 没有了任务,线程也就失去了意义.两者紧密相关,也正是因为关系密切,在ceph中,两者的代码都位于WorkQueue.cc和WorkQueue.h,
此处是将ceph线程池以及工作队列的代码提取出来
tp_test.cc是线程池的试验测试代码

To build tp_test.cc: g++ ThreadPool.cc ThreadPool_test.cc -o tp_test -lpthread -std=c++11

With boost::function (install boost lib firstly) g++ ThreadPool.cc ThreadPool_test.cc -o tp_test -I /usr/local/include -L /usr/local/lib -lpthread -std=c++11

3. callback_class_function.cc

一个demo用于研究ceph中的回调机制。

learn_from_ceph's People

Contributors

cspaac avatar

Watchers

 avatar  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.