Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Lectures_SSD2_Yermakova / Lectures_SSD2 Yermakova.doc
Скачиваний:
226
Добавлен:
25.02.2016
Размер:
3.16 Mб
Скачать

Layers of Software

Let us now consider the layers of software that make up a computer system:

User-Written Scripts or Macros

User Interface

Application

Run-time Library

Application Program Interface

Operating System

Kernel

Device Drivers

BIOS

(Hardware)

Table 1 Layers of software

We will go through these levels from the bottom up:

  • Hardware, for our purposes, is the lowest level of the computer: the physical components from which it is constructed. Actually, there are several levels of hardware, since a computer is composed of circuit boards, a board contains multiple chips, chips are composed of circuits, and circuits are built from transistors. But, this unit is supposed to be about software, so we will ignore those details.

  • The BIOS, or Basic Input/Output System, is the most fundamental level of software. It deals directly with the signals that control each hardware component. Much of its work is performed when the computer is first turned on.

  • Device drivers are the helper programs the operating system uses to communicate with a specific model of device. To add new hardware to a system, the appropriate device drivers must be installed. (Peripheral components are often shipped with a floppy disk containing the necessary drivers.) The device driver for a hard drive, for example, knows how many tracks are on the drive and what commands to send to the drive to move the arm to a specific track and then read or write data. The advantage of this arrangement is that the operating system vendor does not have to be responsible for supporting every device ever invented, or that might be invented in the future. The device manufacturer supplies the driver, and as long as the driver follows the established conventions for communicating with the operating system, the device should be usable.

  • The kernel is the heart of the operating system and performs the functions that are most crucial for keeping everything running. It manages memory, decides which task to run next, and handles the various types of interrupts that can occur. The kernel must stay resident in RAM at all times, and because of its special nature, it must run without some of the protection mechanisms that guard against faulty instructions or illegal memory accesses. Therefore, it is kept as small as possible.

  • The remaining layer of the operating system is much larger than the kernel. It implements all the other functions the operating system is expected to perform. For example, it includes a file system for managing the folders and files on a disk. Refer to 3.4 File Systems for a more detailed discussion of this material. It communicates with the kernel when it needs to perform basic actions, such as initiating a data transfer operation to a peripheral.

  • The application program interface, or API, is the layer where user programs (applications) communicate with the operating system. For example, suppose a Web browser application decides it needs more memory in order to display a large image file. The operating system is responsible for keeping track of which programs are using which chunks of memory at any given time. This information is encapsulated within the operating system; the application does not know anything about how the information is organized. It does not have to. The operating system defines an abstraction for managing memory known as an API call. All the application developer has to know is which API call to use to ask for more. If a new version of the operating system comes along that uses a different way to keep track of memory, the application program will continue to work just fine as long as the API call stays the same.

  • Run-time libraries are collections of software routines that application programs rely on. For example, if you write an application in the C language to open a file and read some data from it, you will use two built-in functions called fopen and fscanf. These functions are fetched from a library of I/O routines called stdio that can be used by any C program. They will make the appropriate API calls to get the operating system to do what you need. The nice thing about the stdio abstraction is that your program is not dependent on a specific set of API calls, so you can run it on any machine that has a C compiler and an implementation of the C runtime library. Most programs draw on routines from several libraries.

  • The application layer is where you will find the routines that do the actual work the application was created for.

  • The user interface layer is responsible for communication between the application and the user. It is typically a GUI (graphical user interface) composed of buttons and pull-down menus. Suppose the user wants the application to open a file. This requires a bit of dialog that is handled by the GUI. First, on theFile menu, the user clicks Open.... The Open dialog box appears and prompts the user to select a file. Once the user has selected a file, the GUI passes the request and the file name to the application, which opens and processes the file.

  • Scripts or macros are routines that many applications allow users to create from the application's set of built-in commands. Scripts and macros allow users to automate sequences of actions they perform frequently. For example, a Microsoft Excel macro might open a file, copy a bunch of numbers from the file to a spreadsheet, perform some calculation on them, and write the results to another file. If these calculations update the values of a user's stock portfolio, he or she will want to perform the calculations every day—so it might be worthwhile for them to collect the calculations into a script that can be executed with just a few keystrokes. That way the user can forget about the details. Scripts are located above the application layer in the software hierarchy because they are built from application-level commands.

The computer industry today relies on specialists in each of the levels listed above. Some people make their living writing BIOS software, while others concentrate on improving GUI technology. But, the greatest number of programmers is found at the application level, because people want to use computers for so many different tasks.

1 Croutons are small toasted cubes of bread that are popular in salads in the U.S.—where a salad will typically be leaves of lettuce, slices of tomato (or the tiny cherry tomatoes), and sometimes slices of other vegetables like cucumber or green pepper. The croutons go on top!