Hi All,
what is the use of multithreading in a single processor(cpu) machine??
Printable View
Hi All,
what is the use of multithreading in a single processor(cpu) machine??
In C, literally, the answer is none - the C standard includes absolutely no support of multithreading.
In practice, with an operating system that supports preemptive multitasking of threads, multithreading provides a convenient means of separating execution of functions that can logically occur in parallel. There is a reliance on the operating system to give each thread time slices of the processor so, although threads are executed in pieces and there is no true concurrency, each thread can be implemented as if it runs in parallel with other threads.
Hi Friend..Thank you..
You have explain about context switching..if it is a single processor then your words are absolutely correct...what about in case of multi processor system...You can achieve true concurrency there..am I correct??
so you were answer is we cant achieve parrallel execution.in a single processor..may be you are correct may not be??
That seems accurate.
It is accurate, except that you are incorrectlu assuming parallel execution is the same as what you are calling "true concurrency". It is possible to achieve parallel execution with a single processor, in the sense that neither thread is specifically required to wait for the other before it does something.