The UUID code of Linux

Source: Internet
Author: User
Tags uuid

Before mentioning this, there is a concept of what is a UUID?

UUID is a universal unique identifier (universally unique Identifier, UUID), it is a software construction standard, also for the Free Software Foundation (Open Software Foundation, OSF) organization in the Distributed computing environment Part of the field (distributed Computing Environment, DCE).

The purpose of the UUID is to allow all elements in a distributed system to have unique identifying information, without the need to specify the identification information through the central control terminal. In this way, everyone can create a UUID that does not conflict with others. In such a case, there is no need to consider the name duplication problem when the database was created. It makes the UUID code generated by any computer on the network, which is the only one on the Internet throughout the server network. Its original information will be added hardware, time, machine current operation information and so on.

The UUID format is: Contains 32 16 digits, with "-" connection number is divided into five segments, in the form of 8-4-4-4-12 32 characters. 550e8400-e29b-41d4-a716-446655440000, so: The total number of UUID in theory is 216 x 8=2128, approximately equal to 3.4 x 1038. That is, if you produce 1 trillion uuid per second, it will take 10 billion years to run out of all the UUID.

In fact, we do database design time, must have heard, GUID (Global unique identifier) code, it is actually similar to the UUID, supported by Microsoft. This code is basically generated by the operating system kernel. It's easy to get this UUID code in Windows, whether it's a database or any other software, you remember.

The UUID code of Linux

The UUID code of Linux is also provided by the kernel, in/proc/sys/kernel/random/uuid this file. In fact, the random directory, there are many other files, are related to the generation of UUID.

[Email protected] ~/shell]$ Cat/proc/sys/kernel/random/uuid
dff68213-b700-4947-87b1-d9e640334196
[Email protected] ~/shell]$ Cat/proc/sys/kernel/random/uuid
7b57209a-d285-4fd0-88b4-9d3162d2e1bc
#连续2次读取, the resulting UUID is different.

[Email protected] ~/shell]$ cat/proc/sys/kernel/random/uuid| Cksum | Cut-f1-d ""
2141807556
#同上方法得到随机整数

The UUID code of Linux

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.