Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

Thread concept

muthucrazy
Beginner
679 Views
Hi all,
Theoritically i understood two or 'N' threads are run parrallely. but in embeeded system how it would be. however threads should share the cpu time by means of some algorithms like roundrobin,FIFO,Shortest jobfirst,preemptive.so seems like noparallelism. if one thread finishes the allocated cpu time another thread will execute then where is the concurrent concepts arises.
similarly threads are nothing but a task,if a thread executes it will be in RUN state. another recently arrived thread would be in ready state, if a thread present in RUN state finishes it work,whatever task present in the ready state now pushed in to running state so it will execute. so no threads are run parrally?
Pls clear my doubts.
Regards
Muthazhagan
0 Kudos
5 Replies
jimdempseyatthecove
Honored Contributor III
679 Views
A Processor is generally described as a package (with pins on the bottom)

A Processor may contain one or more dies (silicon chips affixed into the processor package)

Each die may contain one or more Cores (e.g. Dual Core Processors)

Each Core may contain one or more hardware threads.

Each hardware thread "looks like" a dedicated processor.

An embedded system can be as restrictive as:

1 processor package with
1 die with
1 core, eachwith
1 hardware thread

In the above, you historicallywould call it "a processor"

Consider an embedded system with an Intel Atom Dual-Core processor wiht HyperThreading

1 processor package with
1 die with
2Cores, each with
2 hardware threads

In the above, you have one processor that looks like 4 processors (also called 4 logical processors)


A single logical processor, single die, single core, single thread system can still support multiple threads in a time-sliced manner(what you describe). But this technique is being replaced by a more capable processor (more hardware threads).

Jim Dempsey
0 Kudos
abdulahad1985
Beginner
679 Views
May be this lik will be of some help to you
0 Kudos
Maycon_Oliveira
Beginner
679 Views
Is it possible create one block of code, that create two thread and each thread run on each core of the processor?

Att.
Maycon
0 Kudos
jimdempseyatthecove
Honored Contributor III
679 Views
Sure

In C/C++ using OpenMP

#pragma omp parallel for
for(int i=0; i < n; ++i)
{
// each thread enters here with different subset of iteration space
}

Or

#pragma omp parallel
{
// all threads enter here
}

You should read documentation on OpenMP as there are programming issues and means to resolve these issues. The principal among these are data sharing issues. Look at SHARED(...) and PRIVATE(...) clauses for OpenMP statements.

Jim Dempsey
0 Kudos
Reply