Modern operating systems employ virtual memory, however programs that use large amounts of data (e.g. [[Video editing software|video #) may need to create temporary file(s).
Operating systems and programming languages typically provide functions for obtaining unique temporary file names.
On POSIX systems, temporary files can be safely created with the mkstemp or tmpfile library functions.
To generate a temporary file name that will survive past the lifespan of the creating program, tmpnam (POSIX) or GetTempFileName(...) (Windows) can be used.
Operating systems may clear out the temporary directory on a reboot, and they may have "cleaner" scripts that remove files if they have not been accessed in a certain amount of time.