answersLogoWhite

0

A real example of parallel execution of sequential programs in a multi-core architecture might be the addition of two matrices...

double a[1000,1000];

double b[1000,1000];

double c[1000,1000];

int i, j;

for (i=0; i<1000; i++) for (j=0; j<1000; j++) c[i,j] = a[i,j] + b[i,j];

...Since each of these 1000000 additions are independent of each other, they could easily be dispatched to multiple threads and run on multiple cores...

for (i1=0; i1<1000; i1+=4) for (j1=0; j1<1000; j1+=4) c[i1,j1] = a[i1,j1] + b[i1,j1];

for (i2=1; i2<1000; i2+=4) for (j2=0; j2<1000; j2+=4) c[i2,j2] = a[i2,j2] + b[i2,j2];

for (i3=2; i3<1000; i3+=4) for (j3=0; j3<1000; j3+=4) c[i3,j3] = a[i3,j3] + b[i3,j3];

for (i4=3; i4<1000; i4+=4) for (j4=0; j4<1000; j4+=4) c[i4,j4] = a[i4,j4] + b[i4,j4];

...with each for loop running in its own thread/core. In fact, most modern optimizing compilers, at the higher optimzation levels, is quite capable of doing this on its own, because they analyze the code and break apart things that can run in different threads automatically.

User Avatar

Wiki User

15y ago

What else can I help you with?

Continue Learning about Engineering

What is serial execution?

Serial execution is when tasks are completed consecutively (one after the other), as opposed to concurrently (at the same time, in parallel).


Can you use a sequential search on an unsorted array?

Sequential search is the only way to search an unsorted array unless you resort to a multi-threaded parallel search where all threads concurrently search a portion of the array sequentially.


What are the applications of sequential code?

Sequential code is primarily used in programming for tasks that require operations to be executed in a specific order, such as data processing, algorithm implementation, and scripting. It is commonly applied in applications like data analysis, automation scripts, and simple software development where control flow is linear. Additionally, sequential code is foundational in teaching programming concepts, as it helps beginners understand logic and flow before moving on to more complex paradigms like parallel or concurrent programming.


Explain the major difference between combinatorial logic and sequential logic?

It was mentioned that there are two different ways to connect two or more electrical devices together in a circuit. They can be connected by means of series connections or by means of parallel connections. When all the devices in a circuit are connected by series connections, then the circuit is referred to as a series circuit. When all the devices in a circuit are connected by parallel connections, then the circuit is referred to as a parallel circuit. A third type of circuit involves the dual use of series and parallel connections in a circuit; such circuits are referred to as compound circuits or combination circuits. The circuit depicted at the right is an example of the use of both series and parallel connections within the same circuit. In this case, light bulbs A and B are connected by parallel connections and light bulbs C and D are connected by series connections. This is an example of a combination circuitBy EngineerMuhammad Zaheer Meer GMS


Advantages of fast adder over parallel binary adder?

serial adder: 1) Slower 2) It uses shift registers 3) IT requires one full adder circuit. 4) It is sequential circuit. 5) Time required for addition depends on number of bits. Parallel adder: 1) Faster 2) It uses registers with parallel load capacity 3) No. of full adder circuit is equal to no. of bits in binary adder. 4)It is a combinational circuit 5)Time required does not depend on the number of bits

Related Questions

What is the difference between parallel execution and sequential execution in programming?

I believe that at the right level of abstraction, it is not and in fact can be as easy as sequential programming. Note, however, that "at the right level of abstraction" should be considered with care. Pragmatically there are some problems today with taking advantage of the "easiness" of parallel programming.


What is the processing of more than one thread at a time in a multicore processor called?

Parallel


What is serial sequential?

Serial sequential refers to a specific type of processing or execution order where tasks or operations are completed one after the other in a linear fashion, with each task depending on the completion of the previous one. This approach contrasts with parallel processing, where multiple tasks are processed simultaneously.


Does a 300zx twin turbo use sequential or parallel twin turbos?

Parallel.


Is parallel adder a sequential circuit or combinational circuit?

Combinational chutiye


What has the author Roland Freart written?

Roland Freart has written: 'A parallel of the ancient architecture with the modern..' 'A parallel of the antient architecture with the modern..'


What is serial execution?

Serial execution is when tasks are completed consecutively (one after the other), as opposed to concurrently (at the same time, in parallel).


What involves the simultaneous execution of two or more instructions at the same time?

The simultaneous execution of two or more instructions at the same time is known as parallel processing. This technique allows multiple processes or threads to be executed concurrently, leveraging multiple CPU cores or processors to improve performance and efficiency. Parallel processing is commonly used in high-performance computing tasks, such as data analysis, scientific simulations, and rendering graphics. It contrasts with sequential processing, where instructions are executed one after the other.


What has the author Philip M Dickens written?

Philip M. Dickens has written: 'Parallelized direct execution simulation of message-passing parallel programs' 'Parallelized direct execution simulation of message-passing parallel programs' -- subject(s): Computer systems performance, Computer systems simulation, Massively parallel processors, Parallel computers, Parallel processing (Computers)


Why do you need to understand sequential and parallel tasks when creating are grantt chart?

Understanding sequential and parallel tasks is crucial when creating a Gantt chart because it helps in accurately mapping out project timelines and dependencies. Sequential tasks must be completed in a specific order, influencing the overall schedule, while parallel tasks can be executed simultaneously, potentially reducing the project duration. This clarity ensures that resources are allocated efficiently and that potential bottlenecks are identified, leading to better project management and timely completion.


How are parallel lines and parallel planes used in architecture?

parallel lines are used in the white house. The columns holding it up are parallel lines and the floor and the roof of a room are parallel planes as long as they are the same shape


Can you use a sequential search on an unsorted array?

Sequential search is the only way to search an unsorted array unless you resort to a multi-threaded parallel search where all threads concurrently search a portion of the array sequentially.