Previous | Next | Table of Contents | Index | Program List | Copyright

1.7 Using an Operating System

The mechanics of entering a program as a source file and translating and executing it differ somewhat from system to system, although the general process is the same. In this section we describe this general process.

Operating Systems

Some of you will be using a time-shared computer. In this environment many users are connected by terminals to one large, central computer, and all users share the central facilities.

Many of you will be using a personal computer. A personal computer is a smaller, desktop computer that is used by one individual at a time. Regardless of what computer you are using, it will be necessary to interact with a supervisory program that is within the computer called the operating system. In time-shared computers, it is the responsibility of the operating system to allocate the central resources among many users. Some tasks of the operating system are:

The operating system on a personal computer performs these tasks as well; the only difference is that often there is no user validation.

Each computer has its own special control language for communicating with its operating system. Although space does not allow us to provide all the details here, we will discuss the general process. Your instructor will provide the specific commands for your system.

Logging On or Booting Up

Before you can use a time-shared computer, you must log on, that is, identify yourself to the operating system, which may check to determine that you have a valid account on the system. To use a personal computer, you must switch it on, then wait for a brief period while it starts, or boots up. The startup process begins with a very small program that loads the operating system. Because one small program loads the next, the process is called booting up, from the expression "picking yourself up by your bootstraps."

Creating a Program or Data File

In most cases, you will use a special program called an editor to enter your Ada program. An editor is a program that is used to create and modify program and data files. After accessing the editor, you can start to enter a new Ada program. Once your program is entered, you must save the program as a permanent file on disk. Follow these steps to create and save a program file:

  1. access the editor program;
  2. indicate that you are creating a new file and specify its name;
  3. enter each line of your program; and
  4. save your program as a permanent file in secondary memory.

Once you have created your program and you are satisfied that each line is entered correctly, you can attempt to compile, link (or bind), load, and execute it. Ada often requires that before you can use the compiler for the first time, you must set up a library. The command to do this depends on the specific compiler, and it is not repeated each time you log on or boot up. The Ada system will create some files or directories on your diskette or file system; they are for use by the compiler and linker, and you should not disturb them!

If your program will not compile because it contains errors, you must edit it to eliminate the errors before going further. Follow these steps to correct and reexecute a program file:

  1. reaccess the editor program;
  2. get your program file;
  3. correct the statements with syntax errors;
  4. save your edited program file; and
  5. compile, link (or bind), load, and execute the new program file.

A First Ada Program

Now that you have read about the steps in creating, compiling, and executing a program file, you probably want to try one. After getting the detailed instructions for using your class computer, operating system, and Ada compiler, try the program given in Program 1.1. Do not be concerned at this point about what each of the statements in this program means; just enter it exactly as given and take it from there. When the program is executed, the following line should appear on your display screen:

    Hello there. We hope you enjoy studying Ada!

Program 1.1
A First Ada Program

WITH Ada.Text_IO;
PROCEDURE Hello IS
   
BEGIN -- Hello
  
  Ada.Text_IO.Put (Item => "Hello there. ");
  Ada.Text_IO.Put (Item => "We hope you enjoy studying Ada!");
  Ada.Text_IO.New_Line;
  
END Hello;


Previous | Next | Table of Contents | Index | Program List | Copyright

Copyright © 1996 by Addison-Wesley Publishing Company, Inc.