Difference between program crashes and program freezes

What is the difference (or reasons) between a failed program and a program that freezes (becomes irrelevant) in C ++?

Of course, accessing invalid memory causes the program to crash. Deadlock in threads can cause the program to freeze. What are other reasons?

Does all memory exhaust that the program freezes? or accident? I am a little confused between the differences and their causes.

+5
source share
6 answers

Failure is usually caused by illegal instruction, for example. access to invalid memory, division by zero, etc. This usually manifests itself as a well-known exception that is handled by the operating system.

2 :

  • , , , , . , ABBA ( -).
  • Livelock, , - , , . :
    • / , .
    • while, , ( "livelock" ).

,

@Pop, : , , . , . - jasonline

, :

- . , .

++, new , std::bad_alloc. , , , ( ).

+11

, . . , -, . , , , , , , .

0

, / . , DOS ( 386 > DOS- , , , DOS4GW).

OS , .

, .

0

, .

, :

:

  • "Livelocks" .
  • UI threads are blocked by some other action (some examples: input-output, pages that are output to disk in low memory conditions)
  • Other programmer errors, such as loops that never end in some conditions that have not been tested.
0
source

From your comment, it is possible that the memory leak is related to your freeze, but not the reason for this. That is, you might have something as simple as an infinite loop somewhere that grabs a bit more memory at each iteration.

0
source

All Articles