Python-based concurrency programming-operating system

Source: Internet
Author: User

First, operating system introduction 1, manual operation--punch card

The first computer was born in 1946--in the mid 1950s, computer work was still being done by hand. There is no concept of operating system at this time.

The programmer loads the perforated paper tape (or card) corresponding to the program and data into the input machine and then initiates the input machine to enter the program and data into the computer memory.

Then through the console switch startup program for the data run, the calculation is completed, the printer output calculation results; The user takes the result and unloads the paper tape (or card)

To get the next user on the machine.

Manual mode of Operation two features:

(1) User exclusive full machine. There is no wait for resources to be consumed by other users, but the utilization of resources is low.

(2) The CPU waits for manual operation. The utilization of the CPU is not sufficient.

In the late the 1950s, there was a contradiction between man and machine: The slow speed of manual operation and the high speed of the computer formed a sharp contradiction, the manual operation method has been strict

Heavy damage to the utilization of system resources (reducing resource utilization to a few percent, or even lower) and intolerable. The only solution: to get rid of people's hands

The automatic transition of the operation. In this way, batch processing occurs.

2. Batch processing--tape storage

Batch processing system: A system software loaded on a computer, under its control, the computer can automatically, batch processing of one or more users of the

(This job includes programs, data, and commands).

Batch processing system is divided into: online batch processing system and offline batch processing system

1, the online batch processing system first appears is the online batch processing system, that is, the input/output of the job is processed by the CPU.

A storage device is added between the host and the input machine-the tape is automatically controlled by the supervisory program running on the host computer, which can be completed in batches

Read the user's job on the input machine into the tape, then read the user's work on the tape into the host memory and execute and output the result to the output machine. Completed the last batch of

After the operation, the supervision program enters another batch of jobs from the input machine, saves on the tape, and repeats the process as described above.

The supervisory program handles the work continuously, thus realizes the automatic transfer of the job to the job, reduces the job settling time and the manual operation time, effectively overcomes

Human-machine contradiction, improve the utilization of the computer.

However, at job input and result output, the host's high-speed CPU is still idle, waiting for the slow input/output device to finish working: The host is "busy"


2. offline Batch processing system

To overcome and alleviate: the contradiction between high-speed host and slow-speed peripherals, improve CPU utilization, and introduce the Offline batch processing system, that is, I/O out-of-host control

Satellite machine: A unit that is not directly connected to the host and is specifically designed to deal with input/output devices.

Its functions are:

(1) Read the user's job from the input machine and put it on the input tape.

(2) Read the execution result from the output tape and pass it to the output machine.

In this way, the host is not directly related to the slow input/output devices, but with the relatively fast speed of the tape drive relationship, effectively alleviate the host and device

Contradiction. The host and the satellite machine can work in parallel, the two are clear division of labor, can give full play to the host's high-speed computing ability.

Offline batch processing system: the 1960s is widely used, it greatly alleviates the contradiction between the human machine and the host and peripherals.

Insufficient: The high-speed CPU waits for low-speed I/O when the input/output (I/O) request is issued each time the host memory is stored only in one job

Completion status, which causes the CPU to be idle. In order to improve CPU utilization, the multi-channel program system is introduced.

3. Multi-Channel program System 1, multi-channel program design Technology

The so-called multi-Channel program design technique means that multiple programs are allowed to enter memory and run simultaneously. That is, put multiple programs into memory at the same time and allow them to alternate in the CPU

, they share a variety of hardware and software resources in the system. When a program pauses to run due to an I/O request, the CPU immediately goes to run another program.

When the A program is calculated, I/O idle, a program I/O operation, the CPU is idle (b program is the same); Must a work is completed, B to enter the memory to start work,

Both are serial, complete the total time required =t1+t2.

The A and B programs are stored in memory at the same time, they can be interleaved and alternately run on the CPU under the control of the system: when a program is discarded due to request I/O operation

CPU, the B program can occupy the CPU, so the CPU is no longer idle, and the I/O operation is not idle, obviously, the CPU and I/O devices are "busy"

State, greatly improve the utilization of resources, and thus also improve the efficiency of the system, A, b all completed the time required <<t1+t2.

Multi-channel program design Technology not only makes the CPU fully utilized, but also improves the utilization of I/O devices and memory, thus improving the resource utilization and system throughput of the whole system.

Volume (Number of processes per unit of time), which ultimately improves the efficiency of the entire system.

The characteristics of multi-channel program operation in a single processor system:

(1) Multi-channel: In the memory of the computer to store several independent programs;

(2) macro-parallel: At the same time into the system of several procedures are in operation, that is, they have started their own operation, but have not finished running;

(3) Micro-serial: In fact, the various procedures with the CPU rotation, and alternately run.

The advent of the multi-channel program system indicates that the operating system is maturing gradually, and there have been job scheduling management, processor management, memory management, external equipment management,

file System Management and other functions.

since multiple programs are running on the computer at the same time, there is a concept of space isolation and only the isolation of the memory space can make the data more secure and stable. In addition to the space barrier

from outside, multi-channel technology also embodies the characteristics of space-time multiplexing for the first time, encounter IO operation on the switch program, so that the utilization of the CPU increased, the computer's working efficiency the rate also increases.

2. Multi-channel batch processing system

The mid 1960s, in the aforementioned batch processing system, the introduction of multi-channel program design technology to form a multi-channel batch processing system (short: Batch processing System).

It has two features:

(1) Multi-channel: The system can accommodate multiple jobs at the same time. These jobs are placed in the external memory, which form a fallback queue, and the system follows a certain scheduling principle each time from the backup job queue

One or more jobs are selected to run in memory, run job end, exit run, and fallback job entry run are automatically implemented by the system, thus forming an automatic switch in the system.

Continuous flow of work.

(2) Batch: During the system operation, the user is not allowed to interact with their job, that is: Once the job enters the system, the user can not directly interfere with the operation of their operations.

The goal of the batch processing system is to improve system resource utilization and system throughput, as well as the automation of the job flow.

One of the important drawbacks of batch processing system is that it does not provide human-computer interaction ability, which brings inconvenience to users.

Although the user exclusive full-machine resources, and direct control program run, you can always know the operation of the program. However, this mode of work is extremely inefficient due to the monopoly of the whole machine.

A new goal: not only to ensure the efficiency of the computer, but also convenient for users to use the computer. In the the mid 1960s, the development of computer and software technology made this

Pursuit becomes possible.


Due to the increasing CPU speed and the use of time-sharing technology, a computer can connect multiple user terminals simultaneously, and each user can use the computer on their own terminal, good

Like an exclusive machine.

Time-sharing technology: The operating time of the processor into a very short time slices, in turn, the processor allocated to the use of online operations.

If a job cannot complete its calculations within the time slice allocated to it, the job is temporarily interrupted, the processor is given another job, and the next round is resumed.

Because the computer is fast and the job runs very quickly, the impression to each user is that it seems that he has an exclusive computer. And each user can pass their own terminal to the system

issued a variety of operation control commands, in full human-computer interaction situation, complete the operation of the job.

A computer system with the above characteristics is called a time-sharing system, which allows multiple users to use the computer online simultaneously.


(1) Multiplexing. Several users use a single computer at the same time. Microscopic view is that each user takes turns to use the computer, macro view is the user work in parallel.

(2) Interactivity. The user can further make a new request to the system based on the response of the system to the request. This enables the user to interact with the system in a conversational manner,

is distinct from the batch processing system, so the time-sharing system is also called the interactive system.

(3) Independence. Users can operate independently of each other and interfere with each other. The system guarantees the integrity of the operation of each user program and does not confuse or destroy each other.

(4) timeliness. The system can respond to the user's input in a timely manner. One of the main indicators of CTSS performance is response time, which refers to: issuing commands from the terminal to the system to

The time that is required to answer.

  The main goal of the time-sharing system is to respond to the user in a timely manner, that is, the user is not waiting for the processing time of each command too long.

Time-sharing system can accept dozens of or even hundreds of users, because of limited memory space, often using a swap (also known as Exchange) method of storage. Jobs that are not "up" will be put

Into the disk, once the "turn", and then put it into memory, and the time slice run out, and then put the job back to disk (commonly known as "roll in", "roll Out" method), so that the same storage area in turn for multiple users service.

Multi-user Time-sharing system is one of the most commonly used operating systems in today's computer operation system.

Note: Time-sharing system of sub-work, in the absence of IO operation when the use of their own time slice was cut away, such a switch work does not improve the efficiency of the CPU,

Instead, the efficiency of the computer is reduced. But we sacrificed a bit of efficiency, but achieved the effect of multiple programs, so that you can listen to music on the computer while chatting QQ.

Python-based concurrency programming-operating system

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.