Question

In: Computer Science

Explain the difference between concurrency and parallelism. Using these concepts, discuss how a multi-threaded application can...

Explain the difference between concurrency and parallelism. Using these concepts, discuss how a multi-threaded application can run faster than a single-threaded application on a single-processor machine and on a multi-processor machine.

Solutions

Expert Solution

First Part:

The differences between concurrency and parallelism are the following:

Concurrency Parallelism
(i) It can be performed using a single CPU. (i) It can be performed using only multiple CPUs.
(ii) It can be defined as the process of executing and managing multiple operations at the same time. (ii) It can be defined as the process of executing multiple operations at the same time.
(iii) It can be performed based on context switching. (iii) It can be performed using multiple processors.
(iv) It increases the system throughput (number of tasks completed per unit time). (iv) It increases the system throughput and processing speed.
(v) It manages multiple operations simultaneously. (v) It performs multiple operations simultaneously.
(vi) It is non-deterministic control flow approach. (vi) It is deterministic control flow approach.
(vii) Debugging is more difficult. (vii) Debugging is less difficult.

Second Part:

Multi-threaded application can be defined as the program which have multiple threads (light-weight process) and they can be executed in the same address space. As it can have a higher degree of parallelism than a single-threaded application, so the execution speed will be faster.

In the multi-processor system, the multi-threaded application will run faster than a single-threaded application as it can have a higher degree of both concurrency and parallelism. Also, the execution will be faster than a single processor machine as the single processor machine can only achieve concurrency using context switching, but it will not be able to achieve parallelism.

Please comment in case of any doubt.
Please upvote if this helps.


Related Solutions

Create a Java application that will exhibit concurrency concepts. Your application should create two threads that will act as counters.
JAVACreate a Java application that will exhibit concurrency concepts. Your application should create two threads that will act as counters. One thread should count up to 20. Once thread one reaches 20, then a second thread should be used to count down to 0.
Create a C++ application that will exhibit concurrency concepts. Your application should create two threads that will act as counters.
C++Create a C++ application that will exhibit concurrency concepts. Your application should create two threads that will act as counters. One thread should count up to 20. Once thread one reaches 20, then a second thread should be used to count down to 0.
Create a C++ application that will exhibit concurrency concepts. Your application should create two threads that will act as counters.
C++ application:Create a C++ application that will exhibit concurrency concepts. Your application should create two threads that will act as counters. One thread should count up to 20. Once thread one reaches 20, then a second thread should be used to count down to 0.For your created code, provide a written analysis of appropriate concepts that could impact your application.Please Specifically, Address: Performance Issues with Concurrency Vulnerabilities Exhibited with use of Strings and Security of the Data Types used.
In this programming assignment, you are asked to write a multi-threaded program using JAVA to compute...
In this programming assignment, you are asked to write a multi-threaded program using JAVA to compute the sum of an arithmetic series from 1 to 200 using pthreads.   The main thread is responsible for creating two child threads The first child thread should compute the partial sum of the series from 1 to 100 and the second computes the partial sum of another series from 101 to 200. The main thread should accumulate the partial sums computed by the child...
Using Eclipse to answer this Java question Using the concepts from the Concurrency Basics Tutorial I...
Using Eclipse to answer this Java question Using the concepts from the Concurrency Basics Tutorial I provided in Modules, write a program that consists of two threads. The first is the main thread that every Java application has. The main thread should create a new thread from the Runnable object, MessageLoop, and wait for it to finish. If the MessageLoop thread takes too long to finish, the main thread should interrupt it. Use a variable named maxWaitTime to store the...
essay question: Discuss the difference between covered and uncovered interest parity and explain both concepts
essay question: Discuss the difference between covered and uncovered interest parity and explain both concepts
Questions1: Discuss, in detail, the difference(s) between the concepts of international marketing and domestic marketing. Explain,...
Questions1: Discuss, in detail, the difference(s) between the concepts of international marketing and domestic marketing. Explain, briefly, why and how would multinationals firms adapt their products to foreign markets. Support your answer with related example [LO1] [ [15 Marks]
Using the concepts from the Concurrency Basics Tutorial I provided in Modules, write a program that...
Using the concepts from the Concurrency Basics Tutorial I provided in Modules, write a program that consists of two threads. The first is the main thread that every Java application has. The main thread should create a new thread from the Runnable object, MessageLoop, and wait for it to finish. If the MessageLoop thread takes too long to finish, the main thread should interrupt it. Use a variable named maxWaitTime to store the maximum number of seconds to wait. The...
Q1: Server Design Models: (explain clearly) a. For a multi-threaded server, describe the advantages of adopting...
Q1: Server Design Models: (explain clearly) a. For a multi-threaded server, describe the advantages of adopting the many-to-one threading model. b. For a multi-threaded server, describe the advantages of adopting the one-to-one threading model.
Explain the key difference between a web service application and a general client/server application
Explain the key difference between a web service application and a general client/server application
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT