CS10051 Review - Chapter 6 - Paul Durand

Sections 001/002 and 005/006 - Spring 2007



This chapter describes the way that the system software acts as an intermediary between the user and the ``naked'' machine that was presented in the previous chapter. The goal of the system software is to hide the details of the Von Neumann architecture from the user, present information in a way that is easy to understand and manage, and provide the user with easy and safe access to the resources available on the computer. The chapter begins by introducing the idea of system software and discusses the various roles it plays. It then analyzes assembly language as a user-oriented language that is much easier to write in than machine code. Finally, the chapter describes the purpose of the operating system, first from a functional point of view – user interface, security, efficiency, and safety – and, finally, from a historical point of view – its development through the different computer generations.

Chapter Objectives


The Von Neumann architecture is very difficult for a human to work with. Another layer of abstraction is required to improve the interface between the user and the computer. The system software hides the details of the Von Neumann architecture, and provides intuitive methods for accessing the computer’s resources and viewing information about the computer. Another important task of system software is to ensure the safety and security of operations on the computer.

System Software

The Virtual Machine

System software is a collection of programs for different tasks of the computer system. Altogether the system software, including the operating system, create a virtual environment for the user that hides the actual computer architecture. The operating system manages the interface to the user and communications with system software and application programs. The different tasks of the system software then map onto the computer architecture, while hiding the details from the user. The user interface manages the way the user views the computer, and expresses commands to it. Language translators allow the user to write new programs in a user-friendly language rather than in machine code. Memory managers handle the running of programs on the computer’s CPU. Information managers control the user’s view of the data stored on the computer, as files, databases, etc. The scheduler keeps track of all the tasks that are currently operating on the computer, and how they are allocated access to the CPU itself. Utilities provide basic services to the user or to other application programs. All these pieces of system software form a “virtual machine,” a metaphor for interacting with the computer that hides the architecture from the user.

Types of System Software

System software is not a single monolithic entity but a collection of many different programs. The single most important piece of system software is the operating system. The operating system controls the overall operation of the computer.


Assemblers and Assembly Language

Assembly Language

Machine language is nearly impossible for humans to program correctly. Everything is written in binary, where flipping one bit is nearly undetectable, but completely catastrophic. Adding an instruction changes all the branch instruction addresses, and data must be constructed by hand in binary. Assembly language is a more user-friendly way to describe an algorithm, while still close to the machine architecture. Assembly languages are considered low-level programming languages, because they are so close to machine code. High-level programming languages may describe algorithms in terms that are very unrelated to machine code and the computer architecture. Assembly language programs are translated into machine code by an assembler.

A simple assembly language is described in this section. Each assembly language instruction corresponds to a machine code instruction, but uses an English mnemonic name: LOAD, STORE, ADD, COMPARE, JUMP, etc. In addition, memory locations are described with symbolic addresses: names that are associated with particular parts of the assembly language program, and which the assembler translates into numeric memory addresses. Data values in assembly language are also described in more intuitive terms: in decimal, mathematical notation for numbers, or using text for strings or characters. Pseudo-ops are instructions that indicate something to the assembler, rather than being translated into machine code instructions. Indicating data, the start, or end of a program are typical pseudo-ops.

Examples of Assembly Language Code

The chapter contains several examples of assembly language programs that illustrate mathematical computations, conditionals, and loops, as they would appear in assembly language. It culminates in a program to compute the sum of numbers entered by a user.

Translation and Loading

The assembler takes an assembly language program, the source file, and translates it into machine code. Because one assembly instruction typically maps to one machine code instruction, this translation process is quite straightforward. The most complicated task is translating symbolic labels into memory addresses. The first step is to collect all labels in a symbol table. Next each is associated with a physical memory address. Last, every reference to a label is translated into a reference to the associated address. This may require more than one “pass” over the assembly language program. The translated program is written to an object file. A separate program called a loader moves the object file’s machine code into memory for execution.

Operating Systems

Functions of an Operating System

The operating system manages all the services, both system services and application programs that are provided to the user. The operating system program is always running, and uses the CPU whenever no other piece of software is using it. Its primary duty is to wait for input from the user, however it is expressed, and to respond to it. Its response may be to display something for the user, or to activate another program to make the response. Older operating systems provided a text-based interface for the user. Even today, most UNIX-based systems provide a text interface as well as a graphical one. Most modern operating systems interact primarily through a graphical user interface. The virtual environment of a GUI-based operating system is very high level, and driven by sophisticated metaphors that users become familiar with: desktops, windows, buttons, sliders, folders, files, and so forth.

In addition to interacting with the computer’s user, ensuring the security of the system is a major duty of an operating system. The operating system must prevent non-authorized people from using the computer, and must also prevent legitimate users from accessing data or programs they are not authorized to access. Most operating systems assign user names and passwords to individuals: a person cannot access the machine at all without entering a valid user name and password. Passwords are kept secret by encryption. Authorization lists can determine, for a valid user, which files and programs the user is permitted to access.

Because most modern computers exist on computer networks, in communication with other computers, security has taken on greater importance. Malicious or mischievous people frequently attempt to bypass a computer’s security systems. Computer viruses and worms are carefully designed programs that take advantage of gaps in an operating system’s security to cause damage or mischief.

A modern operating system ensures that multiple tasks of the computer may be underway at one time, and that the processor is constantly busy with work either requested by a user or required by the system itself. A process represents a program that is in execution: multiple processes are managed by the operating system using a queue, a waiting line, of processes that would like to use the CPU. One program at a time runs, others are ready to run, and still others are waiting, usually for some I/O event to take place.

When multiple processes are in progress over the same period of time, safe sharing of resources becomes an issue. Deadlock occurs when two processes are each holding a resource the other needs. Neither process will ever progress. The operating system must be designed either to prevent or to recover from deadlock situations. Several examples of deadlock prevention or recovery are given in this section.

Historical Overview of Operating Systems Development

First generation operating systems were really no system at all. Assemblers and loaders were almost the only system software provided, and users manually loaded and ran the assemblers and the resulting object program. Second generation, “batch” operating systems, ran collections of input programs one after the other. Users provided primitive commands to the computer through a command language: commands like “assemble,” “load,” “run,” etc. These commands, along with the user program, were provided in one file, which was then passed along to the computer to execute. Third generation operating systems, or multiprogramming operating systems, permitted multiple user programs to run at once. Now the operating system had to manage multiple processes and provide security so that individual programs did not damage each other and all got a chance to run. Fourth generation operating systems are called network operating systems. The virtual computer model seen by the user treats resources physically residing on the computer in the same way as resources available through the computer’s network.

The Future

Operating systems will continue to evolve into the future, with possible fifth generation systems including multimedia user interfaces, parallel processing systems, and completely distributed environments in which the location of resources is entirely hidden from the user.

Key Terms

Things You Should Know How To Do

Given a machine language program and a table of opcodes

Given an assembly language program and a table of opcodes

Explain the responsibilities of the operating system and how it meets them

Explain the 'three program state' system used by the operating system to efficiently
manage usage of the cpu.

Explain the process of program translation from source code to a program loaded into memory,
including compilers, assemblers, linkers, loaders