The concept of computer systems (2)

Source: Internet
Author: User

In this paper, we want to talk about the representation of information in computers.

Representation of a computer information

The calculations we learn in mathematics are based on the decimal. This kind of derivation, which originated in India, spread to Arabia in the 12th century, was improved in Arabia, and then spread to the west in 13th century. This is the most widely used Arabic numeral of our day, it contains 0~9 altogether 10 symbols.

The decimal feature is that there are 10 different tokens that are encountered with a full multiple of 10 rounding.

When constructing a machine that stores and processes information, it is not appropriate to use decimal, but to use binary. It records information by the physical properties of some substances, such as high or low voltage, power-on or no-power, perforated or non-porous holes.

The binary feature is that there are 2 different tokens that are encountered with a full multiple of 2 rounding.

This simple way, for industrial manufacturing provides a stable foundation, now the process has been able to integrate tens or even billions of circuits on a chip.

But using the information represented by the computer may not be as accurate in mathematical calculations.

First, the computer numerical calculation is a range, out of range can get the wrong result;

Secondly, the computation of computer is limited by the precision, and error will occur when the accuracy is exceeded.

The calculation of the last computer does not conform to certain mathematical laws.

Therefore, we should start from the storage of computer information, understand the characteristics of computer information storage, in order to avoid the wrong calculation.

Two information storage

For the convenience of computer information representation, it is also often used in octal, hexadecimal.

The hexadecimal feature is that there are 16 different tokens that encounter a full multiplier of 16 rounding.

The hexadecimal symbol, in addition to the decimal 0~9, contains, a,b,c,d,e,f, and so on. Each character corresponds to a four bit bit, such as a hexadecimal 0Xf, in binary notation, which is 1111. That is, the decimal 15.

When we install the Windows system, we want to divide 32 bits, 64 bits. Some software, also divided into 32-bit, 64-bit. So what does this "bit" mean?

In contrast to 32-bit technology, this bit of 64-bit technology refers to the data width of the CPU GPRs (general-purpose registers, universal Register) is 64 bits, and the 64-bit instruction set is the instruction to run the 64-bit data. This means that the processor can run 64bit data at a time.

If the CPU is 64-bit, but the operating system is 32-bit, the performance of the CPU can not be fully developed, the most intuitive feeling is that the installation of 32-bit system is slower than the 64-bit system. Of course, this also requires other hardware to meet the basic requirements of installing a 64-bit system.

32-bit and 64-bit systems, for our daily applications, 32-bit systems can only identify about 4G of virtual address space, the system actually available memory 3.25G. While 64-bit system, theoretically can support 2 of the 64-square virtual address space, but the current system supports up to 128G of memory, and the current mainstream motherboards, generally support to 32G of memory.

This is the configuration of a PC server I used in my work. The system uses a 64-bit cpu,64 bit, and 32G of memory.

Here, we need to make a clear concept, is the machine word length:

32-bit system, a machine word length is 32bit;

64-bit system, a machine word length is 64bit.

For the C language, each data has its own specific type, but the data itself is a bit sequence consisting of 0 and 1, and how is the type differentiated?

In fact, different data types, except the context, only have a distinction in length.

The following list lists the C common numeric types that occupy several characters

C Declaration

32-bit system (character)

64-bit system (character)

Char

1

1

Short int

2

2

Int

4

4

Long int

4

8

char*

4

8

Float

4

4

Double

8

8

Note that the pointer type, regardless of the specific type, occupies a machine word length.

For data types that exceed 1 characters in length, there are two ways in which the machine is actually stored:

One is the small-end method, one is the big-endian method.

The so-called small-end method, which means that the lowest memory location of the data is stored in the low-efficient bit.

The big-endian method, which means that the minimum memory location for this data is stored as a high-efficient bit.

If we want to have the computer store a string, we need to encode the data. The encoding method, most commonly used, is to represent the ASCII encoding of English characters,

In addition, there is a more general encoding, which is Unicode encoding. Each of its characters accounts for 16bit, or 2 bytes. It can represent language characters in many countries other than English.

Both Java and. NET are encoded using this character set.

We used to say about the binary representation of the Hello World program. In fact, for different machines, the second binary is also different, and can not be compatible.

So if you want to write a program in one language and then run it on a computer with different architectures, you need to do special processing. Java's JVM, for example, is the ability to compile Java code into corresponding machine code sequences based on different machine architectures. Thus realizing the cross-platform of Java's "one compile, run everywhere".

Having said the values and characters, let's talk about the mathematical characteristics of binary.

The computer stores the data using binary, which is very similar to the "Boolean algebra" in mathematics. In a Boolean algebra, there are only 2 values: TRUE or FALSE. In computer languages, a data type called BOOL is generally included. Studying this type of data is helpful for us to learn how to store and operate computers.

Lists some of the mathematical characteristics of the bool type.

In C, there are three types of Boolean operations available for data:

1 Bitwise Boolean operation.

2 logical operation and short circuit logic operation.

3 shift Operation: Left displacement operation, logical right displacement operation, arithmetic right shift operation.

These operations are generally present in advanced computer languages, and their basic rules are basically consistent with the C language.

Three summary

This section mainly describes the form of computer information storage, as well as some basic operational characteristics.

The computer encodes the information into a sequence of bit bits. There are different encoding methods used to represent integers, real numbers, and strings. The bit sequences produced by computers of different architectures when encoding numbers and multibyte data are different.

Boolean operations are important ways of computing in a computer.

The concept of computer systems (2)

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.