Some people like to keep only a single instance of Emacs open and edit all their files in there. Doing this has a few advantages:
You can kill/yank text between buffers in the same instance of Emacs. Emacs remembers argument histories (what commands you've used, what files you've opened, terms you've searched for, etc.), but only within each instance. If you have many customizations, starting new instances of Emacs is slow. Alas, when you type emacs in a shell to edit a file (or when $EDITOR is invoked by an external program), a new instance of Emacs is started. You can avoid this by using emacsclient, which instead opens a new frame connected to an existing instance of Emacs:
In your existing instance of Emacs, type M-x server-start. Or add (server-start) to your .emacs file to make it do that automatically at startup. To edit a file, type emacsclient -t FILENAME at a prompt. You can also change your $EDITOR to emacsclient -t if you're using programs that automatically invoke $EDITOR. (emacsclient -t opens a new frame on the terminal; alternatively, emacsclient -c opens a new X frame.) When you're done editing, type C-x C-c, which closes the frame.
- By a "instance" of Emacs, is it the same as an Emacs process, or a thread?
- Are different buffers (or windows, or frames) under the same Emacs window different threads of the emacs process? (I guess so) So do they communicate via shared memory?
- Are an Emacs server and its clients different processes, or the different threads of the same emacs process? (I guess not, but the quote same that a client is a frame of the server, and I guess a frame is just a thread of the same process)
- Generally, in the server-client model of an application, do the server and the clients run as different processes or threads? Is the communication between the server and clients done by shared memory or inter-process communication?