In-depth understanding of computer systems (1.4)---concurrency and parallelism, talking about abstraction

Source: Internet
Author: User

This article reprinted address : http://www.cnblogs.com/zuoxiaolong/p/computer4.html

Introduction

Concurrency and parallelism have always been a hot word in the IT world, and I am sure you will never be unfamiliar to apes. In the computer system this book, concurrency and Parallelism is the interpretation that concurrency refers to a system with multiple activities at the same time, while parallel refers to the use of concurrency to make a system run faster .

This and the LZ before the understanding should be non-conflicting, before the LZ, concurrency is a pattern, and parallelism is one of the means to implement this pattern.

Thread-level concurrency

Threads are introduced under the abstract concept of the process, and the concept of thread-level concurrency refers to the activities of multiple threads at the same time (not absolute simultaneous) .

The operating system has undergone a great change from a single processor up to now multicore multiprocessor systems, and even hyper-threading technology. This also makes it more important for multithreaded programming to take advantage of the benefits of multiprocessor.

For multiprocessor systems, a good understanding of the fact is that more than one CPU is physically concentrated on the chip of an integrated circuit. For Hyper-Threading technology, it is the technology that uses n physical cores to simulate 2N logical cores. In hardware, hyper-threading requires that some parts of the CPU have multiple backups, such as registers and program counters, but only one copy of the other parts, such as the Alu.

Instruction-level parallelism

In the book, the interpretation of instruction-level parallelism is that if the processor can execute multiple instructions at the same time, this attribute is said to be instruction-level parallelism . In fact, command-level parallelism is the use of instructions in the execution of the process there will be different stages, or more precisely, at the same time will only use a portion of the CPU hardware, so you can use this to do multiple instructions in parallel execution.

Better Yet, many modern processors are able to execute an instruction with an average time of less than one cycle, a processor known as superscalar processors .

Single instruction, multi-data parallelism

the concept of single instruction and multi-data refers to the way that an instruction can produce multiple operations that are executed in parallel . Some of today's processors are equipped with special hardware to achieve this effect. Because of the multiple operations that are performed in parallel, multiple data is involved, and it can be understood as a single instruction to manipulate multiple data. For example in the book, some processors have instructions to add 4 pairs of single-precision floating-point numbers in parallel.

Simple Talk about abstraction

The importance of abstraction does not need to be emphasized, it has a self-evident position in the field of computer science. abstraction can make some concrete implementations more descriptive and can be defined in some way .

As a simple example, in the case of a class in Java, it is actually implemented by the compiler and the JVM, and the JVM itself is an abstract concept, and it will have a concrete implementation. In the case of the hotspot virtual machine we use, the implementation of the class is to store the information of the class in a permanent generation, and then the instance is stored in the heap, and in each instance, a reference to the class information is stored. So when we manipulate this instance, we use the class information to determine what we are doing and execute it.

The above is the LZ's personal understanding of class implementation, the JVM is not familiar with the ape friends may be more confused about this description. But it doesn't matter, you just need to know class can declare a class, and after you create an instance, use the instance name. The method name can call its method, the instance name. The variable name can get its property value (for simplicity, ignore access restrictions). This makes it easy to manipulate the class, and it is one of the meanings of abstraction, as well as the interpretation of the first sentence of the abstract description above.

For the next sentence, it's better to understand that Java Virtual machine is an abstraction, with this abstraction, we can develop specifications for Java virtual machines, which is the Java Virtual Machine specification.

Article Summary

This time we have a brief look at the concepts of concurrency and parallelism, and the importance of abstraction for computer science.

In-depth understanding of computer systems (1.4)---concurrency and parallelism, talking about abstraction

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: info-contact@alibabacloud.com 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.