© Nancy E. Reed, 1997 -- ECS 15 -- Fall 1997

Lecture 21 Notes
Software Layers
Operating Systems

Handouts:

Software Layers in Computers

Thus far we have discussed the three levels of computer languages. It is also important to consider the layers of software that are used inside a computer. First, remember that all computer instructions are software. However, the software inside a computer serves many different purposes. You have already learned that a computer contains several "entities:" the Boot program, DOS and Application programs. Each of these sets of instructions are programs. Boot instructions are stored in a special way inside a computer, using a special form of memory called ROM, for Read Only Memory, a set of computer "chips" that store special instructions to get the computer started when it is turned on.

By contrast, we saw that the RAM [Random Access Memory, Main Memory] used to hold DOS and Applications programs is erased each time the machine is turned off. ROM is necessary for the Boot program, but since we need to change the conditions under which DOS works, and we want to switch applications in a general purpose computer, we never use ROM except for permanent, fixed programs like the Boot program.

DOS is also a program, one that controls the user's interaction with the computer, once Boot has checked it out to make sure it is in working order. Through DOS, the user can access Application Programs. Applications come in several different broad categories, five of which are most common in today's personal computers:

One final application area not mentioned in the list above is the large number of High-Level Languages that allow users like yourself to develop your own, customized software. In this class, you have been working with MUMPS or Scheme - programming languages that are especially powerful for handling text-related problems with a computer.

In summary, remember the layers of software in a computer. The Boot program starts and then gives control to the Operating System. The operating system interfaces directly with the hardware of the computer. Applications programs and other environments form additional layers "on top" of the operating system. Users are able to customize their environment more and more as software becomes more flexible. In this lecture and the next the performance of operating systems and the reasons for having them are described in more detail.

Operating systems

You are by now familiar with at least two operating systems - DOS and Windows95. Windows95 was recently released, and has replaced its predecessor, Windows 3.1. Windows 3.1 is not an operating system because it runs "on top" of an operating system - DOS. Windows 3.1 is called an operating environment rather than an operating system, as we will discuss below.

Operating system - A set of programs that lies between the applications software and the computer hardware.

Operating systems are extremely important - if there is a problem with the operating system, it is difficult to get any work done. Much of what the operating system does is accomplished silently. We usually only notice the operating system if something goes wrong.

System software - The operating system plus programming language compilers, interpreters, utilities, etc.

There are 3 categories of files most people use:

  1. System files - including operating system programs.
  2. Applications software files - the software needed for an application such as word processing to run.
  3. Data files - the data that is related to applications software, such as a memo typed using word processing software or a spreadsheet created with Excel.

Operating systems count when purchasing software. Software/applications programs run on only one operating system (i.e. Mac, DOS, Windows, Unix, ...). If you want to run a program on more than one operating system, you must buy a different version for each one. However, if you have the source code in a high-level language and compilers for that language on each machine, then you can compile the program to create a version for each different machine and operating system.

The 3 Primary Functions of the operating system are to manage resources, establish a user interface, and execute and perform services for applications programs.

Manage resources, including the CPU, memory, disk drives, and printers.

Resource allocation - The process of assigning (allocating) computer resources to certain programs for their use. This includes the CPU and RAM, as well as devices like floppy disks, hard disks, printers, and CDROM drives. This is much more complex than it seems at first. Imagine trying to coordinate 2 or more children (programs) playing with a dozen toys (resources). There might be conflicts if more than one child (program) wants to play with the same toy (resource) at the same time.

Establish a user interface

User Interface - Common user interfaces are text versions and graphical versions (GUIs). GUIs work with on-screen icons (small pictures) and pull-down menus with a mouse as a pointing device. The keyboard is also used for commands and for data entry.

You have experience with both types with DOS (text) and Windows95 (GUI). In order for the user to perform file management (create directories or copy files, for example) tasks, there must be some way for the operating system to accept user commands. This is the function of the user interface to the operating system.

Execute and provide services for applications software

Applications software execution and services - The operating system is responsible for executing (starting) applications programs like spreadsheets and wordprocessors, as well as providing services for those applications. We have seen how to execute programs in both DOS and Windows95.

What do me mean by providing services? Applications programs do not have permission to access the devices attached to the computer (what if more than one program did so at the same time..). That is an operating system responsibility. So when you save a file in a wordprocessor or spreadsheet, the application program asks the operating system to perform that service.

The increasing power of operating systems (on personal computers)

PC operating systems (DOS) were originally restricted to

We will see below and in the following lecture, the additional capabilities demanded of operating systems for large computers to accommodate not only multiple tasks, but multiple programs executing by multiple users.

Concurrently - Two or more tasks happening within the same time frame, but one at a time.

Simultaneously - Two or more tasks happening at the same exact time.

Multitasking - The capability of running several programs on the same CPU in the same time frame (may only be a single user, like Windows). This is one of the major advantages of Windows95 (and could also be accomplished in Win 3.1 by running a shell in DOS).

Multiprogramming - permits the running of several programs, probably from many users, in the same time frame. Also called concurrently. This is an additional capability of operating systems for large computers that we will discuss next.

Operating Environments

Operating environments (like Windows 3.1) - Provide a GUI - graphical user interface, and add an additional layer between the user and the hardware.

Operating systems for large computers

Operating systems for large computers must handle

In order for operating systems to accomplish this without being destructive, they must handle not only the multiprogramming aspects of the task, but also the multiple users. Multiple users means that file protection is necessary. There is really no file protection to speak of on PCs. Whoever is using the PC has access to everything.

Each large operating system has a method for protecting files in a user's directory, and of making those files "available" if the user so desires. We will talk more about file protection below and how it is accomplished in Unix.

Handling multiple programs on the same computer can be accomplished in two ways. One is multiprogramming, as we saw above, where two or more programs are executing on a single CPU (by taking turns based on some sharing scheme). The other way is Multiprocessing, which means using a large computer with more than one CPU, where each program runs on one of the CPUs.

Multiprogramming is accomplished either by allowing programs to be interrupted or by giving each program a "time slice" to work in and alternating between the programs.

Virtual Memory

Memory management is the process of allocating memory to several programs and of keeping the programs in memory separate from each other. Virtual memory can be used (if the operating system includes this feature) in cases where the users want to execute more programs on the system than there is space for them in RAM. The operating system manages the memory by storing less frequently used parts of large programs in a special "swap space" on the hard disk when the section of code is not being used. Using this technique, your computer can "act" like it has more main memory than it has. There is a performance penalty, however, because hard disks are slower than memory.

Print Spooling

Printing resources are shared with a process known as spooling. With print spooling, print jobs are not sent directly to the printer, but are put in a queue - usually they are printed in the order that they are sent. A special program in the operating system keeps track of what is waiting to print and what has finished printing. It must monitor the printer's status for things like a paper jam or out of paper, and notify the user.

File protection

When a computer is shared by many users, the operating system must not allow access to files by other users unless the owner of the file gives "permission". In large operating systems, file protection is accomplished by keeping track of specific information with each file about the owner of the file and the type of permission the owner wants him/herself and other to have to use the file. We will see how the Unix operating system handles file protection shortly.

The Unix operating system

Unix is the most widely used multi-user, multi-tasking operating system available. Most workstations use a version of the Unix operating system. Unix is the operating system on the IT suns, where your email is located. The two most common versions are called System V and BSD (developed at UC Berkeley).

Unix is expected to continue to dominate as the OS for workstations for many years to come. There are also free versions of Unix that run on PCs (Linux, Free BSD..) that are quite popular.

There is a (free) standard graphical user interface (GUI) common to most Unix systems called X windows. This is in use on the computers in the CS department's Computer Science Instructional Facility. Some computer companies have also produced GUIs specifically for their machines. Most of them work in a manner very similar to the X window system, and to other GUIs like Windows 95.

Unix can be a very complicated OS with many special features. However, it is relatively easy to learn the survival commands you actually need, that are comparable to the DOS commands you already know. We will see those below.

File protection in Unix

In the Unix operating system, file protection is performed as follows. Users can be divided into three groups

There are three different types of actions that have separate permissions on each file:

Each group of people (User, Group, Others) can be given any combination of permissions (Read, Write, eXecute), thus there are 9 separate "bits" of permission information stored with each file. The User (owner of the file) can change the permissions for any group at any time. (In Unix, the command is "chmod" with the following options and file name(s): the group(s) represented by 1 or more of ugo, the change in permission indicated by + to add and - to remove permission, and the type of permission indicated by 1 or more of rwx. For example, chmod go+r jokes.txt would give read permission to everyone in your group and the outside world to the file jokes.txt in your current directory).

Your Home Directory

When using your account on a Unix machine, you will have a specific directory available that is yours. That directory is called your home directory. The name of the directory is usually your login name. When you log in, you automatically start in your home directory (this is your default directory). You have control over all the files in that directory, including creating subdirectories, etc.

In order to see where your home directory is, you can use the command pwd, which stands for print working directory. This will print the entire path from the root directory, up to and including your home directory name. On each computer or for each organization, the computer system administrators decide where (the paths) they will put home directories. On the IT suns, home directories for people are in the following directories: /home /home0 /home22 /home96 /home97 /home98 and /home99.

Survival Unix

Your Unix account on the IT machines can be used for much more than just reading email. You have a permanent "home directory" where you can store files. There are many software packages available. The emacs editor is available which is very similar to the Edwin editor you have been using in the Scheme labs. You are encouraged to learn and use your account on these larger computers. If you work for a company in the future and they have a large computer, chances are that computer will have a Unix operating system of one "flavor" or another. You can be confident that you know enough Unix to use that computer and can learn a bit more when necessary!


(note: DOS uses \ while unix uses / to separate directory names)

DOS commands				Unix command (similar)
------------                    	--------------------------
List files in a directory
DIR [ < dir > ]				LS [-l] [ < dir > ]

Change current Directory
CD  < dir > 				CD  < dir > 

Copy a file to another file or directory 
COPY  < file >   < file or directory >	CP  < file >   < file or directory > 

Getting help with commands
HELP  < command >			MAN -k  < topic > 
FASTHELP     (list of commands) 	MAN  < command > 

Move a file from one location to another, or rename the file
MOVE  < file >   < file or directory >	MV  < file >   < file or directory > 

Create a new directory
MD  < dir name > 			MKDIR   < dir name > 

Delete a file
DEL  < file(s) > 			RM  < file(s) > 

Delete a directory
RMDIR  < dir name >			RMDIR  < dir name > 

View the contents of a file all at once
TYPE  < file name > 			CAT  < file name > 

View the contents of a file one page at a time
TYPE  < file name >  | MORE 		MORE  < file name > 

Print a file
PRINT  < file name >  			LPR  < file name >  or LP  < file name > 

Some commands are found in DOS only. Why?

DISKCOPY - Many workstations don't have diskettes drives. Instead, they have tape drives or other devices that store larger amounts of data. For those workstations that do have a diskette drive (like the smaller workstations in the Computer Science department labs), one must be within reach of that drive to use it (in other words, at the console and not logged in via modem or telnet from another machine located elsewhere). On many large computer systems, only the support staff have access to the console and drives of the system (for security reasons).

FORMAT (ditto)

UNDELETE - sometimes works in DOS, impossible in Unix with multitasking

C: Disk drives are not addressed by letters as in DOS. All files on all drives are accessible through a single file hierarchy starting with the root directory "/"

Go to the index of lectures for ECS15 - Fall 1997 .

Go to the homepage for ECS15 - Fall 1997 .

© Nancy E. Reed, 1997 -- nereed@ucdavis.edu