i have simple but not easy question
Can any computer (multi or single core) run many threads at the same time, the very same time, i mean two or more threads runs at the same time of execution ?
i have simple but not easy question
Can any computer (multi or single core) run many threads at the same time, the very same time, i mean two or more threads runs at the same time of execution ?
You can create multiple threads in your environment and have a single CPU core execute these threads. However, their execution will not be in parallel but merely concurrent. In other words, the CPU will execute one thread (in part or completely) first then the other thread. If there was work left on the first thread it then may return to the first thread again and execute some more instructions. The threads are thus progressing concurrently. If the threads were executed on more than one CPU core then they can be executed at the same time which means they are executed in parallel.
In summary, multiple threads on a single CPU core can be executed concurrently. Multiple threads on multiple CPU cores can be executed concurrently or in parallel.
See also this answer: Can multithreading be implemented on a single processor system?
...at the same time, the very same time, i mean ... at the same time of execution...
Sounds like you are struggling to find a formal way of asking your question.
The words "at the same time" do not usually appear in formal discussions about concurrency.
When you're talking about time, there are events which are indivisible moments in time, and then there are intervals. Every interval is defined by its begin event and its end event.
Whenever you're trying to prove the behavior of some system, and your proof revolves around events, A and B then either;
Those are the only possibilities. If your proof is going to fail, then you won't be able to rescue it by saying "A and B happen at the same time."
When your proof revolves around two intervals, I and J, then either;
"Overlap" is the preferred word in formal discussions. So,...
...The execution of two or more threads can overlap on a single-processor system, but at any given instant in time, the single CPU will only be working on behalf of one of the threads.
Single core - No
Multi Core - Yes.
For details: Threads & Processes Vs MultiThreading & Multi-Core/MultiProcessor : How they are mapped?
The capability of running multiple threads at the same time is the reason why multicore processors are being produced. It was getting more and more difficult to boost single-core CPU's efficiency due to various reasons. At the same time, as many threads as the number of cores/processors you have can be executed. If you have multiple multicore processors, the maximum number of threads running in parallel will be num_cpus*cores_per_cpu. If the number of threads exceeds the number of available cores, they will be executed interlaced.