F# Introduction to parallelization

Posted on Posted in F#, Lead Story, Parallelization, Programming

This is new topic on the net these days, as to come up with trend like us discuss about parallelization in F#. F# is computer programming language that is build onto top of the concurrency in a functional language. This means that to complete a task is the most important priority, internally what does the computer does to complete the tasks in not as important as getting the job done, therefore if you declare it to run in a concurrency manner it will just do just that. You will not do like in C# create a ThreadJob and Thread object, then use the ThreadStart() method to invoke the process. In f# you will be using Async.Run and Async.Parallel to process the job, which is focus on Asynchronous Workflows to complete the job. The main difference are that F# Async class and C# Thread class are input with only sequence job when F# can pass through with a parallel of sequence tasks (see that I use task because that it can be difference jobs too).  I’m not saying that C# cannot do parallel of difference jobs, but it not in the foundation of the thread class in C# (I’ll not be talking about it this here). I’ll be covering the topic on using F# Asynchronous Workflows in later post, therefore keep back folks.

Why are you here anyway, it’s because that computer are advancing into multi-concurrency or multi-processing units (cores). Old method of programming the computer does not make the software run faster, this because of that old method are ideal from sequence thinking, but concurrency is about distributing task to many processers and executing them in parallel.

Parallel in the computer world are call multi-threading, which are divide into “thread of execution”. Before computer are run in single thread environment operating system, this is because the processer is a single core processer. Processing threads are switch when resource are available to the operating system, therefore this environment you are using multi-thread programming method would actually slow down the entire execution of the task. This because you will need to prepare the thread introduction to the CPU for the process to be able to begin executing, and then switch to another thread to process. If you have multi-core (or processer, different thing), you can submit a task to one core and then submit a new task to another core while the first core is still processing the first task, and the second is receiving the second task.