Posted By: Charles | Mar 27th @ 11:32 AM
Bertrand Meyer is a programming language guru, computer scientist and arguably the uncle of object oriented programming Smiley. Bertrand created the Eiffel programming language. Eiffel is an object-oriented language that is based on a fixed set of powerful principles like Design by Contract and Command-Query Separation. It's a very powerful language that has impacted the evolution of the more popular general purpose OO languages such as Java and C#.

With the arrival of multi-core and soon-to-arrive many-core chipsets concurrency and parallelism are top-of-mind for general purpose language designers these days. Bertrand has introduced the SCOOP model on top of Eiffel. SCOOP is a comprehensive effort to make concurrent and distributed programming simple and safe, taking advantages of Eiffel's object technology and Design by Contract.

General purpose programming language designer and passionate functional programmig advocate Erik Meijer leads the discussion in this addition of Expert to Expert. You all know Erik by now. He's one of our favorite technical celebrities. He and his small team of innovators continue to build great tools for software developers.

Very special guest star and famous mathematical logician Yuri Gurevich joins us for the first half of the conversation (He happened to be in Bertrand's office when we arrived - very lucky for us indeed! Smiley).

This is a long conversation that I hope you eenjoy as much as I do. Find yourself some quality time to listen and learn from this chat amongst some the world's finest programming thinkers.

Enjoy!

Low res file here.
Rating:
0
0
HOLY CRAP! I have to watch this!

“I don’t use the internet any more because they can steel every thing” in context that was a very funny comment.

Regarding the Sleeping Barber Algorithm and with out breaking the demonstration. Wouldn’t you want to have as many barbers as you have chairs?

jason818_253.33 wrote:


Regarding the Sleeping Barber Algorithm and with out breaking the demonstration. Wouldn’t you want to have as many barbers as you have chairs?



This does inspire some thought.

Basically, a chair will contain a customer, and a barber is required to do the work. This pretty much means that the number of chairs is the number of slots in the queue. The number of barbers will be determined by how many processor cores you have.

So pretty much, the more processor cores you have, the more barbers you can have. You ideally want one barber for each processor core. So, the more processor cores you have and therefore the more barbers you have, the faster you'll be able to cut the hair of all the customers in the chairs.

This analogy does make the problem sound simple.
jason818_253.33 wrote: 

Regarding the Sleeping Barber Algorithm and with out breaking the demonstration. Wouldn’t you want to have as many barbers as you have chairs?


CRPietschmann wrote:
This analogy does make the problem sound simple.


You've both misunderstood the crux of the Sleeping Barber problem. The problem is a problem not of speed or efficiency, but one of concurrency. The point is to serve the customers without experiencing process- (customer-) starvation or deadlock and the Sleeping Barber problem is a double-rendevous problem requring a more careful use of locks to achieve the correct result than you might think at first.
Wow. 2008 is shaping up to be the best year to date for video interviews on Channel 9! How are you guys going to top this? Smiley
dot_tom wrote:
Wow. 2008 is shaping up to be the best year to date for video interviews on Channel 9! How are you guys going to top this? Smiley


There have been both hits and misses. 2007 was not the best year for channel9 videos. But you are right 2008 looks very promising: more videos on language, tools and process (development methods like Agile). A video about the new work item types in Rosario would be great...
I enjoyed this. Thanks
Here is a CCR implementation of the Sleeping Barber(s).
Optionally, we can add barbers (threads).
As shown, this is actually a pretty clean pattern using Ports and lamdas and hides the locks and such in the runtime. User level locks on shared state could still be needed in the lambda.  So it is not something that has to be "baked" into a language itself as this works pretty clean as a library.

I really like a few of ideas in this video in general:
1) I like the ccr Port abstraction. For some reason I like endpoints and messages.
2) I like the idea of Pre and Post conditions. This could be added to c#. Think spec# has.
3) I like the idea explicit handling of Query and Command on shared state.  It allows tooling and static and runtime checks.
4) I like the idea un-named types like Tuples. c# has anonymous types, but you can't pass them around.
5) I love the idea of Transactions for object state and have them work with normal DB transactions for rollback.  That seems to be a winning pattern for handling shared state and something like CCR below for handling concurrency and coordination.

private void button20_Click(object sender, EventArgs e)
{
    // Have 1 Barber and N chairs. You can add Barbers (i.e. Threads in the pool) by changing the Dispatcher ctor.
    Port<string> chairsPort = new Port<string>();
    DispatcherQueue dq = new DispatcherQueue("Barber", new Dispatcher(1, "BarberPool"));
    Arbiter.Activate(dq, Arbiter.Receive(true, chairsPort, (string name) =>
        {
            Thread.Sleep(100); // Time to cut hair.
            Console.WriteLine("Customer {0} thanks the barber for the cut on thread {1}.", name, Thread.CurrentThread.ManagedThreadId);
        }));
    for (int i = 0; i < 15; i++)
        chairsPort.Post("Customer" + i);
}
Very interesting video - as all of these Going Deep's have been.

RE the Sleeping Barber: Why not just temporarily impart the knowledge and know-how of how to cut one's own hair to each customer that comes along with instructions to come back and report how it went?