购买
下载掌阅APP,畅读海量书库
立即打开
畅读海量书库
扫码下载掌阅APP

3.1 Definition and Function

When you turn on your computer, it’s nice to think that you’re in control. There’s the trusty computer mouse, which you can move anywhere on the screen, summoning up your music library or Internet browser at the slightest whim. Although it’s easy to feel like a director in front of your desktop or laptop, there’s a lot going on inside, and the real man behind the curtain handling the necessary tasks is the operating system .

3.1.1 What is Operating System?

The operating system (OS) is the most important program that runs on a computer. Every general-purpose computer must have an operating system to run other programs and applications. Computer operating systems perform basic tasks (see Fig.3-1), such as recognizing input from the keyboard, sending output to the display screen, keeping track of files and directories on the disk, and controlling peripheral devices such as printers. In short, an operating system enables user interaction with computer systems by acting as an interface between users or application programs and the computer hardware.

Fig.3-1 Basic tasks of operating system

Most desktop or laptop PCs come pre-loaded with Microsoft Windows. Macintosh computers come pre-loaded with Mac OS X. Many corporate servers use the Linux or UNIX operating systems. The operating system (OS) is the first thing loaded onto the computer —without the operating system, a computer is useless.

More recently, operating systems have started to pop up in smaller computers as well. If you like to tinker with electronic devices, you’re probably pleased that operating systems can now be found on many of the devices we use every day, from cell phones to wireless access points. The computers used in these little devices have gotten so powerful that they can now actually run an operating system and applications. The computer in a typical modern cell phone is now more powerful than a desktop computer from 20 years ago, so this progression makes sense and is a natural development.

The purpose of an operating system is to organize and control hardware and software so that the device it lives in behaves in a flexible but predictable way. In this article, we’ll tell you what a piece of software must do to be called an operating system, show you how the operating system in your desktop computer works and give you some examples of how to take control of the other operating systems around you.

It is vital to understand that an operating system (OS) is just a program—a very large, very complex program, but still just a program. The OS provides support for the loading and execution of other programs (which we will refer to below as “application programs”), and the OS will set things up so that it has some special privileges which user programs don’t have, but in the end, the OS is simply a program.

3.1.2 Functions of Operating System

At the simplest level, an operating system does two things:

(1) It manages the hardware and software resources of the system. In a desktop computer, these resources include such things as the processor, memory, disk space and more (on a cell phone, they include the keypad, the screen, the address book, the phone dialer, the battery and the network connection).

(2) It provides a stable, consistent way for applications to deal with the hardware without having to know all the details of the hardware.

(3-1) The first task, managing the hardware and software resources, is very important, as various programs and input methods compete for the attention of the central processing unit (CPU) and demand memory, storage and input/output (I/O) bandwidth for their own purposes. In this capacity, the operating system plays the role of the good parent, making sure that each application gets the necessary resources while playing nicely with all the other applications, as well as husbanding the limited capacity of the system to the greatest good of all the users and applications.

The second task, providing a consistent application interface, is especially important if there is to be more than one of a particular type of computer using the operating system, or if the hardware making up the computer is ever open to change. A consistent application program interface (API) allows a software developer to write an application on one computer and have a high level of confidence that it will run on another computer of the same type, even if the amount of memory or the quantity of storage is different on the two machines.

Even if a particular computer is unique, an operating system can ensure that applications continue to run when hardware upgrades and updates occur. This is because the operating system — not the application — is charged with managing the hardware and the distribution of its resources. One of the challenges facing developers is keeping their operating systems flexible enough to run hardware from the thousands of vendors manufacturing computer equipment. Today’s systems can accommodate thousands of different printers, disk drives and special peripherals in any possible combination.

What does it mean for a program to be “running” anyway? Recall that the CPU is constantly performing its fetch/execute/fetch/execute/… cycle. For each fetch, it fetches whatever instruction the Program Counter (PC) is pointing to. If the PC is currently pointing to an instruction in your program, then your program is running! Each time an instruction of your program executes, the circuitry in the CPU will update the PC, having it point to either the next instruction (the usual case) or an instruction located elsewhere in your program (in the case of jumps).

The point is that the only way your program can stop running is the PC changed to point to another program, say the OS. How might this happen? Other than cases involving bugs in your program, there are only two ways this can occur:

Your program can voluntarily relinquish the CPU to the OS. It does this via a system call, which is a call to some function in the operating system that provides some useful service.

For example, suppose the C source file from which a.out was compiled had a call to scanf(). The scanf() function is a C library function, which was linked into a.out during compilation of a.out. But scanf() itself calls read(), a function within the OS. So, when a.out reaches the scanf() call, that will result in a call to the OS, but after the OS does the read from the keyboard, the OS will return to a.out.

The other possibility is that a hardware interrupt occurs. This is a signal—a physical pulse of current along an interrupt-request line in the bus—from some input/output (I/O) device such as the keyboard to the CPU. The circuitry in the CPU is designed to then jump to a place in memory which we designated upon bootup of the machine. This will be a place in the OS, so the OS will now run. The OS will attend to the I/O device, e.g. record the keystroke in the case of the keyboard, and then return to the interrupted program.

Note in our keystroke example that the keystroke may not have been made by you. While your program is running, some other user of the machine may hit a key. The interrupt will cause your program to be suspended; the OS will run the device driver for whichever device caused the interrupt — the keyboard, if the person was sitting at the console of the machine, or the network interface card, if the person was logged in remotely, say via telnet — which will record the keystroke in the buffer belonging to that other user, and the OS will do IRET, causing your program to resume.

So, when your program is running, it is king. The OS has no power to stop it. The only ways your program can stop running is if it voluntarily does so or is forced to stop by action occurring at an I/O device.

3.1.3 Types of Operating Systems

Here is an overview of the different types of operating systems.

1. Real-time Operating System

It is a multitasking operating system that aims at executing real-time applications. Real-time operating systems often use specialized scheduling algorithms so that they can achieve a deterministic nature of behavior. The main object of real-time operating systems is their quick and predictable response to events. They either have an event-driven design or a time-sharing one. An event-driven system switches between tasks based of their priorities while time-sharing operating systems switch tasks based on clock interrupts. Windows CE, OS-9, Symbian and LynxOS are some of the commonly known real-time operating systems.

2. Multi-user and Single-user Operating Systems

Computer operating systems of this type allow multiple users to access a computer system simultaneously. Time-sharing systems can be classified as multi-user systems as they enable a multiple user access to a computer through time sharing. Single-user operating systems, as opposed to a multi-user operating system, are usable by only one user at a time. Being able to have multiple accounts on a Windows operating system does not make it a multi-user system. Rather, only the network administrator is the real user. But for a UNIX-like operating system, it is possible for two users to log in at a time and this capability of the OS makes it a multi-user operating system. Windows 95, Windows 2000, Mac OS and Palm OS are examples of single-user operating systems. UNIX and OpenVMS are examples of multi-user operating systems.

3. Multi-tasking and Single-tasking Operating Systems

When a single program is allowed to run at a time, the system is grouped under the single-tasking system category, while in case the operating system allows for execution of multiple tasks at a time, it is classified as a multi-tasking operating system. Multi-tasking can be of two types namely, pre-emptive or co-operative . In pre-emptive multitasking, the operating system slices the CPU time and dedicates one slot to each of the programs. UNIX-like operating systems such as Solaris and Linux support pre-emptive multitasking. If you are aware of the multi-threading terminology, you can consider this type of multi-tasking as similar to interleaved multi-threading. Cooperative multitasking is achieved by relying on each process to give time to the other processes in a defined manner. This kind of multi-tasking is similar to the idea of block multi-threading in which one thread runs till it is blocked by some other event. MS Windows prior to Windows 95 used to support cooperative multitasking. Palm OS for Palm handheld is a single-task operating system. Windows 9x support multi-tasking. DOS Plus is a relatively less-known multi-tasking operating system. It can support the multi-tasking of a maximum of four CP/M-86 programs.

4. Distributed Operating System

An operating system that manages a group of independent computers and makes them appear to be a single computer is known as a distributed operating system . The development of networked computers that could be linked and made to communicate with each other, gave rise to distributed computing. Distributed computations are carried out on more than one machine. When computers in a group work in cooperation, they make a distributed system. Amoeba, Plan9 and LOCUS (developed during the 1980s) are some examples of distributed operating systems.

5. Embedded System

The operating systems designed for being used in embedded computer systems are known as embedded operating systems . They are designed to operate on small machines like PDAs with less autonomy. They are able to operate with a limited number of resources. They are very compact and extremely efficient by design. Windows CE, FreeBSD and Minix 3 are some examples of embedded operating systems. The use of Linux in embedded computer systems is referred to as Embedded Linux.

6. Mobile Operating System

Though not a functionally distinct kind of operating system, mobile OS is definitely an important mention in the list of operating system types. A mobile OS controls a mobile device and its design supports wireless communication and mobile applications. It has built-in support for mobile multimedia formats. Tablet PCs and smartphones run on mobile operating systems. Blackberry OS, Google’s Android and Apple’s iOS are some of the most known names of mobile operating systems.

7. Batch Processing and Interactive Systems

Batch processing refers to execution of computer programs in “batches” without manual intervention. In batch processing systems, programs are collected, grouped and processed on a later date. There is no prompting the user for inputs as input data are collected in advance for future processing. Input data are collected and processed in batches, hence the name batch processing. IBM’s z/OS has batch processing capabilities. As against this, interactive operating requires user intervention. The process cannot be executed in the user’s absence.

8. Online and Offline Processing

In online processing of data, the user remains in contact with the computer and processes are executed under control of the computer’s central processing unit. When processes are not executed under direct control of the CPU, the processing is referred to as offline. Let’s take the example of batch processing. Here, the batching or grouping of data can be done without user and CPU intervention; it can be done offline. But the actual process execution may happen under direct control of the processor, that is online.

Operating systems contribute to simplifying human interaction with the computer hardware. They are responsible for linking application programs with the hardware, thus achieving easy user access to computers. Ever imagined a computer without an OS? It wouldn’t be so user-friendly then! vtFsllWFtwPXz4s7IikM7b+frUCy2mi+ob99DKkfZx/FeVy9Dl88sSG4HIUtvuEV

点击中间区域
呼出菜单
上一章
目录
下一章
×