2
50,000’ View: Sources of Concurrency
1. Active objects with async member function calls.
• active C c;
• c.f(); // these calls are nonblocking; each method
c.g(); // call automatically enqueues a message for c
• … // this code can execute in parallel with c.f() & c.g()
2. Async calls/work via active lambdas and futures.
  Think: “Writing and enqueueing a work item on the fly.”
• future<int> f1 = active { x.f()+Something() }; // single expression
• future<int> f2 = active {
  … // arbitrary
  return …; // code
};
• int i1 = f1.wait(), i2 = f2.wait();
3. Parallel loops and loop bodies.
• active for each( Employee e in emps ) { … } // chunk into work items
• for( i = v.begin(); i != v.end(); ++i ) active { // each iter is a work item
  …
}