views:

92

answers:

3
  1. Single core CPUs or a machine with a single CPU cannot do parallel processing. True/false?

  2. In a single core single process CPU there can be only one thread's assembly instructions getting executed regardless of however many processes with however many threads are running (sleeping threads excluded) at any given time. True/False?

Sorry about too many questions, they all seem related.

+3  A: 
  1. True.

  2. True. If there's only one CPU then there can only be one sequence of instructions executed at a time.

Zach Hirsch
Many CPUs have more than one core these days - substitute core for CPU.
GraemeF
+1  A: 
  1. depends on what you mean by "parallel" processing. You'll need a clear description before you can get a clear answer.

  2. is generally true, but...

Note that some processors support hyperthreading - where one processor with one core presents itself as two "virtual" cores. This allows the processor to execute instructions on one thread while the other is waiting for a memory access and so on.

So even a single-core uniprocessor machine, it can be possible to have multiple threads on the processor simultaneously.

Anon.
Hi Anon, what I meant by parallel processing was two (or more) threads executing machine instructions at any given time (i.e CPU cycles not shared). Thanks for your time.
Murali
In that case, yes, a machine with a single core is not capable of executing more than one machine instruction at a time. But it can "fake it" with hyperthreading, which it allows it to actually do useful work even when it might be otherwise waiting for a memory access.
Anon.
@Anon, I am not sure about what you mean. With HyperThreading, you *can* execute several arithmetic instruction at the same time. With some very specific (useless) code I could reach a 2x speedup with a single HT processor. So according to the given definition, ht is parallelism, even if in practice it is quite useless.
Ben
I guess I assumed "useful" parallelism was implicit in the question.
Anon.
+4  A: 

In a single core CPU (without hyperthreading) there will only be one thread actually executing, yes. However, that doesn't totally preclude parallel processing. For instance, you could have three tasks to achieve:

  • One which is doing a lot of network activity
  • One which is doing a lot of disk activity
  • One which is doing a lot of CPU activity

Running these three in parallel using threads could certainly give a performance improvement even on a single core machine. The heavy-CPU activity will have to wait when one of the other activities has some more data to process, but the overall effect is parallel processing. This is basically because "other things" can be happening (the disk head moving, a web service performing some work on a remote machine) without taking CPU.

Jon Skeet
Still in the strictest sense there will not be parallel processing, ie at any one time on the CPU, but if you take small time steps, and look over a number of them then each step could be keep the total system busy as per your example.
Simeon Pilgrim
@Simeon: It depends on your definition of "parallel processing" IMO - does the work required moving the disk head and calling the web service not count as "processing"? It's work that needs to be done, and it's being done in parallel. I think for *practical* purposes that counts as parallel processing. Indeed, it's parallel computation across systems, if the CPU in the web service is running at the same time as the CPU on the local system.
Jon Skeet
Or indeed, the processor on the local network card or disk controller performing a DMA transfer.
caf