Operating Systems
What is an operating system?

An operating system is the program that manages all programs and provides a link between the hardware and software in a computer.  When you start up a Macintosh, the "Welcome to MacOS" or "Welcome to Macintosh" greeting is the operating system loading itself into memory so that it can perform its functions.  The operating system is ever-present in the background of the computer managing software requests for hardware functions from applications that you are running.  For example, the operating system sits in the background and waits for you to either type something on the keyboard, move the mouse, click, or drag- basically, it waits for you to do something.  Once this action is executed, the operating system sends the command to the proper program which then performs the action you have requested. In addition to this, the operating system manages disks, monitors, printers, and all other external devices.

Types of Operating Systems

Managing Peripherals and Simple Instructions - Basic Operating Systems

Operating systems designed for personal computers were designed to perform a limited number of tasks.  The operating systems that were used by the IBM PC Jr. and the Apple //e handled primarily keyboard input, disk operation and printer or monitor output.  These days, operating systems have become exceedingly complex.  Both MacOS and Windows NT have complex operations built into the operating system to perform common tasks.  For example, the Macintosh Operating System contains a series of toolbox routines that allow a programmer to quickly draw a window frame on your computer screen, set up pull down menus, and handle printing and disk operations.  These operations were not handled by the operating system in the past.  Therefore, if you needed to draw a window on a computer such as the Apple //e, each time you wanted that window drawn, you needed to specify which dots to light up on the screen to draw the window, how exactly to move the dots around as the arrow past across the screen, and what to do when the window was moved.  You can see that if you were a programmer making software for one of these operating systems, it would be far too much effort to program all of these instructions into the computer and you would opt for a completely text-based interface.

Managing Several Programs At Once - Basic "Multitasking"

In addition to managing drawing routines, printing, disk operation, etc., modern operating systems can manage all of these things for several different programs at once.  For example, when you are working in Microsoft Word and would like to do some math in Excel, you need not quit Word to run Excel- you just launch Excel in the background and then switch back to Word to continue writing when finished with your spreadsheet.  What is actually going on when you run Microsoft Excel while running Word is the following:

1) the operating system senses your desire to launch another application.
2) the operating system looks to see if there is enough available memory in your computer to run both at the same time.
3) if there is plenty of memory, the operating system stores where you left off in Microsoft Word, and launches Microsoft Excel.
4) while running Excel, if you click on a Microsoft Word window in the background, the system saves all information about what you are doing in Excel and then pulls the information out of its memory regarding where you last left off and brings Microsoft Word to the main part of its attention.

Go ahead and try launching two applications at once and watch what the computer is doing.  Also, open up the "About this Macintosh" window (by going to the Apple menu under the Finder) and watch how the operating system will give the new application memory enough to run.

Running Several Jobs at Once - True Multitasking

Some advanced operating systems (like Windows NT, UNIX, and MacOS to a certain degree) have the ability to simultaneously run programs.  In the above description, the computer was not running the two programs at the same time, but rather switching between them when you wanted to go to a different program.  In Windows NT and UNIX, you can tell the computer to do a complex calculation in Microsoft Excel that may take hours and then switch directly over to Microsoft Word to do word processing while your calculation runs in the background.  If you attempted to do this operation on most Macintosh operating systems, you would be forced to watch Excel run its calculations before continuing.  The ability to simultaneously perform many operations is called multitasking and is one of the major advantages of using a UNIX or Windows NT workstation.

This type of multitasking was born out of the fact that 99% of the computer's waking time is devoted to waiting for you to do something.  In order to increase the computer's efficiency, multitasking was developed so that the computer could do other things while waiting for a slow human to tell it what to do.

Multi-user Machines

Once the concept of multitasking developed, several important leaps could be made in computing:

1)  the operating system itself could be designed so that it could continually run programs in the background to perform specific tasks while you worked.  For example, the operating system could tell a program to clean up the hard disk while simultaneously performing jobs for the user.

2)  computers were no longer limited by a user physically being at the computer.  With networking, many remote users could log on to the computer, run jobs (all at the same time), produce graphics, print, etc. on one computer.

Personal computers are not able to handle these tasks.  You would not expect to be working on your Macintosh and have someone on the other side of the world running Microsoft Power Point on your computer.  However, if you work on a Sun workstation, SGI, DEC, etc, this is possible (and fairly likely that you will be sharing computing time with others).

This gives you a very brief introduction as to what operating systems do.  There is reading material on operating systems in front of Ramon's office.  Please pick them up and try to read them before class on Wednesday.  Also, please spend an hour or so before class playing with both MacOS and Windows95 and note the really annoying things you find about each operating system (crashes, inability to exit programs, etc.)  These should be functional things, not things like "I don't like the appearance of the Windows 95 windows" (unless of course, you find that some Windows 95 windows' features that you like are not found in the MacOS).  These lists will be part of a discussion on Wednesday, so please come to class with these thoughts.

Discussion

Divide into groups of 4 and discuss problems with existing operating systems. How can we improve common operating systmes using our knowledge of existing operating systems.

Interface

Useability
Graphical interface
Hardware management
Keyboard equivalent

Multitasking

Are MacOS and Win95 true multitasking or not?
Crash management
Complicated tasks and crashes

Hardware useability

1, 2, or 3 button mice

UNIX Demonstration

Logging into a machine remotely using the Xwindows system
What is Xwindows?
We use exceed on the Win95 side of these machines.
For now, we will use our research group Silicon Graphics Incorporated (SGI) workstation called alai.la.asu.edu. Connect to it using the icon called alai xterm on the PC desktop.
Everyone has an account on this machine now.

Activities


1) command line actions:
See this site at the University of Colorado that has a list of commonly used UNIX commands.
Try a few like ls.

2) Directory structure.
Let's take a tour using the commands cd and pwd.
cd directory changes the working directory to that which is specified.
pwd prints the working directory.
cd .. takes you up one level in the directory tree.

Look at this:
alai 23% pwd
/disk2/people/ramon
alai 24% cd ..
alai 25% ls
ftp glg490 hollow hstenner ramon sarah wessels
geomorph guest howard mcmanus roland slug woodse


3) running new programs
Type netscape &. The & tells it to run without tieing up the window that you used to launch it. You will get a couple of error messages which you should ignore, but then you will see that a new windo of netscape fires up. You will note that it is a bit faster (?) than if you run it on the mac or PC. After you have surfed to a couple of places, then come back and exit netscape (look under the file menu).

4) Killing jobs without having to reboot
Start netscape again (netscape &). What if netscape got hung up and you could not stop it by exiting? ps -ausername
these will tell you the processes that you (username) are running.
For example:
alai 19% ps -auramon
PID TTY TIME CMD
5737 pts/7 0:51 netscape
5797 pts/7 0:00 ps

See which one is netscape (PID is process id and it is in this case 5737).
Now type kill 5737.

5) Using a text editor
We use xemacs on our machine. Type xemacs & to get it fired up.
Here is a quick explanation of xemacs:
6) Input and output and redirects.
Most UNIX commands take something from the standard input (usually the keyboard) and do something and put the results out to the standard output (usually the display). We can redirect this output by using the vertical bar "|" on the keyboard (above the backslash). That is called a pipe. It takes the standard output from one command and pipes it as the standard input to the next file.
Here is a classic example:
the command who prints who is on the machine, and sort will sort a list.
alai 27% who
ramon ttyq0 Sep 9 19:22
slugg ttyq2 Sep 9 12:12
slugg ttyq4 Sep 9 12:13
slugg ttyq5 Sep 9 12:13
ramon ttyq6 Sep 9 19:22
ramon ttyq7 Sep 9 19:26
alai 29% who | sort ramon ttyq0 Sep 9 19:22
ramon ttyq6 Sep 9 19:22
ramon ttyq7 Sep 9 19:26
slugg ttyq2 Sep 9 12:12
slugg ttyq4 Sep 9 12:13
slugg ttyq5 Sep 9 12:13

Another important redirect is >. It takes the standard output and sends it to a file that you specify:
alai 33% who >wholist alai 34% more wholist
ramon ttyq0 Sep 9 19:22
slugg ttyq2 Sep 9 12:12
slugg ttyq4 Sep 9 12:13
slugg ttyq5 Sep 9 12:13
ramon ttyq6 Sep 9 19:22
ramon ttyq7 Sep 9 19:26

Note that I used a command called more that types the contents of a file a page at a time to the standard output. You have to hit the space bar to see the next page if there is one.
Note that > will put the output into a file, but it will overwrite one that exists. If you want to append, you have to use a double greater than: >>
alai 35% who | sort >>wholist
alai 36% more wholist
ramon ttyq0 Sep 9 19:22
slugg ttyq2 Sep 9 12:12
slugg ttyq4 Sep 9 12:13
slugg ttyq5 Sep 9 12:13
ramon ttyq6 Sep 9 19:22
ramon ttyq7 Sep 9 19:26
ramon ttyq0 Sep 9 19:22
ramon ttyq6 Sep 9 19:22
ramon ttyq7 Sep 9 19:26
slugg ttyq2 Sep 9 12:12
slugg ttyq4 Sep 9 12:13
slugg ttyq5 Sep 9 12:13

Note that I used the pipe and the append redirect in that one!

Pages maintained by
Prof. Ramón Arrowsmith

Pages last modified on Mon Sept 8 1997.