Wednesday, August 29, 2012

Meet the Author: Dr. Joe Hummel on Async and Parallel ...

In today?s Meet the the Author podcast, Mike Woodring sits down with Dr. Joe Hummel to discuss his course Async and Parallel Programming: ?Application Design. ?In the interview Joe gives us a brief insight into his favorite pastime, and then discusses how this course extends on the information from his previous course Introduction to Async and Parallel Programming in .NET 4. ?He then describes the difference between Async and Parallel programming as well as some of the inherent dangers in this model of coding.

[Mike] Hello. This is Mike Woodring with another Pluralsight author interview. Today we?re talking with Dr. Joe Hummel about his course Async and Parallel Programming Application Design. Joe focuses on high performance computing and .NET languages. He is well versed in Microsoft?s High Performance Computing and Parallel Programming Initiatives, Web and desktop application technologies and a variety of programming languages including C++, C#, F# and VB. Dr. Hummel, or Dr. Joe as we like to call him, is a tenured professor of computer science and has numerous research publications in the fields of compiler optimization and computer science education. He has also coauthored two books on Windows Development and has taught online and in corporate training centers and in company?s around the world. Hello, Joe, it?s good to have you with us today.

[Dr. Joe] Hey Mike, it?s great to be here. Thank you.

[Mike] Now I know you really like to sail so before we dive into the technical discussion I want to take a moment to live vicariously through you, if that?s okay. Please tell us about your most recent sailing trip, or should I say voyage?

[Dr. Joe] Thanks, Mike. Yeah, that?s a good way to start. Yeah, I was very fortunate, about a few weeks ago, a month ago, I helped a friend sail from New York City to Portugal, which is about 2,000 miles, actually to the Azores Island chain off Portugal. At sea for about two weeks, no email, just hanging out with my friends and eating good food. It was a great trip. The only issue was the first few days of seasickness as I got used to the Atlantic Ocean. So that was a little rough to start but after that it was fantastic, thanks.

[Mike] Oh well living in a land locked state as I do, that sounds fantastic. Thanks for sharing that with us. Okay so your new course is entitled Async and Parallel Programming Application Design. Can you summarize the goals of the course?

[Dr. Joe] You know it?s important to understand this new course is really part two of a sequence so the first course entitled Introduction to Asynchronous and Parallel Programming in .NET 4, the first course introduces the notion of concurrency, motivates why you might want to run operations concurrently and demonstrates how you can do this using the Task Parallel Library and .NET4. Now this new course builds upon that first course to discuss how to design applications for concurrency, what types of parallelism you?re likely to encounter, patterns for exploiting these types of parallelism, some of the dangers to look out for when designing concurrent software and various solutions to these dangers. I also discussed .NETs execution model in much more detail, which is something that?s very important to understand when you design parallel applications from the ground up. And I think when you?re done viewing both of these courses you?ll have the tools you need to design and build safe, efficient parallel programs.

[Mike] Excellent. Now the course title includes both the words asynchronous and parallel, which implies that there?s a difference between the two. Both imply concurrent execution of some sort so what exactly is the difference?

[Dr. Joe] Yeah thanks, that?s actually a subtle but very important distinction so the difference necessarily isn?t that important but I thought it better to err on the side of sort of completeness and giving people an accurate picture of the field and so I try to be very clear in the courses about these two terms, asynchronous versus parallel. So suppose you had two operations, A and B, that you want to execute concurrently. Now if you execute these operations, A and B, asynchronously this implies that the computer may execute them on a single CPU by doing a little bit of A and then actually switching over and executing a little bit of B and then switching back and doing a little more of A and then switching back and doing a little bit more of B and then back and forth, back and forth, back and forth. Now this happens so fast that it appears they?re executing at the same time. But in reality they?re not. They?re executing on a single CPU and so that?s what we mean by executing asynchronously and they share the CPU. You know 10 or more years ago this is how basically all the computers executed things, the operating system would basically just rapidly switch between all the running programs. And the common example of this today are UI based applications where you know the user clicks a button and then when they do that it initiates some long running operation like a search of the web or a simulation for financials. And we don?t want the UI to lock up while we wait for that operation to complete so we designed the application so that the UI operation runs asynchronously with the background operation so the user can continue to interact or watch progress while the operation runs in the background. As you?ll probably guess the term parallel is used to convey the fact that two operations run simultaneously, physically at the same time. Now to do this you need a multi-core hardware or physically multiple CPU?s and the machine and that?s, as we all know, pretty common today, almost all machines and even our phones and tablets are multi-core and that?s what enables true parallel programming. And you see this today with people playing music while they?re reading email while they?re downloading, you know, the next beta Visual Studio and so on and so forth.

[Mike] Right, right, very good. Okay so your course actually opens with a module on the dangers of concurrency. What do you mean by that?

[Dr. Joe] Yes, I wanted to be realistic in that it?s not all a happy, pretty picture. You know if you get into this style of application development and programming, you have to be very aware that there?s some risk to doing this and be focused on doing it safely and correctly. And one of the things that?s really interesting I think about computer science right now is that the tools we use, the compilers and the hardware we run on, they?re very much still in the sequential mindset so for example the C++ compilers and the C# compilers, they still optimize our programs but they make those decisions based on a sequential program. They don?t view the program as doing things in parallel but doing it sort of one thing after another sequentially. And these decisions now, if you start writing parallel programs, the compiler then starts optimizing and potentially can slow down or worse even break your program so that it?s now incorrect. So there?s sort of this tension between we?re trying to write parallel programs but some of the tools and hardware are still living in the old world and what they?re doing doesn?t you know sort of blend well with what we?re trying to do in parallel. So for example there?s this keyword in C++ and C# called volatile and this was like sort of a quick hack but a very ineffective solution to tell the compiler, hey, we?re doing something in parallel so don?t break my program when you optimize it. And the volatile keyword just never did work very well so there is some sort of catch up that has to happen with our tools to catch up with where we are in the field which is trying to write effective parallel programs. And the hardware has the same thing, hardware, I don?t know if people know that the chips, the CPU?s, we order our instructions, they?re doing all sorts of things underneath to make the programs run faster. But again from a sequential perspective, and when you do things in parallel across multiple cores or CPU?s, what the hardware is doing and what we?re doing in our programs, there?s again this tension and you have to understand that tension in order to do it safely and correctly. And so that?s one of the things that?s really important I think about using libraries like the Task Parallel Libary is that the people who build these libraries understand the tension between the parallel world and the sequential world and they hide these subtleties from us so that we can work at a high level and work at that level safely. And not have to know all this really nitty, gritty stuff about compilers and hardware execution to do it correctly.

[Mike] Excellent. So your course then it concludes with a module on design patterns for parallel programming, which I was very excited to see personally. Tell us a little bit more about the kind of guidance you offer in that module.

[Dr. Joe] Yeah, thanks, Mike, I like how the course ends, the second course ends with a discussion of patterns. Patterns, as we all know, are a great way to provide sort of high level guidance as folks design applications or pieces of their application and the module hits upon a number of important patterns, for example producer consumer is a good one. This is a pattern that you should use or at least consider when you have parallel operations operating at different speeds. And a good example is a web server where you have requests coming in and responses going out but the requests could be coming in fast or slow, the responses could be quick or very time consuming and so that you know how do you deal with those different speeds? And so the producer consumer is a great way to approach that style of problem. Another very important pattern that probably everyone has heard of is MapReduce, which is the technology behind search engines like Bing and Google. This is a great pattern to use with embarrassingly parallel data operations. And so the course we?ll get into what is embarrassing parallel? What is data parallelism? And so how would I know when to use things like MapReduce? And then we get into other patterns like the APM, asynchronous programming model pattern which is a good one for responsive IO or responsive user interfaces. And we talk about parallel Linq or P-Linq and then others as well so I like how the course ends. Thanks, I?m glad you approved.

[Mike] Yeah, well it was awesome. So well you know thank you very much, Joe, for taking the time to speak with us today. I really appreciate it.

[Dr. Joe] Great, thank you, Mike. It was a pleasure to be here and I hope listeners out there get a chance to hear the course and hope they learn something from it. Thank you.

[Mike] Again this is Dr. Joe Hummel?s new course, Async and Parallel Programming Application Design. Thanks again, Joe.

[Dr. Joe] Thanks, Mike.

Source: http://blog.pluralsight.com/2012/08/28/meet-the-author-dr-joe-hummel-on-async-and-parallel-programming-application-design/

deliverance pentatonix nicki minaj barbie doll nicki minaj barbie doll black dahlia drew drew

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.