Usually in a file in secondary storage. If the file does not already exist, the program will ask the operating system to create it.
Usually all collections of data outside of main storage are organized into files. The job of keeping all this information straight is the job of the operating system. If the computer system is part of a network, keeping straight all the files on all the computers can be quite a task, and is the collective job of all the operating systems involved.
Application programs (including programs that you might write) do not directly read, write, create, or delete files. Since the operating system has to keep track of everything, all other programs ask it to do file manipulation tasks. For example, say that a program has just calculated a set of numbers and needs to save them. The following might be how it does this:
So when an application program is running, it is constantly asking the operating system to perform file manipulation tasks (and other tasks) and waiting for them to be completed. If a program asks the operating system to do something that will damage the file system, the operating system will refuse to do it. Modern programs are written so that they have alternatives when a requests is refused. Older programs were not written this way, and do not run well on modern computers.
In modern computer systems, only the operating system can directly do anything with disk files. How does this:
(You might not be certain about your answers, but please think about the questions.)