Answer the question
In order to leave comments, you need to log in
Will a single core computer hang during while(1) {}?
1) Let's say there is such a program in c ++
int main()
{
while(1) {};
}
Answer the question
In order to leave comments, you need to log in
Depends on the operating system and hardware.
If we are talking about windows, then starting from wine 9x, the operating system periodically receives control even if there are hung processes.
With preemptive multitasking, after a certain time, an interrupt will be generated from which the OS will switch this thread to another. There will be no hangup. (Windows, Linux, etc.)
With cooperative multitasking, until a thread reports that it has completed a task, there will be no switching to another one. Hang up.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question