Expert to Expert: Meijer and Chrysanthakopoulos - Concurrency, Coordination and the CCR
- Posted: Jan 16, 2009 at 12:56 PM
- 67,628 Views
- 29 Comments
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
Right click “Save as…”
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Oops, something didn't work.
What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in. You need to be signed in to Channel 9 to use this feature.What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in and view them all on your notifications page.sign up for email notifications?
I promise not to point my camera into a window again (sorry about that, but I did not want to stop the conversation to set up George on the other side of the room - just as George made the comment in this discussion thatconcurrency happens, so too do conversations and I hate to mess with the real time alchemy of my Channel 9 interviews...) and limit my dumb questions to just one or two!
C
Thank you.
C
I'd like to start up a discussion (on this thread) regarding two very interesting points brought up in this conversation:
1) Concurrency happens
2) Mash-Ups as a good conceptual model for programming coordinating systems (well, Mash-Ups that are able to communicate across constituent boundaries...)
I think these are very important concepts that deserve some more discussion and thought.
Coordinatingly,
C
george is awsome and he has a way to describe things that make all the alternatives seem stupid
i'll comment more on the points that you bring charles after ive watched the video but i generally think that concurency and cordination always happens and have happend for a long time, but we as mainstream programmers have only recently started paying attention to it
However - I've been fascinated by the CCR ever since it turned up as a topic on CHannel 9. Now, it seems to be oretty complete, and I thought this may be the time to try to change one of our server applications to use the CCR rather than using Threadpools etc.
Well - what's with the licensing? I don't want any robotics junk installed on my development-machine, still, I want to try out the CCR, so I found this page: http://www.microsoft.com/ccrdss/#GetIt
Am I supposed to spend $300 to TEST OUT the CCR in a clean environment? Come on...
And volume license...? We want to use this as a mechanism in a single server-app (on ONE server) for starters, there is no DSS involved.
Am I missing something?
Volume licensing will be available as well in the next month or so.
Great talk guys! Really hits the core of many things here.
1) Concurrency happens.
Having used the CCR, I understand what G. is saying here. Once your system is factored with ccr-"agents" this way and the message passing boundaries are defined with Ports, then your Agent "hides" and handles its own state - so it is more naturally composable in many respects. This is similar to what Eric has been saying with Functions. Functions can safely run in parallel because they are self contained and don't modify external state - they get an input and return an output. A CCR service does not have this strong of a contract. The programmer can make it unsafe, but if you follow some patterns, it makes it far more approachable to do things correctly. I think what he is saying is you *have to have coordination and correctness *first. Once you have that, concurrency can then happen correctly, because the model is correct. Then you can dump 1000 cores at it, and it does not matter, because your correct and scaling can just happen. That said, the model needs to raise another level of abstraction to make it Correct-by-Contruction because it is still too easy to do it wrong or just not "see" a race or a fifo logic error. But I think projects like Maestro are addressing this area with compiler/language to support the Model.
2) Mash-ups.
This is a good analogy for web devs. Other folks may find SOA or just Services a better analogy. I think Hue(?) from a WCF video said "Every object should be a service". He was right, the model has to change. I don't think we need every object a service, but we need to be able to draw a circle around N objects and define the service boundary. It makes it very clean because it does not matter if service is remote, in-proc, or out-of-proc. The model is the same in all cases.
3) Is it difficult?
IMO, I don't think it is. It is different, but don't think it any harder then hooking up events. You have to think about Joins and stuff, but you will end up doing that anyway using more difficult patterns (locks, Reset Events, etc). IMO, the Port abstraction makes it easier to reason about your services and makes the boundaries explicit and loose. I think the issue people may be having is not thinking about using CCR model as a Whole application model. They are thinking only about making a specific thing concurrent. When you do this, you end up trying to "wrap"/abstract the Port/Handler model instead of exposing it to other parts of your program. This means you can spend time doing the wrong thing - turning your async Port abstraction back into a sync method call - which is counter to the service idea. You need to embrase the Port abstraction in your Whole program. Make services and make it composable. You can then version easily, drop/restart services dynamically, Pipelining becomes easy, can also refactor services as needed on onto different machines.
4) Take it to the extreme.
Lets say in a new world, everything is surfaced as a ccr Port. Files are "Ports", serial Ports, usb Ports, keyboard Ports, Scanner Ports, video Port, the UI is a Port, etc.
Everything has a Port abstraction and you have *ONE model to program against everything and coordinate everything. That is a powerful model. And it is not sci-fi, you could do this today yourself with your own Port wrappers. Things like the Windows POS library should be Port based as well.
--William
it would be really awsome to see some more code showing these simple (for you guys at least) coodination scenarios with the ccr. like a simple wpf app that talks to a bunch of services, how would that be done with the ccr.. i think i remeber something like that from a ccr video from waaaay back but it'd be nice to have a refresh and also a few more ones like that
i think that would really help avg joe programmers like myself get into the ccr
great stuff as always charles
Once I understood the model, I did stop thinking about concurrency per-se, in the sense that I stopped worrying about threads and locks. I still have to worry about state, because its my responsibility to *not* schedule simultaneous writes to the same memory, but this scheduling is *much* easier to reason about than before. I suppose in this sense, I am thinking about coordination and not concurrency. Although I get rather nice core utilisation for 'free'.
Programmers unfamiliar with the CCR are often scared off by the perceived implications of a message-passing model. But the CCR's lightweight model is still very efficient, and whilst the straightline traditional model might be a few percent quicker, but I'll take the CCR most times because in the long-run I personally get a better overall result, not just in terms of performance, but also failure handling, robustness, scalability and clarity. And even if you just used it to introduce some asynchronous I/O into your app, you'd be amazed the difference that alone can make.
Interestingly, where you do still have to think about threads, locking, blocking etc, is around the boundaries where you are communicating with some non-compatible api/threading model, say COM, or WinForms/WPF. I don't know when (if ever) the user interface will move away from a model of thread-affinity, but on the client-side I think there's always a bit of a jarring switch between CCR and UI. It's doable but not entirely satisfying.
On the point of failure, as soon as you move to an asynchronous message-passing model, you pretty much can't assume
The final point I'd make is kind of related to mash-ups. While the asynchronous message-passing actor/agent model is a good approach for composing distributed systems from a 'temporal' perspective, from a functional perspective, surely mash-ups work because the operations you can perform against the various data sources (basically GET and POST) are relatively simple, uniform in their behaviour and well understood. Some are even actually RESTful
Nick.
Keep the feedback coming!
C
http://www.microsoft.com/winme/0703/29490/Visual_Programming_Language_(VPL)_1/Local/index.html">http://www.microsoft.com/winme/0703/29490/Visual_Programming_Language_(VPL)_1/Local/index.html
Andreas may have not even noticed it. In the TextToSpeech VPL sample (last example), it started at "2" and number "1" came between 9 and 10. This is a Port race as the port really needs to process fifo in this case. Can someone please explain how to fix that using VPL in the activity? Thanks much.
Awesome interview!...
I've been working on a framework based on the same coordination principles. It allows me to run computer vision, 3d rendering, physics and sound, in separate cores and not having to worry about state sharing...
You can see a couple of resulting videos here:
http://www.youtube.com/watch?v=SJLTskfbY8s
http://www.youtube.com/watch?v=Sw5N32xGRaw
C
Will the Robotic Developer Studio 2008 by available with a MSDN subscription? We can download versions 1.0 and 1.5 now.
More please on applicaiton models. Please!
And mp4 impossible to watch over 3G network. Would be nice to lower bitrate a bit or to make mobile versions of talks.
Thanks.
C
While I think this is a very important part of engineering well coordinated system, and pretty much any system, in general, the long term play is to remove the need for managing exceptions in code, in the same vein as the declarative programming push for LINQ or other features focused on raising the level of abstraction. As George stated in the video, robots have a very apparent failure result, they just fall off a cliff or fail to complete thier task. It's the "Live" lock scenarios that have become so numerous and pervasive as a result of poor software composability. Microsoft is definitely on the right track in addresing this in basically all areas of development right now by trying to raise the level of abstraction above the ground, where an updated concurrency model (or any update) can be applied without disturbing the "Eloi". On the flip side, "Morlocks" want to move between both worlds if necessary (Anders talks about this alot), but the default experience should be (arguably) one of a declaritive nature when it comes to writing programs. The entrepreneur is not concerned about a stack trace, just how to actualize the idea. I actually fall on the other side. I want to see all the dirty little details.
I really enjoyed this video, mainly because of George's passion for this subject. I was amazed to hear that writing games or doing robots was a preferred instructional path because of the way it teaches you fundamentals of concurrency and how to think in these terms. It makes sense, and it made me open my mind a bit more. I should go pick a MS robotics kit and some Legos, all kidding aside.
Remove this comment
Remove this thread
close