Just a discussion , so that when it happens one has some clue on have to stop.
Hello,
the context I can offer: In system administration you are checking all processes in the terminal (ps aux in Linux). Find the one that eats up most of the CPU core(s), that’s usually the culprit, and you terminate it with "Pkill <process name or ID>"
.
can you give more details on what you mean?
Yes when studying code mostly JavaScript while or for loop ,we are warned to avoid creating an infinite loop . Like a code condition that will run forever, like making a loop iterator equally to zero then again making the condition greater or equal to zero then the iteration increase may be by 1
Eg; /for (let i = 0; i >= 0; i++) {
console.log ("run forever ");
}/ but don’t try this codes that’s why I made them a comment. I think you get the idea.
and do you want to stop it how? like do you want a way to say “when this happen to this value stop”, or are you asking for a manual stop while a program is running?
Good question, while loops or for loop can become infinite , so the computer can crash . One may not have intended to make an infinite loop but as he or she tests he may end up with infinite loop code that runs forever
From a technical standpoint, infinite loops aren’t that big of a problem anymore with modern multi-core CPUs and operating systems.
Modern OS are multi-tasking and will simply allocate other processes to available resources if one process runs an infinite loop. In critical hardware like servers that need high availability, there are watchdog timers terminating processes taking too long.
Infinite loops are even used as a tool to simulate CPU loads, like endlessly adding 1 to 1 50.000 times, a good example on how modern hardware can handle these loops.
So you mean this should not be a worry that’s quite good to hear from the way technology is. Because in one of the lessons on loops this is one of the warnings we are provided with , so i thought loops turning into infinite was something everyone was to be prepared for incase it happens Because i know no one intends to but anything can happen as one explores his coding journey. So guys you heard it. No worry anymore.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.