Uni-processor and Parallelization using Threads

It was a fine evening in IIT Kanpur. We 5 of us from Samsung Software India Center, Noida are here for a traning “Program Optimization for Multi-core Architecture”.

A small discussion has started on the use of threads (actually by using omp: for those who dont know about OpenMp, it is a set of processor directives to make your program parallel) and using them to parallelize the code already implemented on an Uni-Processor machine (asserting again: the disussion is on parallelization on Uni-Core and not on multi-core).

There were arguments and counter arguments saying that by using the threads you can speed up any of the serial (sequential program). In that discussion I was the only person to counter argue. I was strongly of the belief that, threads will be helpful to speedup your program if there are any I/0 happening in your program. If not sequential program is always faster than the thread programming.
The argument supporting this fact was the thread switching will always consume some processor cycles (may be more in the order of 4 to 100 micro secs.).

After some heated discussion we all agreed upon one thing. It can be formulated as “An 100% CPU intensive program cannot be speeded up just by parallelizing it given all other conditions like memory access latency, CPU speed for the sequential and parallel programs remains constant”.

It is one of the important observations when deciding whether to make the sequential programs parallel on an Uni-Processor environment. If the programs are roughly both IO and CPU intensive then they will be the ideal candidates to be implemented using threads (hence parallelize them).

Leave a Reply

Fill in your details below or click an icon to log in:

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

%d bloggers like this: