-
Sequential Programming:
Sequential execution of a program means that its execution on the processor is strictly ordered, i.e., subsequent operations can only start after the previous operation has ended. If there are multiple programs, they must be executed in strict order of invocation. Moreover, if these programs are interrupted, this is allowed, but not stopped, and the interruption will not affect the program in the end, that is, the program execution result has nothing to do with the execution speed.
For example, in the process of solving from top to bottom, the seventh row of the chickens and rabbits in the same cage program assigns the initial value to the variable, the eighth row finds the number of chickens, the ninth row finds the number of rabbits, and finally outputs;
Concurrent Programming:
The execution of the program is no longer sequential, one program finishes execution and the other program starts execution, the order outside the program disappears, and the program no longer corresponds to the computation one-to-one. The execution of a set of programs overlaps in time.
For example, in the process of taking an online class, students can complete the homework of the operating system while suspending the class, and the two do not interfere with each other.
-
Answer: (1) Sequentiality: Sequentiality includes two meanings: (1) internal sequentiality, for a process, all its instructions are executed in order; (2) External sequentiality, for multiple processes, all processes are executed sequentially.
2) Concurrency: Concurrency includes the following two meanings: (1) internal sequentiality, for a process, all its instructions are executed in order; (2) External concurrency, for multiple processes, all processes are cross-executed.
In the process of execution of the concurrent process, it is unpredictable which intersection situation occurs, which is the uncertainty of the concurrent process, and the operating system should ensure that no matter what kind of intersection situation occurs, the result of each process should be unique and correct.
-
Generally speaking, a job is a series of processes, and these series of processes follow a specific logic to achieve a certain function or transaction. Processes are a refinement of a job, and each process completes a specific function. Then the thread is a further refinement of the process, the process can be divided, but the thread is atomic, can not be divided again, just like the proton in chemistry, a series of threads form a process.
The unit of a process is relatively large, and the thread is the original unit, which cannot be divided into smaller parts.
-
Two or more programs on a physical machine are in a state of starting but not ending at the same time within a certain period of time, and the order is not predetermined. This can be associated with examples that I have encountered in my life.
-
The answer is c
The sequential execution of the program has the following characteristics.
1. Sequentiality.
2. Closed.
3. Certainty of the results of the implementation of the program.
4. Reproducibility of program execution results.
The sequential and closed nature of the above-mentioned procedures are the characteristics that all sequential procedures should have. From these two characteristics, it is not difficult to draw two other characteristics that the program has when it is executed. Deterministic characteristics and reproducibility of the results of the execution of sequential programs.
-
When a program is executed concurrently, multiple programs share various resources in the system, so the state of these resources will be changed by multiple programs, resulting in the operation of the program has lost its closed nature. At the same time, due to the loss of closure, it will also cause it to lose its reproducibility. When a program is executed concurrently, due to the loss of closedness, the computer result of the program has been related to the execution speed of the concurrent program after multiple executions, so that the execution of the program loses its reproducibility.
-
Compared with sequential execution, concurrent execution of programs will produce divisibility and loss of closure, and loss of reproducibility.
Severability: It is possible to improve the performance of computations through concurrent execution. Some programs don't need to be executed in parallel in nature, but if you can use multiple processors to compute at the same time, you may get a big speed increase, or meet a real need.
Loss of reproducibility: Computer hardware often controls a set of independent devices and components. The characteristics and operating speed of these components are different, and the corresponding control program is preferably a separate process, starting and ending or temporarily interrupting as needed.
Interaction with other threads running on the processor is required to achieve the overall behavior of the system.
Loss of closure: Many programs, especially servers, graphics applications, computer simulations, etc., need to do a lot of work that is basically independent of each other. The easiest and most logical way to construct such a program is to implement a job with a separate execution process.
-
1. The characteristics of concurrent and sequential execution of programs are: separability, loss of closure, and loss of reproducibility.
2. The main feature of program concurrent execution is that there is a mutually restrictive relationship between concurrent programs, and the program concurrent execution loses the closure and reproducibility of the program, and the activities of the program and the machine execution program no longer correspond one-to-one.
3. Program concurrent execution, that is, each part of the system no longer works in a simple serial way, and there is not only one activity in the system at the same time, but many parallel activities. From the perspective of program activity, there may be several operating procedures executed concurrently in the system at the same time or interspersed with each other. At this point, the computer is no longer simply executing a program in sequence.
That is, after the previous operation of a program ends, the system does not necessarily perform its subsequent operation immediately, but may move on to an operation of another program.
-
A program is a process, and multiple tasks in a program are called threads. A process is the basic unit that represents resource allocation and schedules operations. A thread is the smallest unit of operations performed in a process, that is, the basic unit for executing processor scheduling.
The relationship between processes and threads.
1) A thread can only belong to one process, while a process can have multiple threads, but at least one thread. A thread is the smallest unit of execution and scheduling that the operating system recognizes.
2) Resources are allocated to a process, and all threads of the same process share all the resources of the process. Multiple threads in the same process share segments (and constants), data segments (global and static), and extended segments (heap storage). However, each thread has its own stack, also known as the runtime, which is used to store all local and temporary variables.
3) The processor is assigned to the threads, that is, the threads that are really running on the processor.
4) During the execution of threads, they need to cooperate and synchronize. Threads of different processes should be synchronized by means of message communication.
If the process of teaching a lesson is likened to a process, then each student is a thread that shares the classroom, i.e., the threads share the memory space of the process. At any given moment, only one student can ask the teacher a question, and after the teacher has answered, it is the next turn. That is, the thread occupies the CPU in a time slice.
-
Think of it this way: "parallelism" in the operating system = = "simultaneity" in the principle of computer composition.
This should be a lack of rigor in the use of words, which violates the law of logical sameness.
Individuals agree with the statement that computers are composed of principles.
Whether it is an operating system or a computer composition principle, it all belongs to the category of computer science and technology, and the same law should be followed.
-
In the computer operating system, parallelism and concurrency are clearly distinguished, mainly from a microscopic point of view, specifically referring to the parallelism of processes (in the case of multiple processors, multiple processes run at the same time) and concurrency (in the case of a single processor, multiple processes run at the same time interval), the principle of computer composition is mainly from a macro point of view, concurrency is also parallel in the eyes of users, so parallelism includes concurrency. The main thing is to look at the problem from different angles and levels.
-
From a macro point of view, concurrency and parallelism are both two or more events occurring at the same time, but on a micro level, parallelism means that two or more events occur at the same time, that is, at the same time, while concurrency means that two or more events occur at the same time and occur at intervals.
-
Parallelism: It's like feeding a baby, where everyone takes care of a baby and feeds one bite at the same time.
Concurrency: It's like feeding a baby, one person takes care of multiple babies and takes turns feeding each baby a bite of food at short notice.
-
"Parallel" means that both are executed together, both from the micro and the macro, as if two people are digging a pit with a shovel each, and after an hour, each person has a big pit.
And "concurrency" is not executed at the micro level, but only divides the time into several segments, so that multiple processes can be executed quickly and alternately, and from the macro point of view, it seems that these processes are executing.
There are some differences in what concurrency means in different types of operating systems. In a single-processor operating system, only one program is running in the CUP at any given moment. But a longer period of time can be divided into many small periods of time to run different programs, so that all programs are running in this longer period of time.
These programs are concurrent and not parallel. It's like two people digging a pit with the same shovel, taking turns digging a pit, and after an hour, each of them digs a smaller pit, and if you want to dig two bigger pits, it will definitely take two hours.
From the above essence, it is not difficult to see that "concurrent" execution does not fundamentally improve the execution efficiency when there are resource conflicts in multiple processes.
-
Concurrency and parallelism are two concepts that are both similar and not the same: concurrency, also known as synchronicity, refers to the ability to handle multiple simultaneous activities; Parallelism refers to two concurrent events that occur at the same time, which has the meaning of concurrency, while concurrency does not necessarily mean that concurrent events do not have to occur at the same time.
1) The essence of concurrency is that a physical CPU (or multiple physical CPUs) is multiplexed between several programs, and concurrency is to enforce multi-user sharing of limited physical resources to improve efficiency.
2) Parallelism refers to the occurrence of two or more events or activities at the same time. In a multi-program environment, parallelism enables multiple programs to be executed simultaneously on different CPUs at the same time.
It was created by a small number of people based on their own religious beliefs that are different from traditional religions", it can be said that this sentence sums it up very incisively, but it is difficult for people to have a deep understanding. Everyone's understanding of the world is different, but to be creative and build a worldview that many people can believe in is not something that ordinary people can do, and it is necessary to have unique opinions. "Create" simply means "different", that is, to establish something that is different from tradition. >>>More
1. The only way for human beings to truly understand things is science, and so far, science has not discovered immaterial things, and by reasoning, all things (including various life forms) are material. >>>More
I. The general principle of necessity and contingency.
Necessity and contingency are a pair of philosophical categories that reveal two different tendencies in the development of things. >>>More
The diversity of cells is reflected in the differentiation of different structures of cells. It is mainly manifested in many aspects such as cell membrane, nucleus and cytoplasm. This is a microscopic view. >>>More
A single person cannot live, and when a person contributes to society, he has his own value.