Computer Science Canada Erlang-Scala Challenge: The Actor program. |
Author: | rizzix [ Fri May 30, 2008 5:24 pm ] |
Post subject: | Erlang-Scala Challenge: The Actor program. |
Here's a simple challenge to get the folks of compsci.ca familiar with the Erlang-Scala style of concurrency. Make a small little program that makes use of the Actor (message-passing) model. The program may either demonstrate this as a multi-threaded application or as a network application. You may use any language of choice that supports the Actor model. What's expected:
The award: 600 bits for the best submission. P.S: If the Actor model is not new to you, that's fine, you may still participate. However please do mention that when you submit your code. |
Author: | btiffin [ Mon Jun 02, 2008 1:18 pm ] | ||||
Post subject: | Re: Erlang-Scala Challenge: The Actor program. | ||||
Sorry, I couldn't let this challenge go unanswered. This is not a true Erlang concurrency solution. It is a contrived Icon co-expression as coroutine example to see if I can prompt others here to try and pick up some Actor Model experience. Yes I knew about the Actor Model before writing this simple (and as it is contrived - inefficient use of the powers of Icon). Icon co-expressions predate Erlang. So this can be used to implement an Actor Model, but it isn't natively Actor.
Which with trace on, produces;
Posted solely to hopefully pique some curiosity in rizzix's challenge. The Actor Model of computing is a good thing to know. And FYI; this Icon program is NOT Actor as requested by rizzix (e.g. this is concurrent - but not threads as everyone here would probably know them as), this is more an old guy's attempt to prod. ![]() Cheers |
Author: | apomb [ Mon Jun 02, 2008 3:21 pm ] |
Post subject: | RE:Erlang-Scala Challenge: The Actor program. |
Seems as though multi-threaded apps, though necessary are just not as interest-inducing as one might hope. I, for one wouldnt know the first thing about writing a multi-threaded application, let alone this actor model. However, i would be interested in seeing people's submissions. |
Author: | rizzix [ Mon Jun 02, 2008 4:00 pm ] |
Post subject: | RE:Erlang-Scala Challenge: The Actor program. |
Its not that concurrent applications are not interesting. Its simply that most people do not know how to make use of concurrency, effectively. The fact is you can write a lot of different kinds of useful programs without making use of any concurrency. The truth is, you haven't explored the possibilities of using concurrency in adequate detail. |
Author: | rizzix [ Mon Jun 02, 2008 5:23 pm ] | ||
Post subject: | RE:Erlang-Scala Challenge: The Actor program. | ||
Here's a trivial example in Scala:
Edit: Modified example to demonstrate terminating code. |
Author: | btiffin [ Tue Jun 03, 2008 3:09 am ] |
Post subject: | Re: Erlang-Scala Challenge: The Actor program. |
I was pretty lucky through most of my career. polyFORTH has had built in multi tasking since ... forever. A round robin multitasker where a task switch was as easy as one assembler instruction. SLEEP would effect the jump address of the task STATUS so that it jumped to the next task in sequence, WAKE would plop the address of the currently executing code field address (stashed away as the address following the SLEEP instruction or an interrupt vector. Pretty cool. apomb; you may need to know this someday, but we encountered a tricky bug on our VAX/6000 series machines. It turns out the VIC (virtual instruction cache) was not good at detecting changes to the instruction steam so each SLEEP had to be followed by a REI instruction sequence. Two instructions; fake an interrupt and set the return address to the address following for the REI. Took us many days to track that one down. Once or twice a week a task would run past SLEEP. Freaked us out. ![]() Everyone else; Get into rizzix's challenge if you can afford to. It'll be good for you. ![]() Cheers |
Author: | apomb [ Tue Jun 03, 2008 8:32 am ] |
Post subject: | RE:Erlang-Scala Challenge: The Actor program. |
well btiffin, i dont exactly plan on becoming a programmer, im more interested in the hardware design side. However, that doesnt mean i will not continue learning certain programming paradigms. I am always interested to see what the hardcore programmers come up with in terms of cutting edge code and this seems to be it. Now only if more people were interested in it, you might have something going. |
Author: | btiffin [ Tue Jun 03, 2008 10:50 am ] |
Post subject: | RE:Erlang-Scala Challenge: The Actor program. |
Ahh, well then; perhaps you'll be the one that figures out a smart cache that can detect modifications to the instruction stream. And keeping in the spirit of the thread; concurrency is an area where performance can be critical and self modifying code space can be an excellent, simple and highly efficient way of task switching (then of course your design will not only have to detect the changes to cached memory, but also verify that the change isn't some badguy viral code - I'll leave that problem in your capable hands). ![]() Cheers |