Giter Club home page Giter Club logo

salon's Introduction

Soledad's Salon

有时间就更一更

salon's People

Contributors

zhangsoledad avatar

Stargazers

 avatar  avatar

Watchers

James Cloos avatar  avatar

salon's Issues

rust并发模型

引用Rob Pike的经典描述:

Concurrency is about dealing with lots of things at once.
Parallelism is about doing lots of things at once.

并发是同一时间应对(dealing with)多件事的能力;
并行是同一时间做(doing)多件事的能力;

并发编程的概念越来越广泛的收到关注,主要驱动力就在于如今我们正处于“多核危机”。CPU的单核性能一直没有重大的提升突破,目前CPU的发展模式变成了堆核和如何有效的堆核。

为了顺应这种趋势,并发编程也就越显重要。
8152114324

线程和锁
线程和锁模型是对底层硬件运行过程的形式化,

几乎所有的编程语言都对线程和锁提供了支持,rust也不例外,这种模型的优点在于非常简单直接,使用起来没有限制,但也是缺点所在,编程语言没有提供足够的帮助,使得程序容易出错,也要面临死锁的问题。

channel

Don't communicate by sharing memory; share memory by communicating

出了传统的锁之外,rust也提供了CSP模型的channel用于线程间通信。
缺失select。https://doc.rust-lang.org/stable/std/macro.select.html

原子类型 CAS
原子类型无锁, CAS,不会死锁,问题:swap 调用时,其他线程修改了原子变量的值,swap重试,swap必须无副作用。

https://aturon.github.io/blog/2015/08/27/epoch/
https://github.com/crossbeam-rs/crossbeam

线程 stack 保存挂起状态,linux 2MB,切换 数钱纳秒,还与stack 大小相关。

线程池 CPU密集,是线程复用。 IO型,堵塞。

事件驱动,future
https://docs.rs/futures/0.1.16/futures/
CPS变换
https://github.com/carllerche/tokio-serde-json/blob/master/src/lib.rs

https://github.com/alexcrichton/futures-await

coroutine
rust-lang/rust#43076

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.