What is a swap file, why is it needed, and where is it used?

I saw on one site that "if all the applications in the system released unused memory, only after it was full, the heavy use of the swap file would make work simply impossible.". Here is the list of questions:

  1. What is a swap file?
  2. Why do you need it?
  3. Where is it used?
  4. Why would this "make the job just impossible"?
  5. What would it affect if it "made the job just impossible"? Work applications?
Author: CrazyElf, 2020-08-02

2 answers

What is a swap file?

This is a way to expand the computer's RAM.

Why do I need it?

Applications like to use RAM, but at the same time, although they "capture" it, these applications may not be active at the moment. However, other applications may not have enough memory. Therefore, the operating system can pretend that it has, for example, 2 times more RAM than it actually has. At the same time it loads application memory to RAM from disk if the currently active applications need this memory, or vice versa, it loads application memory from RAM to disk if these applications are not very active at the moment.

Where is it used?

Almost all operating systems use a swap file.

Why would this "make the job just impossible"?

Because the operating system would do nothing but it loaded / unloaded data to the disk from RAM, and the disk, as you know, works orders of magnitude slower than RAM.

What would it affect if it "made the job just impossible"? How does the app work?

On the work of all applications, everything that turns on this computer as a whole. Applications will run very slowly, will react slowly even to keystrokes, etc.

 2
Author: CrazyElf, 2020-08-03 08:52:36

The swap file is needed on computers with a small amount of RAM, and complements it. Although its speed is much less than the usual RAM, applications will not simply close from a lack of RAM.

I didn't understand the last two points.

 0
Author: coder8008, 2020-08-03 08:28:02