OpenMP, Parallel Programming in C [Intro]

This is a post in which you will get the basic knowledge about the parallel programming concept. In this post we going to use the OpenMP model. This program is implemented in the C Language. Basically this programs demonstrates how the thread gets executed in different Cores of the processor. In this case, this program is executed in a Quad Core CPU, so it displays 4 threads from 0-3.


Here the threads are executed randomly on each cores on the basics of their availability. This method by which threads get their processor can be known in detail by googling about ready queue.

The Code:

int main()
int x;
#pragma omp parallel
printf("Thread Is running at %dth processorn",x);
return 0;

Got Suggestions?
Comment them here !

Catch Me On

Bikash Panda

Blogger / Embedded System Developer at WGLabz
A techie, tinkerer and tech lover, who loves to blog and feels everyone can learn tech provided they have the right attitude towards learning and passion. By profession, I am an IOT developer working in Smart Home/ Smart Grid domain.
Bikash Panda
Catch Me On

Latest posts by Bikash Panda (see all)

Related posts