
- •Unit 3. Operating System Software
- •3.1 Structure
- •3.1.1 Layers of Software
- •3.1.2 The bios: Life at the Bottom
- •3.1.3 Process Control
- •3.2 Device Management and Configuration
- •3.2.1 Interrupt Handling
- •Interrupts
- •Interrupt Priority and Nested Interrupts
- •3.2.2 Hardware Attributes
- •Installing Drivers
- •3.2.3 Configuration
- •3.3 Resource Sharing
- •3.3.1 Virtual Memory
- •Virtual Memory
- •3.3.2 File and Printer Sharing
- •3.4 File Systems
- •3.4.1 File Organization
- •3.4.2 File Allocation Table and nt File System
- •Clusters and File Allocation Tables
- •Nt File System
Unit 3. Operating System Software
An operating system performs a vital role in enabling users to interact with a computer system. In this unit, we will learn about the specific responsibilities of an operating system, such as device management, memory management, resource sharing, and process control. After learning about the operating system, you will understand some of the problems that can cause your computer to perform less than optimally and some of the solutions that can resolve those problems. You will also learn how to customize your computing environment to your personal taste.
Readings:
3.1 Structure
3.2 Device Management and Configuration
3.3 Resource Sharing
3.4 File Systems
3.1 Structure
Just as we previously discussed with respect to hardware, a computer system's software has its own structure. The operating system is not a single entity but is composed of multiple layers, each with its own area of responsibility. The operating system's layers and the applications the user runs are considered unique "tasks" or "processes," competing for access to the CPU and other hardware resources. The management of this competition through the proper scheduling of processes is a major responsibility of an operating system and can have a significant impact on system performance.
3.1.1 Layers of Software
Layers and Process Management
Encapsulation and Abstraction
Layers of Software
Layers and Process Management
Software systems are composed of multiple layers, but the same can be said of many other features of everyday culture. In U.S. culture, to take just one example, when you sign a credit card slip to pay for dinner at a restaurant, as far as the credit card company is concerned, it is just "a meal." No more detail is required. But, the meal was actually composed of several courses. That is a layer of detail the waiter needs to keep track of in order to know what dishes to bring, and in what order. Let us say the first course was salad. The details of salad preparation were handled by another layer, the kitchen, where a chef tossed together lettuce, tomatoes, and some croutons—which came out of a box, at least as far as the chef was concerned. 1
But, where do croutons actually come from? They were bought from a bakery, which made them from flour, yeast, and seasoning. The flour came from a flourmill, which purchased wheat and ground it up. The wheat came from a farmer who planted seeds and eventually harvested the mature wheat plants. When you pay for your dinner, you are paying (indirectly) about one thousandth of a cent (assuming you are paying in U.S. currency) to that farmer for the wheat in your croutons. And, you are paying several thousand other people who contributed to your meal in various ways. Fortunately, you do not have to pay all those people directly! You make one payment for "a meal," and the details are sorted out in the layers below.
By organizing the production process into layers that are relatively independent, the entire system can be kept manageable, and great efficiencies can be achieved. In computer science, the principles underlying these benefits are called encapsulation and abstraction.
Encapsulation and Abstraction
Encapsulation means that each layer needs only a limited amount of knowledge to do its job, and none of the other layers has access to that information. The farmer does not know what the wheat will be used for. The bakery does not know how the wheat was harvested. And, you do not even need to know that croutons contain wheat! In the software world, encapsulation means that your word processing program does not need to know how to control disk drives in order to be able to open and save files; there are layers of software below it that handle those details.
However, if a layer were fully encapsulated it would be unable to communicate with the layers above and below. In order for there to be some exchange of information, but not too much, the designer of a layer specifies an abstraction that the layer promises to support. The bakery supports an abstraction called a "crouton order," whereby a customer can submit an order for X pounds of croutons and the bakery will respond by producing the croutons and delivering them. Inside the bakery, all sorts of things are going on that the customer does not see. For example, the bakery may have a big oven and a little oven, and the manager must decide which one to use to fill each order. Sometimes it might make sense to bake two small batches of croutons instead of one big batch. Sometimes one or the other oven is down for maintenance. These details are hidden from the customer; in computer science terminology we say the information is encapsulated. Furthermore, even if a customer somehow knew that there were two ovens, they could not specify which oven they wanted to be used to produce their order, because there is no place on the order form to indicate that. In computer science terms, we say that the crouton ordering abstraction does not support oven choice.
The existence of well-defined abstractions at each layer means that one implementation can be replaced by another with no effect on the layers above and below. Lots of bakeries sell croutons. If they all accept the same order form, it is possible to switch suppliers at will. On your computer, it is possible to have multiple implementations of a software component and switch from one to another. For example, your Web browser calls on a helper program when it needs to play a sound file or video clip. There are several programs that can perform this function. All you have to do is tell your browser which player to use. This isolation of functionality means that if a new, improved player becomes available, you can switch to that one; you do not have to get a completely new browser.
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 the File menu, the user clicksOpen.... 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!