사용자:Ruby3141/작업장

이곳은 사용자:ruby3141의 작업장입니다. 편집

무한 루프는 컴퓨터 프로그램의 명령 순서가 반복문의 종결 조건 없음, 충족될 수 없는 종결 조건, 혹은 반복문이 재시작되도록 하는 조건 때문에 끝없이 반복되는 것이다. 비선점 스케줄링 방식의 오래된 운영 체제에서 일반적으로 무한 루프는 전체 시스템을 응답 없음 상태로 만든다. 현재의 선점 스케줄링 다중 작업 모델에서는 무한 루프는 프로세스가 시스템 리소스를 모두 사용하게 하지만, 사용자에게 강제 종료될 수 있다. 바쁜 대기 루프가 무한 루프로 잘못 불리는 경우도 있다. 무한 루프는 컴퓨터 프리징 현상을 일으키는 원인 중 하나이며, 교착 상태나 잘못된 접근 역시 그 중 하나이다.

의도적 / 비의도적 무한 루프 편집

반복문은 프로그램의 명령을 어떤 조건을 충족할 때까지 반복시키는 것이다. 무한 루프는 반복문의 고유한 성질에 의해, 종결 조건이 충족될 수 없을 경우 발생한다.

의도적 무한 루프 편집

There are a few situations when this is desired behavior. For example, the games on cartridge-based game consoles typically have no exit condition in their main loop, as there is no operating system for the program to exit to; the loop runs until the console is powered off. Antique punchcard-reading unit record equipment would literally halt once a card processing task was completed, since there was no need for the hardware to continue operating, until a new stack of program cards were loaded. By contrast, modern interactive computers require that the computer constantly be monitoring for user input or device activity, so at some fundamental level there is an infinite processing idle loop that must continue until the device is turned off or reset. Modern computers also typically do not halt the processor or motherboard circuit-driving clocks when they crash. Instead they fall back to an error condition displaying messages to the operator, and enter an infinite loop waiting for the user to either respond to a prompt to continue, or to reset the device.