首页> 外文会议>Joint Modular Languages Conference(JMLC 2006); 20060913-15; Oxford(GB) >Event-Based Programming Without Inversion of Control
【24h】

Event-Based Programming Without Inversion of Control

机译:基于事件的编程,无需反转控制

获取原文
获取原文并翻译 | 示例

摘要

Scala is different from other concurrent languages in that it contains no language support for concurrency beyond the standard thread model offered by the host environment. Instead of specialized language constructs we rely on Scala's general abstraction capabilities to define higher-level concurrency models. In such a way, we were able to define all essential operations of Erlang's actor-based process model in the Scala library. However, since Scala is implemented on the Java VM, we inherited some of the deficiencies of the host environment when it comes to concurrency, namely low maximum number of threads and high context-switch overhead. In this paper we have shown how to turn this weakness into a strength. By defining a new event-based model for actors, we could increase dramatically their efficiency and scalability. At the same time, we kept to a large extent the programming model of thread-based actors, which would not have been possible if we had switched to a traditional event-based architecture, because the latter causes an inversion of control. The techniques presented in this paper are a good showcase of the increased flexibility offered by library-based designs. It allowed us to quickly address problems with the previous thread-based actor model by developing a parallel class hierarchy for event-based actors. Today, the two approaches exist side by side. Thread-based actors are still useful since they allow returning from a receive operation. Event-based actors are more restrictive in the programming style they allow, but they are also more efficient. In future work we plan to extend the event-based actor implementation to other communication infrastructures. We are also in train of discovering new ways to compose these actors.
机译:Scala与其他并发语言的不同之处在于,除了主机环境提供的标准线程模型之外,Scala不包含对并发的语言支持。代替专用的语言构造,我们依靠Scala的常规抽象功能来定义更高级别的并发模型。通过这种方式,我们可以在Scala库中定义Erlang基于演员的过程模型的所有基本操作。但是,由于Scala是在Java VM上实现的,因此在并发方面,我们继承了主机环境的某些不足,即最大线程数少和上下文切换开销高。在本文中,我们展示了如何将这种弱点变成强项。通过为参与者定义新的基于事件的模型,我们可以大大提高其效率和可伸缩性。同时,我们在很大程度上保留了基于线程的参与者的编程模型,如果我们切换到传统的基于事件的体系结构,这是不可能的,因为后者会导致控制权的倒置。本文介绍的技术很好地展示了基于库的设计所提供的增加的灵活性。通过为基于事件的参与者开发并行的类层次结构,它使我们能够快速解决先前基于线程的参与者模型的问题。今天,这两种方法并存。基于线程的actor仍然有用,因为它们允许从接收操作返回。基于事件的参与者在允许的编程风格上有更多的限制,但它们也更有效率。在未来的工作中,我们计划将基于事件的参与者实现扩展到其他通信基础结构。我们也在探索构成这些演员的新方法。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号