简体   繁体   English

Python中的“Actor模型”和“Reactor模式”有什么区别?

[英]What's the difference betwee “Actor model” and “Reactor pattern” in Python?

https://en.wikipedia.org/wiki/Actor_model , the project is called " pulsar " https://en.wikipedia.org/wiki/Actor_model ,该项目被称为“ 脉冲星

https://en.wikipedia.org/wiki/Reactor_pattern , the projects are Twisted and Tornado https://en.wikipedia.org/wiki/Reactor_pattern ,项目是Twisted和Tornado

What's the difference in the theory and practice? 理论和实践有什么不同?

Twisted, tornado and pulsar all use an event loop (called reactor in twisted) to wait for events on file descriptors. Twisted,tornado和pulsar都使用事件循环 (称为twisted in twisted)来等待文件描述符上的事件。 In this respect, they are similar libraries and therefore can interoperate with each other. 在这方面,它们是类似的库,因此可以相互操作。

The actor model in pulsar refers to the parallel side of the asynchronous framework. 脉冲星中的actor模型指的是异步框架的并行端。 This is where pulsar differs from twisted for example. 例如,这就是脉冲星不同于扭曲的地方。 In pulsar each actor (think of a specialised thread or process) has its own event loop. 在脉冲星中,每个actor(想到专门的线程或进程)都有自己的事件循环。 In this way any actor can run its own asynchronous server for example. 这样,任何actor都可以运行自己的异步服务器。

More information about the actor implementation in pulsar here 关于脉冲星中演员实现的更多信息

http://quantmind.github.io/pulsar/design.html http://quantmind.github.io/pulsar/design.html

There's no difference. 没有区别。 "Actor model" is somewhat more ambiguous, but both terms are sufficiently general that they can apply to lots of different software with different characteristics outside their basic model. “演员模型”有点模棱两可,但这两个术语都足够通用,可以应用于许多不同的软件,这些软件在基本模型之外具有不同的特征。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM