Hi, I want to know that can multiple threads be processed simultaneously (simultaneously, as in completely neck-to-neck at hardware level)? Even though I believe this is what happens, but everyone around me keeps on saying that a CPU can process only a SINGLE task AT A TIME, even in a multithreaded environment.
Also, can multiple threads belonging to the same program SIMULTANEOUSLY access the same data source?
Each CPU, or, to be more precise, each execution unit (an Intel Core i7 CPU has eight of those, and IBM Power7 CPU has 32) does indeed execute only one thread at one time. If more threads are running than there are execution units available, the operating system decides which thread gets to run at which time: on a typical desktop system, each thread gets to run for a few milliseconds, then is paused, and another thread runs on the same CPU, making it appear as if they execute simultaneously.
Yes, multiple threads belonging to the same program can access the same data source simultaneously, although it depends heavily on kind of the data source: many of them have serial interfaces at hardware level.