Pyrhon Repeat Error Conceptual question.

Asked 2 years ago, Updated 2 years ago, 135 views

while-loop for loops

2022-09-22 20:16

2 Answers

Yes, theoretically, you can spin it forever, but there's a limit to computer performance, and you can't spin it forever even if you want to because of power outages, operating system updates, or various errors.

But there are exceptions. Server management costs a lot of money and effort to manage server management because servers in large computer rooms, such as Amazon aws (cloud services), Facebook, Google, and so on, require almost permanent rotation almost permanently. But computers in large server rooms and data centers will have to stop working someday due to computer limitations. However, wouldn't it last longer than a typical computer? (Do you take good care of yourself?))

If you leave the roof door on for a long time, the general error is that what you see is the structure of the program Don't you think we need to know to guess?

while True:
    print("Hello World")

Let's say there's a program called.

This guy doesn't have any special functions, so he just does it silently Even if there are representative errors, such as the process suddenly dies, there are only minor errors,

If you're using multi-threading, if you're running a web server, if you're going to... Others, etc.

There are other errors if you run the programs.

I don't think this content can be easily defined.


x = 0

while True:
    if x == 100:
        break

    else:
        x = x + 1

print(x)

You can operate a loop door forever That's rare. Someday, you should receive the result.

So you usually turn an infinite loop, but you walk the condition at some point

Creates a function to stop. Like the chords above.

The code is located at https://github.com/proogrammer/MyAnswers/blob/master/python/loop.py.

:)


2022-09-22 20:16

Studying operating systems and assemblies helps a lot.

For an operating system (x86) the processor (program) is a virtual space with 4 gigabytes of independent space.

Each processor is isolated and cannot invade each other's territory. That is, if you do infinite repetition, it continues. The operating system continues to allocate cpu usage time by considering the processor's priority.

If a problem occurs during execution, most modern operating systems are preemptive and can only shut down that process.

Python is also eventually compiled (converted) into machine language (assemblies).

Conditional statements such as if are converted to cmp, jmp, and repetitive statements such as for and while are also converted to ecx registers and rep, jmp, etc.


2022-09-22 20:16

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.