SCOOP: Simple Concurrent Object Oriented Programming

栏目: IT技术 · 发布时间: 4年前

内容简介:SCOOP defines a way for an object oriented program to be written without the concept of threads, locks, or other typicalmultiprogramming methods. This allows the compiler or runtime environment to optimize the amount of concurrency as well as eliminate ty

SCOOP ( Simple Concurrent Object Oriented Programming ) is a concurrency model designed for the Eiffel programming language , conceived by Eiffel's creator and designer,Bertrand Meyer.

SCOOP defines a way for an object oriented program to be written without the concept of threads, locks, or other typicalmultiprogramming methods. This allows the compiler or runtime environment to optimize the amount of concurrency as well as eliminate typical design flaws such as deadlock.

The model was first designed in the early 1990s and published in 1993 in the Communications of the ACM An updated version was described in chapter 30 of the book Object-Oriented Software Construction .A prototype implementation was developed in 1995 byEiffel Software. An article by Compton and Walkerprovides an overview of SCOOP and describes another early implementation. Nienaltowski, Arslan and Meyer have published a description of the model as of 2003.Work on SCOOP proceeded at the Chair of Software Engineering atETH Zurich.SCOOP became available as a standard part ofEiffelStudio early in 2011.

Contents

Technical overview [ edit ]

SCOOP works by allowing references to certain objects to be declared as separate . In the code below, an entity local_inventory is declared as a separate type, by specifying the Eiffel language keyword separate in the declaration.

    local_inventory: separate INVENTORY

A separate object may be handled by a SCOOP processor that is different from the processor handling the referencing object. A SCOOP processor is the abstract notion of an autonomous thread of control that handles the execution of operations on one or more objects. SCOOP processors are independent of underlying concurrency mechanisms likeprocessor threads, multiple processor cores , and distributed computer systems .

In addition to the concept of separateness, SCOOP exploits the principles of design by contract as part of the SCOOP strategy for synchronizing access to shared separate resources. For example, aprecondition for a consumer wishing to access an item in the inventory example above, might be that such an item does currently exist. This would be expressed with a contract on the feature of class INVENTORY which returns the item.

    item: PRODUCT
        -- Current item
    require
        inventory_has_item: has_item

In traditional, sequential processing, a client intending to call local_inventory.item would be responsible for making certain that the precondition local_inventory.has_item holds before making the call. If the call to item were made in a state in which has_item did not hold, the caller would incur a precondition violation exception.

In the presence of SCOOP and given the separateness of local_inventory , making the check on has_item before calling item would not be reliable. This is because the state of local_inventory could have been changed by requests from other SCOOP processors between the time that the check was made and the time that item could be called.

As a result, when SCOOP is enabled, the precondition has_item is transformed from a correctness condition , which will cause an exception in the case of a violation, to a wait condition . The wait condition will cause the execution of item to be delayed until such time as has_item holds. In the Eiffel Software implementation, if SCOOP is not enabled, the separate keyword is ignored and sequential processing is assumed.

See also [ edit ]


以上所述就是小编给大家介绍的《SCOOP: Simple Concurrent Object Oriented Programming》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

支付战争

支付战争

埃里克•杰克逊 / 徐彬、王晓、清华大学五道口金融学院未央研究 审译 / 中信出版社 / 2015-5-19 / 49.00

这是一个野心勃勃的创业计划,在线支付鼻祖PayPal试图创造一个“统治世界”的金融操作系统,并在全球成功推广一款颠覆式的互联网产品。 《支付战争》的作者是“PayPal黑帮”成员之一,他真实还原了这个伟大产品是如何诞生的,以及在后来的发展壮大之路上,如何应对融资紧张、突破增长瓶颈,在竞争者凶猛围剿与平台商霸王条款的夹击下,逆境求生,改变业务模式,最终完成IPO,并成功出售给竞争对手eBay的......一起来看看 《支付战争》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换