Month: February 2015

The absence of side effects means that we can parallelize our software programs.

The technical term for memory areas that can be modified is mutable state. Erlang is a functional programming language and has immutable state.

If you use a conventional programming language such as C or Java to program a multicore CPU, then you will have to contend with the problem of shared memory.

In order not to corrupt shared memory, the memory has to be locked while it is accessed. Programs that access shared memory must not crash while they are manipulating the shared memory.

In Erlang, there is no mutable state, there is no shared memory, and there are no locks. This makes it easy to parallelize our programs.

jaerlang2_xlargecover.jpg
Programming Erlang (2nd edition)
by Joe Armstrong

Here are a number of very valuable tips that Chris (PGA Professional from Scotland) gave me during my golf lesson this morning. They worked so well that I will write them down now while they are fresh in my mind before I forget.

When addressing the ball:

  • Ball a bit more forward
  • Stance slightly open
  • Posture straight up (not slouched over)
  • Club face perpendicular and flat to the ground (not with heel)

When hitting the ball:

  • On back swing drag club as low as possible
  • Slide down through the ball from high and slightly outside
  • Snap wrists at last possible moment before ball impact
  • (Do not hit down on the ball but through it)
  • After impact continue swing inside and upwards
  • Complete with a high finish

All the code runs inside lightweight threads of execution (called processes) that are isolated and exchange information via messages.

Due to their lightweight nature, it is not uncommon to have hundreds of thousands of processes running concurrently in the same machine. Isolation allows processes to be garbage collected independently, reducing system-wide pauses, and using all machine resources as efficiently as possible (vertical scaling).

Processes are also able to communicate with other processes running on different machines in the same network. This provides the foundation for distribution, allowing developers to coordinate work across multiple nodes (horizontal scaling).

The unavoidable truth about software running in production is that things will go wrong. Even more when we take network, file systems and other third-party resources into account.

To cope with failures, it provides supervisors which describe how to restart parts of your system when things go awry, going back to a known initial state that is guaranteed to work.

elixir-logo.png

For a couple decades we have been able to take a free ride on the technological advances in speed and performance of improved hardware capabilities. First there was the 386, Pentium, Pentium 4, Dual-Core Titanium 2, and on and on. If your software was a bit slow at first, just wait a few months or maybe even weeks and the next generation of hardware will become so much faster that you won't have to worry any more about possible hiccups or performance dips.

However, this is changing faster than you realize so be careful. While this does not mean that Moore's Law is no longer valid, it does mean that the software we write will need to be concurrent in order to fully exploit CPU throughput of multi-core and distributed systems.

"If you haven't done so already, now is the time to take a hard look at the design of your application, determine what operations are CPU-sensitive now or are likely to become so soon, and identify how those places could benefit from concurrency. Now is also the time for you and your team to grok concurrent programming's requirements, pitfalls, styles, and idioms.."

"A few rare classes of applications are naturally parallelizable, but most aren't. Even when you know exactly where you're CPU-bound, you may well find it difficult to figure out how to parallelize those operations; all the most reason to start thinking about it now. Implicitly parallelizing compilers can help a little, but don't expect much; they can't do nearly as good a job of parallelizing your sequential program as you could do by turning it into an explicitly parallel and threaded version..."

"Thanks to continued cache growth and probably a few more incremental straight-line control flow optimizations, the free lunch will continue a little while longer; but starting today the buffet will only be serving that one entrée and that one dessert. The filet mignon of throughput gains is still on the menu, but now it costs extra--extra development effort, extra code complexity, and extra testing effort. The good news is that for many classes of applications the extra effort will be worthwhile, because concurrency will let them fully exploit the continuing exponential gains in processor throughput...

Taken from the article The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in Software by Herb Sutter.

"The reason for Tiger's fall is his ill-fated mythical quest for perfection..."

"There is a linear beauty to numbers that is simple and indisputable, and to someone as talented and as malleable and as addicted to perfection as Tiger, irresistible..."

"But the problem is, golf is not like that. It's not linear, it's abstract. It's not beautiful, it's messy."

"The mathematical-perfection trend in this game, which has Tiger by the throat and teachers in a tizzy, requires vigilant attention to swing mechanics, and that is not what this game is about. We need all of our sense to corroborate what we see and the imagination thrives on that information to help us create. That is the highest form of this game and is, perhaps above all else, what is beautiful about golf and sad about Tiger."

See: Woods' quest for perfection causing his downfall

For me golf is mostly mental and much less physical, meaning that a good player can overcome the bio-mechanical restrictions using the power of the mind. I am not only some mechanical contraption, there's a mind inside that thinks and plans and controls the future. Sure it's important to have a sound technical basis, but in the long run it is the mental game that will come through and lead to success. Just like in life.

winter_moon.jpg

During my evening walk with the dog, I was struck by how unusually beautiful and serene the moon appeared in the freezing cold winter night sky. I attempted to capture the scene by snapping a picture using my smartphone, but this fuzzy picture is all that I could manage. Use some extra imagination, look beyond the graininess, and you can sense the timeless moment.

Random entries

Here are some random entries that you might be interested in:

Recent Assets

  • jaerlang2_xlargecover.jpg
  • elixir-logo.png
  • winter_moon.jpg

Recent Comments

  • Long time no see: I remember them, as well. I remember Donald was my ...
    - Charles
  • Bridge to the moon: Yes it was a drawing and my older brother told me ...
    - jpmcfarlane
  • Bridge to the moon: Wow, that's quite a coincidence that we both sent ...
    - Kiffin
  • Bridge to the moon: Hello I was in my teens when Gemini 4 went up that ...
    - jpmcfarlane
  • Back to work: Congratulations Kiffin, I hope it is something you ...
    - KathleenC

Golf Handicap

Information

This personal weblog was started way back on July 21, 2001 which means that it is 7-21-2001 old.

So far this blog contains no less than 2498 entries and as many as 1877 comments.

Important events

Graduated from Stanford 6-5-1979 ago.

Kiffin Rockwell was shot down and killed 9-23-1916 ago.

Believe it or not but I am 10-11-1957 young.

First met Thea in Balestrand, Norway 6-14-1980 ago.

Began well-balanced and healthy life style 1-8-2013 ago.

My father passed away 10-20-2000 ago.

My mother passed away 3-27-2018 ago.

Started Gishtech 04-25-2016 ago.