페이지

2022년 4월 11일 월요일

1.2.1.1 Overview

 Hardware may trigger an interrupt at any time by sending a signal to the CPU, usually by way of the system bus. (There may be many buses within a computer system, but thesystem bus is the main communications path between the major components.) Interrupts are used for many other purposes as well and are key part of how operating systems and hardware interact.

When the CPU is interrupted, it stops what it is doing and immediately transfers execution to a fized location. The fized location usually contains the starting address where the service routine for the interrupts is located. 

The interrupt service routine executes; on completion, the CPU resumes the interrupted omputation. A timeline of this operation is shown in Figure 1.3.

To run the animation assicated with this figure please click here.

Inerrupts are an important part of a computer architecture. Each computer design has its own interrupt machanism, but serveral funtions are common. The interrupts must transfer control to the appropriate interrupts service routine. The straightforward method for managing this transfer would be to invoke a generic routine to examine the interrupt information. The routine, in turn, would call the interrupt0specific handler. However, interrupts must be handled quickly, as they occur very frequently: A table of pointers to interrupt routine is called indirectly through the table, with no intermediate routine needed.

Generally, the table of pointers is stored in mow memory(the first hundred or so locations). These location hold the addresses of the interrupts service routines of the various devices. This array, or interrupt vector, of addresses is then indexed by a unique number, given with the interrupt request, to provide the address of the interrupt service routine for the interrupting device. Operating system as different as Windows and UNIX dispatch interrupts in this manner.

The interrupt architecture must also svae tghe state information of whatever was  interrupted, so that it can resotre this information after servicing the instance, by modifying register values-it must explicityl save the current state and then resotre that state before retuning. After the interrupt is serviced, the saved return address is loaded into the program counter, and the interrupted computation resumes as though the interrupt had not occurred.


1.2.1 Interrupts

 Consider a typical computer operation performing I/O. To start an I/O operation, the device driver loads the appropriate registers in the device controller, in turn, examines the contents of these registers to determine what action to take (such as "read a character from the keyboard"). The controller starts the transfer of data from the device to its local buffer. Once the transfer of data is complete, the device controller informs the device driver that it has finished its operation. The device driver then gives control to other parts of the operating system, possibly returning the data or a pointer to the data if the operation was a read. For other operations, the device driver returns statrus information such as "write completed successfully" or "device busy". But how does the controller inform the device dirver that it has finished its operation? This is accomplished via an interrupt.

1.2 Computer-System Organization

 A modern general-purpose computer system consists of one or more CPUs and a number of device controllers connected through a common bus that provides access between components and shared memory(Figure 1.2). Each device controller is in charge of a specific type of device (for example, a disk drive, audio device, or graphics display). Depending on the controller, more than one device may be attached. For instance, one system USB port can connect to a USB hub, to which serveral devices can connect, A device controller maintains some local buffer storage and a set of special-purpose registers. The device controller is responsible for moving the data between the peripheral devices that it controls and its local buffer storage.

Typically, operating systems have a device driver for each device controller. This device driver understands the device controller and providers the rest of the operating system with a uniform interface to the device. The CPU and the device controllers can execute in parallel, competing for memory cycles. To ensure orderly access to the shared memory, a memory controller synchronizes access to the memory.

In the following subsections, we describe some basics of how such a system operates, focusing on three key aspects of the system. We start with interrupts, which alert the CPU to events that require attention. We then discuss storage structure and I/O structure.


2022년 4월 10일 일요일

1.1.3 Defining Operating systems

 By now, you can probably see that the term operating system vcovers many roles and functions. That is the case, at least in part, because of the myriad designs and uses of computers. Computers are present within toasters, cars, ships, spacecraft, homes, and businesses. They are the basis for game machines, cable TV tuners, and industrial control systems.

To explain this diversity, we can turn to the history of computers. Although computers have a relatively short history, they have evolved rapidly. Computing started as an experiment to determine what could be done and quickly moved to fixed-purpose systems for military uses, such as code breaking and trajectiory plotting, and governmental users, such as census calculation. Those early computers evolved into general-purpose, multifuctino mainframes, and that's when operating systems were born. In the 1960s, Moore's Law predicted that the number of transistors on an integrated circuit would double every 18 months, and that prediction has held true, Computers gained in functionality and shrank in size, leading to a vast number of users and a vast number and variety of operating systems. (See Appendix A for more details on the history of operating systems.)

How, then, can we define what an operating system is? In general, we have no completely adequate definition of an operating system. Operating systems exist becase they offer a resonable way to solve the problem of creating a usable computing system. The fundamental goal of computer systems is to execute programs and to make solving user problems easier. Computer hardware is constructed toward this goal. Since bare hardware alone is not particularly easy to use, application programs are developed. These programs require certain common operations, such as those controlling the I/O devices. The common functions of controlling and allocating resources are then brought together into one piece of software:the operating system.

In additions, we have no universally accepted definition of what is part of the operationg system. A simple viewpoint is that it includes everything a vendor ships when yuu order "the operating system. "The features included, however, vary greatly across systems. Some systems take up less than a megabyte of space and lack even a full-screen editor, whereas others require gigabytes of spce and lack even a full-screen deitor, whereas others require gigabytes of space and lack even a full-screen ditor , whereas others require gigabytes of space and are based entirely on graphical windowing systems. A more common definition, and the one that we usually follow, is that the operating system is the one program running at all times on the computer - usually called the kernel. Along with the kernel, there are two other types of programs: system programs not associated with the operating of the system.

The matter of what constitutes an operating system become increasingly important as personal computers became more widespread and operating system grew increasingly sophisticated. In 1998, the United States Department of Justice filed suit against Microsoft, in essence claiming that Microsoft included too much functionality in its operating systems and thus prevented application vendors from competing.(For example, a web browser was an integral part of Microsoft's operating systems.) As a result, Microsoft's operating systems.)As a result, Microsoft was found guilty of using its operating-system monopoly to limit competition.

Today, however, if we look at operating systems for mobile devices, we see that once again the number of features constituting the operating system in increasing. Mobile operating systems-Apple's iOS and Google's Android-Features a core kernel along with middleware that supports databases, multimedia, and graphics(to name only a few).

In summary, for our purposes, the operating system includes the always-running kernel, middleware frameworks that ease application development and provide features, and system programs that aid in managing the system while it is running. Most of this text is concerned with the kernel of general purpose operating systems, but other components are discussed as needed to fully explain operating system design and operation.




1.1.2 System View

 From the computer's point of view, the operating system is the program most intimately involved with the hardware. In this context, we can view an operating system as a resource allocator. A computer system has many resources that may be required to solve a problem: CPU time, memory space, storage space, I/O devices, and so on. The operating system acts as the manager of these reources. Facing numberous and possibly conflicting requests for resources, the operating system must decide how to allocate them to specific programs and users so that it can operate the computer system efficiently and fairly.

A slightly different view of an operating system emphasizes the need to control the various I/O devices and user programs. An operating system is a control program. A control program manages the execution of user programs to prevent errers and improper use of the computer. It is especially concerned with the operating and control of I/O devices.

1.1.1 User View

 The user's view of the computer varies according to the interface being used. Many computer users sit with a laptop or in front of a PC consisting of a monitor, keyboard, and mouse. Such as system is designed for one user to monopolize ifs resource. The goal is to maximize the work (or play)that the user is performing. In this case, the operating system is designed mostly for ease of use, with some attention paid to performance and security and none paid to resource utilization-how various hardware and software and software resources and shared.

user


application programs

(compilers, web browsers, development kits, etc)


operating system


computer hardware

(cpu, memory, I/O devices, etc)


Increasingly, many users interact with mobile devices such as smartphones and tablets-devices that are replacing desktop and laptop computer systems for some users. These devices are typically connected to networks through cellular or other wireless technologies. The user interface for mobile computers generally features a touch screen, where the user interacts with the system by pressing and swiping fingers across the screen rather than using a physical keyboarod and mouse. Many mobile devices also allow users to interact through a voice recognition interface, such as Apple's Siri.

Some computers have little or no user view. For example, embedded computers in home devices and automobiles may have numeric keypads and may  turn indicator lights on or off to show status, but they and their operating systems and application are designed primarily to run without user intervention.


1.1 What Operating Systems Do

 We begin our discussion by looking at the operating system's role in the overall computer system. A computer system can be divided roughly into four components: the hardware, the operating system, the application programs, and a user.

The hardware-the central processing unit(CPU), the memory, and the input/output(I/O) devices- provides the basic computing resources for the system. The application programs-such as word processors, spreadsheets, compilers, and web browsers-define the ways in which these resources are used to solve users' computing probelems. The operating system controls the hardware and coordinates its use among the various application programs for the various users.

We can also view a computer system as consisting of hardware, software, and data. The operating system provides the means ofor proper use of these resources in the operating of the computer system. An operating system is similar to a govermment. Like a goverment, it performs no useful function by itself. It simply provides an environment within which other programs can do useful work.

To understand more fully the operating system's role, we next explore operating system from ttwo viewpoints: that of the user and that of the system.