Program Instances in Windows

Windows allows you to run more than one copy of a program at a time. This is handy for cutting and pasting between two copies of Notepad or when running more than one terminal session with a terminal emulator program. Each running copy of a program is called a ‘program instance’

Windows performs an interesting memory optimization trick. It shares a single copy of the program’s code between all running instances. For example, if you get three instances of Notepad running, there will only be one copy of Notepad’s code in memory. All three instances share the same code, but will have separate memory areas to hold the text data being edited. The difference between handling of the code and the data is logical, as each instance of Notepad might edit a different file, so the data must be unique to each instance. The program logic to edit the files is the same for every instance, so there is no reason why a single copy of Notepad’s code cannot be shared.

Leave a Comment