Before we jump into thread, it is good to understand two terms CONCURRENCY & PARALLELISM.
CONCURRENCY: Concurrency is fake parallelism, where
more than one task is done by single-CPU and switching among the tasks to
allocate CPU-TIME is so fast that it seems like they all are running in
parallel. This switching of tasks in taken care by operating system.
In simple terms, it like as a human we are talking
over phone and watching TV at the same time.
PARALLELISM: It is a ways of performing tasks where one CPU/CORE/Processor id dedicated to one task. For example, if there are three tasks and we want to execute them then our system must have at-least 3 CPU/CORE/PROCESSORs and a task assigned to each processor.
Concurrency and Parallelism |
Ques: What does a process or thread choose to perform a task Parallelism or Concurrency?
It is neither the process or thread nor a programmer decide which mechanism shall be followed. Rather it shall totally depend on what kind hardware and operating system that is running on that hardware; decides, how does our system shall behave on which we are trying to run our program.
Your Comments /Suggestions & Questions are always welcome. We would like to help you with best of our knowledge.
So feel free to put Questions.
So feel free to put Questions.
No comments:
Post a Comment