What is it called when a computer is turned on the operating system is loaded into the computers memory for auxiliary storage?

▲7.1    INTRODUCTION

    A computer is a system composed of two major components: hardware and software. Computer hardware is the physical equipment. Software is the collection of programs that allows the hardware to do its job. Computer software is divided into two broad categories: the operating system and application programs.(Figure 7.1)

Figure 7.1    A computer system

What is it called when a computer is turned on the operating system is loaded into the computers memory for auxiliary storage?

7.1.1    Operating system

    An operating system is an interface between the hardware of a computer and the user (programs or humans) that facilitates the execution of other programs and the access to hardware and software resources.

    Two major design goals of an operating system are:

        1.Efficient use of hardware.

        2.Easy of use of resources.

7.1.2    Bootstrap process

    The operating system itself is a program that needs to be loaded into the memory and be run. So, how is this dilemma solved?

    The problem can be solved if the operating system is stored (by the manufacturer) in part of memory using ROM technology. The program counter of the CPU can be set to the beginning of this ROM memory. When the computer is turned on, the CPU reads instructions from ROM and executes them. This solution, however, is not very efficient, because a significant part of the memory would needs to be composed of ROM and could not therefore be used by other programs. Today's technology needs to allocate just a small part of memory to part of the operating system.

    The solution adopted today is a two-stage process. A very small section of memory is made of ROM and holds a small program called the bootstrap program. When the computer is turned on, the CPU counter is set to the first instruction of this bootstrap program and executes the instructions in this program. This program is only responsible for loading the operating system itself, or that part of it required to start up the computer, into RAM memory. When loading is done, the program counter in the CPU is set to the first instruction of the operating system in RAM and the operating system is executed. 

    Figure 7.2 illustrates the bootstrap process.

Figure 7.2    The bootstrap process

What is it called when a computer is turned on the operating system is loaded into the computers memory for auxiliary storage?

▲7.2    EVOLUTION

    Operating systems have gone through a long history of evolution, which we summarize next.

7.2.1    Batch systems

    Batch operating systems were designed in the 1950s to control mainframe computers. At that time, computers were large machines that used punched cards for input, line printers for output, and tape drives for secondary storage media.

    Each program to be executed was called a job.

    A programmer who wished to execute a job sent a request to the operating room along with punched cards for the program and data. The punched cards were fed into the computer by an operator. If the program was successful, a printout of the result was sent to the programmer—if not, a printout of the error was sent.

    Operating systems during this era were very simple: they only ensured that all of the computer's resources were transferred form one job to the next.

7.2.2    Time-sharing systems

    To use computer system resources efficiently, multiprogramming was introduced. The idea is to hold several jobs in memory at a time, and only assign a resource to a job that needs it on the condition that the resource is available.

    Multiprogramming brought the idea of time sharing: resources could be shared between different jobs, with each job being allocated a portion of time to use a resource.

    Multiprogramming, and eventually time sharing, improved the efficiency of a computer systems tremendously.However, they required a more complex operating system.The operating system now had to do scheduling: allocating resources to different programs and deciding which program should use which resource, and when.

    The user could directly interact with the system without going through an operator. A new term was also coined: process. A job is a program to be run, while a process is a program that is in memory and waiting for resources.

▲7.3    COMPONENTS

    Today's operating systems are very complex. An operating system needs to manage different resources in a computer system. A modern operating system has at least four duties: memory manager, process manager, device manager, and file manager. Like many organizations that have a department that is not necessarily under any specific manager, an operating system also has such a component, which is usually called a user interface or a shell. The user interface is responsible for communication outside the operating system. (Figure 7.3)

Figure 7.3    Components of an operating system

What is it called when a computer is turned on the operating system is loaded into the computers memory for auxiliary storage?

7.3.1    User interface

    Each operating system has a user interface, a program that accepts requests from users and interprets them for the rest of the operating system. A user interface in some operating systems, such as UNIX, is called a shell. In other, it is called a window to denote that it is menu driven and has a GUI (graphical user interface) component.

7.3.2    Memory manager

    Operating systems can be divided into two broad categories of memory management: monoprogramming and multiprogramming.

Mono programming

    In monoprogramming, most of the memory capacity is dedicated to a single program: only a small part is needed to hold the operating system. (Figure 7.4)

    However, there are several problems with this technique:

        1.The program must fit into memory. If the size of memory is less than the size of the program, the program cannot be run.

        2.When one program is being run, no other program can be executed. Input / output devices are slow compared with the CPU , so when the input / output operations are being carried out, the CPU is idle. It                  cannot serve another program because this program is not in memory. This is a very inefficient use of memory and CPU time.

Figure 7.4    Monoprogramming

What is it called when a computer is turned on the operating system is loaded into the computers memory for auxiliary storage?

Multi programming

    In multiprogramming, more than one program is in memory at the same time, and they are executed concurrently, with the CPU switching rapidly between the programs. (Figure 7.5)

Figure 7.5    Multiprogramming

What is it called when a computer is turned on the operating system is loaded into the computers memory for auxiliary storage?

    Since the 1960s, multiprogramming has gone through several improvements that can be seen in the taxonomy .(Figure 7.6)

    Two techniques belong to the nonswapping category, which means that the program remains in memory for the duration of execution. The other two techniques belong to the swapping category. This means that, during execution, the program can be swapped between memory and disk one or more times.

Figure 7.6    Categories of multiprogramming

What is it called when a computer is turned on the operating system is loaded into the computers memory for auxiliary storage?


Partitioning

    The first technique used in multiprogramming is called partitioning.

    It starts with one program, executing some instructions until it either encounters an input/output operation or the time allocated for that program has expired. The CPU then saves the address of the memory location where the last instruction was executed and moves to the next program. The same procedure is repeated with the second program. After all the programs have been served, the CPU moves back to the first program. Priority levels can also be used to control the amount of CPU time allocated to each program. (Figure 7.7)

Figure 7.7    Partitioning

What is it called when a computer is turned on the operating system is loaded into the computers memory for auxiliary storage?

With this technique, each program is entirely in memory and occupying contiguous locations. Partitioning improves the efficiency of the CPU, but there are still some issues:

    If partition sizes are small, some programs cannot be loaded into memory. If partition sizes are large, there might be some 'holes' (unused locations) in memory.

    There may be some holes after completed programs are replaced by new ones.

    When there are many holes, the memory manager can compact the partitions to remove the holes and create new partitions, but this creates extra overhead on the system.

Paging

    Paging improves the efficiency of partitioning. In paging, memory is divided into equally sized sections called frames. Programs are also divided, into equally sized sections called pages. The size of a page and a frame is usually the same and equal to the size of the block used by system to retrieve information from a storage device. (Figure 7.8)

Figure 7.8    Paging

What is it called when a computer is turned on the operating system is loaded into the computers memory for auxiliary storage?

With this technique, the program does not have to be contiguous in memory: two consecutive pages can occupy noncontiguous frames in memory.

Demand paging

    In demand paging the program is divided into pages, but the pages can be loaded into memory one by one, executed, and replaced by another page. In addition, consecutive pages from the same program do not have to be loaded into the same frame—a page can be loaded into any free frame. (Figure 7.9)

Figure 7.9    Demand paging

What is it called when a computer is turned on the operating system is loaded into the computers memory for auxiliary storage?

Demand segmentation

    In demand segmentation, the program is divided into segments that match the programmer's view. (Figure 7.10)

Figure 7.10    Demand segmentation

What is it called when a computer is turned on the operating system is loaded into the computers memory for auxiliary storage?


Virtual memory

    Demand paging and demand segmentation mean that, when a program is being executed, part of the program is in memory and part is on disk. (Figure 7.11)

    Virtual memory, which implies demand paging, demand segmentation, or both is used in almost all operating systems today.

Figure 7.11    Virtual memory

What is it called when a computer is turned on the operating system is loaded into the computers memory for auxiliary storage?

7.3.3    Process manager

    A second function of an operating system is process management, but before discussing this concept, we need to define some terms.

Program, job, and process

    Modern operating systems use three terms that refer to a set of instructions: program, job, and process.

Program

    A program is a nonactive set of instructions stored on disk ( or tape). It may or may not become a job.

Job

    A program becomes a job from the moment it is selected for execution until it has finished running and becomes a program again.

Process

    A process is a program in execution. It is a program that has started but has not finished.

State diagrams

    The relationship between a program, a job, and a process becomes clearer if we consider how a program becomes a job and how a job becomes a process. This can be illustrated with a state diagram that shows the different states of there entities. (Figure 7.12)

Figure 7.12    State diagram with boundaries between program, job, and process

What is it called when a computer is turned on the operating system is loaded into the computers memory for auxiliary storage?

Process synchronization

    The whole idea behind process management is to synchronize different processes with different resources. Whenever resources can be used by more than one user ( or process, in this case ), we can have two problematic situations: deadlock and starvation.

Deadlock

    Deadlock occurs if the operating system allows a process to start running without first checking to see if the required resources are ready, and allows a process to hold a resource as long as it wants. (Figure 7.16 and Figure 7.17)

Figure 7.16    Deadlock

What is it called when a computer is turned on the operating system is loaded into the computers memory for auxiliary storage?

Figure 7.17    Deadlock on a bridge

What is it called when a computer is turned on the operating system is loaded into the computers memory for auxiliary storage?

Starvation

    Starvation is the opposite of deadlock. It happen when the operating system puts too many resource restrictions on a process. (Figure 7.18 and Figure 7.19)

Figure 7.18    Starvation

What is it called when a computer is turned on the operating system is loaded into the computers memory for auxiliary storage?

Figure 7.19    The dining philosophers problem

What is it called when a computer is turned on the operating system is loaded into the computers memory for auxiliary storage?


▲7.4    A SURVEY OF OPERATING SYSTEMS

    7.4.1    UNIX

    UNIX is a multiuser, multiprocessing, portable operating system. It is designed to facilitate programming, text processing, and communication.

    7.4.2    Linux

    The initial kernel, which was similar to a small subset of UNIX, has grown into a full-scale operating system today.

Components

    Kernel

        The kernel is responsible for all duties attributed to a kernel, such as memory management, process management, device management, and file management.

    System libraries

        The system libraries hold a set of functions used by the application programs, including the shell, to interact with the kernel.

    System utilities

        The system utilities are individual programs that use the services provided by the system libraries to perform management tasks.