o**2 发帖数: 168 | 1 费了老大的劲才把FMP的介绍塞进了2000个字符里。大家帮忙挑挑毛病。
Fast Messenger Programming (FMP) is a new object-based model for general
concurrent programming with NO threads.
FMP elements:
• Active objects – a type of virtual objects that represent business
functions
• Messenger objects – act as virtual machines to host and realize
active objects
• Text-based names – for FMP entities
An active object is defined as an object with:
• A name
• A list of services – each has a name and can be viewed as a method,
function, or message port according to your preference
• A headcount – with built-in semantics of concurrency: it handles
requests independently and sequentially
• Optionally a group of independent headcounts – they share a pool of
incoming requests
• Accesses, through its hosting messenger, that are friendly to
mainstream programming styles including imperative, event-driven, flow-based
, etc.
1) Future m.callService ("calculator:multiply", m, n)
2) Void m.callServiceFor (callbackInfo, "calculator:multiply", m, n)
3) Void m.sendMessage ("calculator:multiply", m, n)
4) Void m.publishMessage ("sender:offer", m, n) // for dynamic routing
Format of fully qualified service names: "[MessengerName::]ActiveObjectName:
ServiceName"
Active objects are abstract and act as interfaces to their services. A
messenger binds user's impl objects, forwards them outside requests, offers
them a single-threaded context, and invokes them in various ways including
using reflection, as a listener, etc.
FMP benefits:
• Easy for callers – headcount concept and various programming styles
• Easy for impl objects – NO threads
• Unified model – FMP can be implemented on all OO languages and many
others like C – I have implemented FMP in Java & C# (shared-memory thread
model) and in JavaScript (dedicated-memory)
• No lock in – FMP impls are super simple and customizable – My Java
impl has only 900 lines
• Programming in the large – besides being virtual machines,
messengers can also be used as building blocks
FastMessenger.com | l*********s 发帖数: 5409 | |
|