Programmer profile: Asaf Shelly – Part 2

Yesterday, you met Asaf Shelly here, an Intel Black Belt and parallel programming expert. Here’s the second part of my interview with him. If you want to meet him in person, make sure you book your place at Intel’s free networking event in London on 12th May. You can read the first part of this interview here.

Softtalkblog: What programming models do you think will be particularly useful in future?

It looks like object oriented programming is here to stay but the old procedural model is still in use in firmware and driver development. The reason is that the object oriented model makes it harder to follow the tasks. There is a hybrid model in which a task is an object but this is only because we are used to working with objects. I believe that the top-level-design has to start with tasks and flow charts and only then can we derive the objects. Object oriented design has eliminated spaghetti code but invented a new problem which I call “spaghetti flow”. When one object is calling a method belonging to another object and that object is calling a method on the first object we have a potential problem. The problem is that if you look at the call-stack today you can see forty nested function calls crossing twenty different objects back and forth. If you have a buffer overrun it is almost impossible to track the spot and we end up with very mature systems generating ‘random bug’ exceptions. Borland C++ 5 is an example where the IDE had random bugs because it was designed using good object oriented methodologies. Current implementation of object oriented programming defines the stack as the state of execution which means that it is virtually impossible to track an operation originating with one thread and continuing on another. Here is something to inspire a discussion: Flaws Of Object Oriented Modeling.

Softtalkblog: What programming languages are you particularly interested in, and why?

I usually use C, C++ and C# because C\++ is the most powerful language as a developer and C# is powerful as a UI designer. It is also very simple to use interoperability between a C# application and a C\++ library which means that I can easily write a driver and a support user-mode library using common code, and compile the C\++ user-mode library with a .Net wrapper component all in the same solution under Visual Studio. I am mostly Windows oriented on the PC side since most of the market is there.

Softtalkblog: How do you see the future of programming tools?

We already know of trends to extend the existing languages with language extensions such as parallel loops and lambda expressions. This brings built-in support for thread-pools, queue management etc. Currently languages do not inherently support calls posted between threads and extended usage of AVX features and these require manual code. I expect either or both of these two outcomes: 1. Parallel infrastructure and libraries will allow higher level languages to completely ignore parallel processing. This is the case with ASP and web-servers, and SQL and database engines. 2. Just as C hides stack management from the programmer, a new language will hide the need to manage inter-thread calls and will force the relation between owner-thread, lock-object, and resource just as today C enforces the relation between resource and data-type.

Softtalkblog: You also train in parallel programming. What’s do you think is the most important thing you tell your students?

Parallel programming starts with the design. Don’t think serial and try to force it into parallel. Think parallel. Thinking parallel is simpler than thinking serial, we just need to undo some of the things we were taught and rewrite our minds. Not as easy as it sounds but it pays back on the first design whether you are using multiple cores or whether you are using just one. Real software design is parallel because the computer is responding to multiple events from multiple asynchronous sources. Most systems will hide this from us by using a single input queue to our application but this also ties our hands. The workaround is to use multiple threads or a thread-pool but it is not always required. Most times, unless you really need to burn CPU you can solve any problem using a single thread by letting the system do the work. A simple example is that instead of reading a file in a blocked thread we can use a callback (APC) to notify us when data is ready. Using this method for example we can cancel a pending IO operation when the user wishes to close the application instead of waiting for the device to bring back all the data before the application can be closed. Parallel programming is very easy we just need to flip the switch in our mind and let go of what we know. This is what’s really difficult.

Softtalkblog: What benefits have you seen from participating in the Intel Black Belt programme?

First and foremost the ability to reach many people. I took it upon myself to help people advance from serial programming to parallel computing. Intel has provided a platform through which I can reach the right people and spread the message. The recognition is a ‘stamp’ telling people that Intel thinks I might have interesting things to say. Microsoft has also stamped me ‘Technical Computing MVP’ (Windows HPC) which allowed me to present a session about parallel computing at the local TechEd and European TechEd events. Intel’s community is more focused on parallel computing and performance which allows me to dedicate myself to this area.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: