Categories
Uncategorized

Operating system to learn (a) – understanding of the operating system from the history of design requirements

This is a family of operating systems first one.

Although the operating system is not a study of the history of the development of key operating system, but in the course of this development, derived from the many important concepts related to the operating system, if you know these concepts arise in the context of how, as well as the causes, in the latter part of the study will not feel some concepts appear relatively abrupt. In addition, understand the history of the development of operating systems, understand the design requirements, help us to stand in the perspective of the computer thinking.

ENIAC and serial processing

Development of computer dates back to 1946, the world’s first general-purpose computer “ENIAC” was born in February 14 this year (the day happens to be Valentine’s Day).

The picture shows the ENIAC

ENIAC 30.48 meters long and 6 meters wide, 2.4 meters high and covers an area of ​​about 170 square meters, 30 console, weighing 30 gross tons, 150 kilowatts power consumption, cost $ 4.8 million.

From this year until the mid-1950s, the operating system does not exist. After all, it was not yet operating system concept. What if the programmer wants to run the program, have to fight with a punch machine code on a tape (this is not only an intellectual alive, is still a job to be careful, you have the wrong one hole again. Imagine, let you write an article, not backspace, but can not be inserted in the middle … was a programmer too hard), then through input devices such as paper tape reader, loaded computer. Follow the steps on the computer running down step by step. Finished running, put the results printed out.

PS: last ten years, programming languages ​​also have great development, this late stage would have been a high-level language –FORTRAN. Compiler, linker, libraries, these concepts have been realized. So this time the computer is not your imagination so backward!

During this period, users on the machine if there is demand, we must make an appointment ahead of time, before you can go on the plane (to put the tape machine and the machine control to live is their own doing. When you have a programmer and hardware deal). Under such a model, the question arises:

    If you applied for one hour, but his task with only 35 minutes to run over, that extra 25 minutes so was wasted.

    If one hour is up, the user program has not finished running, the program will be forced to stop – which is equivalent to a waste of computing resources to a full hour. However, extension of time is not possible, there are people lined up behind it, but in case your program is supposed cycle of death.

Simple Batch Systems

In computing resources are scarce at the time, that the above serial processing caused a huge waste of resources, so scientists are unacceptable – need to improve the utilization of the computer.

Thus, the batch system was born.

The picture shows the most famous running IBM batch processing system IBSYS 7090, on it. This is also the world’s first all-transistor computer

The central idea is to use a batch processing system called monitor (monitor) software. Just mentioned, serial processing required to access the user’s own machine, the time period is fixed, but now they just want to submit a job to the computer operator, the operator will order these operations are organized into a group, then the whole batch jobs on the input device for the monitoring program.

Monitoring program has been a bit OS mean, it’s a good understanding of the work process:

  • Most of the monitoring program is always resident memory, this part is called the resident monitor (resident monitor).

  • At first, the computer monitor master control (nonsense, this time the user work load has not come yet), it reads a job from the input device, after reading later, the job is placed in the user program area and gain control. When the job is completed, control is returned again to the monitoring program.

With the post-monitoring program, to enhance the utilization of the computer – after a job is completed will immediately start a job under no idle time, the situation did not finish the job is terminated rarely occur (basically solved the serial processing The problem).

The correct functioning of the monitoring program is dependent on the hardware, in this period, in order reliability of the system, the computer manufacturers to provide a computer a few important features:

    Memory Protection: This is well understood, the memory space surveillance program can not be arbitrarily change the user program – either intentionally or unintentionally. But at the time this group of hackers have not yet developed, after all, computers and less expensive, can not “fly into the homes of ordinary people.” Once the hardware detects that a user program tries to make mischief, it will transfer control directly to the monitor, cancel the job.

    Timer: This feature is to prevent a monopoly operating system, after the job is to take over control of the timer to automatically turn on. If the timer expires and the job is not finished running, the program will be killed.

    Privileged instruction: Some machine instruction is set to privileged instructions (such as I / O instructions) can be executed only by the monitoring program. The user program can not directly use these instructions. Of course, users can request monitoring program to perform this operation for themselves. Privileged instruction is to limit the user program of “power” and set up, after all employers and employees can not have the same right to speak.

Memory layout monitoring program, the blue part is the protected memory area

These types of features, the memory protection and privileges Directive introduces the concept of mode of operation, we know that modern operating systems still retain these two features – enough to see their status.

Simple batch system already has the basic task scheduling capabilities, but it is still much room for improvement. Although simple batch system provides an automatic machine for the job sequence, but often the processor is idle, because the I / O device with respect to the much slower processor, the processor requires the I / O operation to complete the work and then .

for example:

CPU utilization = 1/31 = 3.2%

CPU utilization is too low. Is there any way to solve this problem?

Multichannel Batch Processing System

IBM System360, equipped with multi-channel batch operating system OS / 360, OS recognized landmark

We just said, the main reason is the low utilization rate of the CPU needs to wait for I / O operations, then we let the CPU busy is not it?

Multi-batch system is to let the secret of CPU busy. The method sounds simple – put a few user program in memory, if there is a job waiting for I / O, immediately switched to another may not need to wait for I / O operations. This process, known as multiprogramming (Multiprogramming) or multi-task processing (multitasking).

Let’s look at this approach is how to improve CPU utilization:

    FIG. A: A program running only

    FIG b: The user program on the memory A and B, when A while waiting for I / O operations, B is now running. (To facilitate understanding, we assume that A, B two programs competing IO resources is not the same)

    FIG c: the user program A, B, C is stored in memory at the same time.

We can visually see, in the same time, CPU run time is greatly improved, to meet our expectations.

Like simple batch systems, multiprogramming batch system must rely on some computer hardware features. The most notable feature is the support I / O interrupt (Interrupt), and direct memory access (Direct Memory Access, DMA). (DMA also requires interrupt support)

Interruption of the word, the first time I hear will feel a little iffy, if translated into “break” feel better understand it (that is, not very nice). When a job starts I / O operations, CPU will switch to another job, how do you know that this operating system I / O operation is ended when?

The answer is I / O interrupts, in the I / O operation, DMA module (module depending on what kind of system implementation) will send a signal to the CPU, CPU must stop the current thing to deal with this signal, multi batch system where the performance of control is transferred to the operating system interrupt handler. This process is the I / O device interrupt (Interrupt) things on the CPU at hand and instead do another thing.

So it interrupts the operating system to complete a variety of complex operations premise.

Multi-batch system is clearly more complicated than his predecessors, and by the operating system, they arise out of some of the more interesting topics:

    Job management: memory space is limited, meaning that the number of programs loaded into memory one time is limited, then how to choose the right job is loaded into memory from a problem in a job candidate, and this is is job management.

    Memory management: Select the job, you need to allocate space for the job, from which part of that space is designated for the job memory management needs to fix things free area.

    Process Scheduling: The process is carried out in the program, generally we loaded into memory process called job to job and unloaded distinction. When the scheduling process is required when the handover process, taken from the appropriate queue in the process of the process by a an algorithm executed by the CPU is obtained.

In modern times, because increase memory capacity, there is rarely if necessary queued jobs in the background, so the future will only spend a small amount of ink job management to introduce. However, memory management and process scheduling will be the focus of our future study.

Time-Sharing System

UNIX is the most famous time-sharing operating system

Multi-batch system can be said to be the prototype of a modern operating system, batch job to deal with it when processor utilization is relatively satisfactory, but the face of multiple interactive jobs, multi-batch system becomes insufficient.

Emergence of interactive job well understood, after all, we are now almost all applications are interactive, you slide the screen, this article will slide up and down a share point, there will be a variety of options, and so on and so forth.

In an interactive job, the inevitable need to wait for the user to make operation, but can not allow the processor to stop and wait for you, after all, many people are using the same computer, so the time-sharing system came into being.

As the name suggests, it is the n users sharing operating system, the operating system controls each user program in a very short time in units alternately performed. Because people’s reaction is relatively much slower machines, if properly controlled, you will feel that they are exclusive to this station computer.

Multi mention that rely on time-sharing system switching process is that we emphasize in the batch system interruption, it is not the same, here is the clock interrupt interrupt – a time to issue an interrupt signal to the CPU.

If multiple users are running the interactive program, seen as a more interactive programs a user runs, as we now use as a personal computer, it is easy to understand the modern operating system:

    Multiple processes share a processor, each process is assigned a time slice, and in front of the computer you seem as if multiple processes in parallel.

    A process for I / O operations will be blocked by the operating system, the blocking queue waiting for I / O operation is completed, in order to have the opportunity to use the CPU.

    Multiple processes in memory storage, operating systems need to prevent the process to write information to the memory of other processes. In particular to protect the operating system’s own memory space.

    User program running in user mode, privileged instructions not authorized to use, need to make a request to the operating system.

Talked about this, we have to understand the development of the operating system, in fact, there are other operating systems, such as real-time operating system, network operating systems, distributed operating systems, etc., but these operating systems is no correlation with our lives large (for embedded real-time operating system is still very important), so skip this article, interested can access relevant information.

Hopefully after finished reading this article, you can have a simple impression of the design concept of the operating system, if this article has aroused your interest in the operating system, it could not be better.

Thank you for reading, we meet again!

Disclaimer: original article without permission is prohibited reprint

Leave a Reply