Orc is ...
... a novel language for distributed and concurrent programming which provides uniform access to computational services, including distributed communication and data manipulation, through sites. Using four simple concurrency primitives, the programmer orchestrates the invocation of sites to achieve a goal, while managing timeouts, priorities, and failures.
Orc 2.1.2 is available for download (release notes)
What can I use Orc for?
-
As a general purpose programming language for concise encoding of
concurrent and distributed applications. See a
probabilistic solution
to the dining philosophers problem, or try out some simple programs
that combine concurrency and synchronization with fault-tolerance and time-out.
hide this demo
{- Dining Philosophers. Based on the randomized algorithm given in: Lehmann, D. J., Rabin M. O. On the Advantages of Free Choice: A Symmetric and Fully Distributed Solution to the Dining Philosophers Problem. Principles Of Programming Languages 1981 (POPL'81), pages 133-138. -} -- Randomly swap two elements def shuffle(a,b) = if (Random(2) = 1) then (a,b) else (b,a) -- Acquire two forks in the order given def take((a,b)) = a.acquire() >> b.acquireD() ; a.release() >> take(shuffle(a,b)) -- Release two forks def drop(a,b) = (a.release(), b.release()) >> signal -- Start a philosopher process with forks a and b def phil(a,b,name) = def thinking() = Rwait(Random(1000)) def hungry() = take((a,b)) def eating() = Println(name + " is eating.") >> Rwait(Random(1000)) >> Println(name + " has finished eating.") >> drop(a,b) thinking() >> hungry() >> eating() >> phil(a,b,name) -- Start n philosophers dining in a ring def dining(n) = val forks = Table(n, lambda(_) = Semaphore(1)) def phils(0) = stop def phils(i) = phil(forks(i%n), forks(i-1), "Philosopher " + i) | phils(i-1) phils(n) -- Simulate 5 philosophers for 10 seconds before halting Let( dining(5) | Rwait(10000) ) >> Println("Simulation stopped.") >> stop
-
As a web scripting language to create a web-service mashup in a few
minutes. Orc's emphasis on concurrency makes mashups much simpler to write than in
other scripting languages. See a simple search mashup that starts a Bing search
and a Google search simultaneously and prints the first set of responses. You can
create your own mashup here.
hide this demo
include "search.inc" each(results) <results< Prompt("Search for:") >term> ( Bing(term) | Google(term) )
- As an executable specification language for workflow applications and process coordination problems. Read about how Orc can represent many common workflow patterns
Read more about the ideas behind Orc, or dive in to Orc in 15 minutes.