2.1. Sessions

A session in Unix (or any other operating system) is a sequence of actions in which you

  1. Log in to a computer.

  2. Issue one or more commands, including launching various programs.

    (We won't make a big distinction in this course between issuing commands and launching programs. You launch a program by giving a command telling the operating system to run that program, and even the most trivial commands usually wind up launching a program to carry out your request.)

  3. Log out of that computer.

All sessions have those characteristic three steps. If you are working on a PC where you are the only registered user, you might log in automatically when you power up the PC, and you might be logged out automatically when you tell the PC to shut down. On other computers, you might need to give a user name (login name) and a password. Once you are in a session, you might issue commands by typing on the keyboard or by using your mouse to select from a menu of available programs.

So there can be many different "flavors" of operating system sessions. In particular, a session can be either local or remote, and a session can be text-mode or graphics-mode.

Local and Remote Sessions

A local session is one in which any commands that you issue are used to control the very computer at which you are seated and o which your keyboard/mouse/screen are connected.

A remote session is one in which any commands that you issue (via your local keyboard and mouse) are used to control some other computer, one at which you are not seated but that receives your commands via a network to which both your local computer and the remote one are conencted.

As a general rule, if you want to engage in a remote session with some other computer, you will first need to start a local session on the machine you are seated at, then issue at command to that local machine telling it to connect to the remote one and to start a session for you there.

Text-mode and Graphics-mode Sessions

Another important distinction among different kinds of sessions is how your interaction with the session is presented.

A text-mode session allows you to type commands and to see textual responses in return. Your entire session can be seen as a kind of written dialog between you and the machine. Text-mode sessions are somewhat limited, and their appearance is generally less than exciting.

A graphics-mode session allows the operating system to show you things other than text. This includes not only pictures, charts, and other graphic media, but also windows, menus, toolbars, buttons, and all the other forms of controls that we are used to seeing drawn on our screens.

Graphics-mode sessions are often easier to look at and easier to control than in text-mode. The availability of the mouse or other pointing device permits us to enter information such as positions in a picture that would be difficult to express in text.

Four Combinations

That gives us four possible modes for a session with a Unix machine: local text-mode, remote text-mode, local graphics-mode, and remote graphics-mode.

All four possible combinations are possible and do get used, in practice. Programmers are more likely to engage in a text-mode session than are ordinary users. There are several reasons why software devleopers need to be capable of working in text-mode:

  • They don't place much strain on the computer or the network. In particular, text-mode sessions can be the most effective way to conduct a remote session over slow or overloaded networks.

  • Text-mode can offer more detailed control over the launching of programs that have a number of different options or inputs.

  • It is usually easer to prepare scripts of command sequences that we want to save to perform in later sessions when working in text-mode.

  • In fact, many of the icons, shortcuts, and menu entries that you might employ in a graphics-mode session actually run single lines or scripts of text-mode commands, so the software developer who prepares such things must understand the underlying commands.