HongMeng science
The cause of US curbing Chinese high technology
- China has already surpassed the US and even the West at certain technological levels at single points
- An important one is 5G technology, led by Huawei
-
China is the only country in the world where 5G is being rolled out on a large scale
-
Of course, Korea also has them
- But it doesn’t have that much influence, it doesn’t have that much market, it doesn’t have that many people, so it’s only China that can exert great pressure on the West
-
It can be said that when 5G comes out in China, from 5G to 6G, it is a revolution that overturns human life in the whole history
-
I am warmly hope that one day, at least for my work, his special wide bandwidth, and particularly good real-time performance, so for me, I can completely don’t have to sit in the office work, I can go to the seaside vacation, and then sitting on the beach talking about work, tired of the beach can drive to play in xinjiang, driving on the way to work, Because as long as there’s a network out there, and it’s stable and it’s real-time, it doesn’t really matter where I’m meeting, right
-
In addition to this, 5G has many new applications, which will bring great progress to the whole human society. We will wait and see, waiting for this day, 5G+ artificial intelligence, this should be a big subversion in human life
-
-
There is still a lot of misunderstanding about Hongmeng
- When Hongmeng first came out, a lot of people were like, I want to punch Microsoft and kick Google, and push Apple aside. This is a certain misunderstanding of Hongmeng
- First of all, It’s not competing with Windows, and it’s not competing with Linux. It’s not competing with Android. It’s not competing with Mac
- The meaning of Hongmeng lies in the interconnection of everything
- In particular, there is a scene called the Internet of cars. In the future, people’s cars will be a small platform for life, just like mobile phones today
- Is in the Internet of Things, smart home force, the focus of IoT(Internet of Things)
- It’s not about the desktop OS, it’s not about the server OS, it’s not about the phone OS
- After many markets are stopped, it is difficult for the latecomers to catch up
- PC: Windows+Intel
- Mobile: ARM+Android
- Many times it is difficult to get around them, in the future of the Internet of things, I hope “Hongmeng + Kylin” can have a place.
- The development of The Times, this time you take the lead, but when the era of the Internet of things comes, especially the 5G Internet of things, THE arrival of AI, and foreigners, you do not have 5G, I do not believe you can lead. The next leading, so far, Chinese products are promising
Hongmeng’s features:
- The biggest feature of Hongmeng lies in the kernel design:
- The microkernel
- Hongmeng claims to be the first microkernel operating system. Of course this is marketing propaganda, his accuracy is questionable.
- Many systems are working on this, but at least this is the first in China
- As a commercial microkernel, it is true that Hongmeng is neither number one nor number two
- Hongmeng is already running on some of the equipment
- Smart screen TV
- This is why the West has spared no effort to restrain China’s high-tech development. Because once 5G is ahead, it means that for the first time in centuries, a non-Western country is ahead.
- This will work for them for a while, but I don’t think they will be able to stop it. 5G is something that the United States cannot deploy, and it will not be profitable after deployment. China has a huge market. Just like high-speed rail, it is only in China that there is huge room for growth.
- Hongmeng is already running on some of the equipment
- Technical specifications
- Microkernels are for 5G and the Internet of everything
- Flexible deployment: It is advertised as full scenario
- Flexible deployment means that the operating system can be deployed on a small chip as well as on a large PC
- It’s not that demanding on hardware. Hardware can be very flexible. How much memory does the hardware have? I can handle smaller memory, and I can handle strong hardware
- It’s open source
- Like Linux is open source, cash out of Huawei’s mind
- Closed-source products will be eliminated sooner or later
- Not long ago, China and the US were engaged in a trade war. It was said that the US and The Us were going to kill off all of China’s operating systems. I raised my hand to welcome them. But he did not dare to get along along, once Windows is pinched off, China a bunch of operating systems will come out. As a matter of fact, China already has some very good operating systems, but the Windows ecosystem is so perfect that everyone has to use it, so it is too hard for us to seize the PC desktop market. If the Americans don’t want to use it, it’s definitely coming, that’s great.
- How to play Huawei recently? No chips for you. First it was the US manufacturers who blocked exports, and now it is TSMC, which makes many of Huawei’s chips on contract. All right, put your hands up. After he puts a cap on TSMC, there will surely be similar manufacturers in China. The beginning may only be able to do a dozen nanometers, but this thing, you can do in Taiwan, I do not believe that the mainland people can not do, slowly do a few years, we will do 7 nanometers, 5 nanometers, 3 nanometers…
- Of course, if these manufacturers emerge from the mainland, it is not clear whether the previous manufacturers who depend on the mainland for their food will be able to enter
- Ark compiler
- Along with Hongmeng, the Ark compiler was released
- He’s compiling things that can run on a phone, on a computer, on a car, and so on
- Code for the three kernels
- Because Hongmeng is huawei before their own secretly in the work, and did not announce, because of the Sino-US trade war, it had to come out, he is not very perfect
- His code is currently code for the three kernels
- Linux
- LiteOS
- Huawei Embedded OS
- Android
- By what Yu said last year, he meant it would take three years to merge the three cores into one, and by then Hongmeng would surely be much more mature than it is now
- Some people on the Internet say that they are afraid of yu’s mouth sex, but have you ever noticed that yu’s mouth sex seems to have come true. A few years ago, Huawei said it would make mobile phones, many people were not optimistic, but Huawei made them. Yu said he would make it to the top three in the world in a few years, and now he is already in the top three
- The microkernel
The operating system
An important point to find above, microkernels, to understand microkernels need to add some basic knowledge of operating systems
What is the
- An operating system is a special kind of software
- This software is compatible with programs that serve our users
- It manages the underlying hardware
- Just like Windows, it manages your hardware for you, you don’t have to program yourself to access your keyboard, Windows already does it for you. Windows also helps you manage the work program, your QQ, wechat, Office, is Windows to help you manage.
- Generally speaking, the operating system course is usually a second class to the programming language, especially the data structures before the operating system, because there are some very deep concepts that you need to know about data structures
What’s the use of
- Tube hardware
- memory
- The hard disk
- CPU
- A variety of peripherals
- Pipe application
- process
Brief structure
- Generally speaking, there is a core, the kernel, and the kernel is the managed hardware
- There are other services running around the kernel that manage our applications
The kernel
- The study of the kernel is generally based on Linux. As for Hongmeng, as for Android, as for Apple’s operating system, its core is unix-like, and Linux is Unix-like
- Apple doesn’t open source, Windows doesn’t open source, so what’s the point of looking at something that’s closed source
The core
- CPU scheduling
- The file system
- Application management, process scheduling
- Interrupt handling, device driver
- Memory management
Core classification
- Macro kernel
- Generally contact with the operating system, are macro kernel
- The macro kernel is, my kernel runs the CPU, memory, processes, interrupts, all of that is my responsibility, and I treat the part that is my responsibility as part of the operating system.
- The core of the operating system and the peripheral things that it manages together as the core of the operating system. It’s called a macro kernel
- We touch Linux, Windows is this model
- The microkernel
- The microkernel kernel does just one thing, process scheduling, and that’s the core of Hongmeng
- Other programs that you want to use, hang on, and maybe distributed, they don’t have to be on one machine. The core of a microkernel might be on this chip, so I have the memory thing, and I plug a memory card into another chip, specifically to manage that memory
- A distributed
- All user programs that want to interact with the operating system need to access the kernel first.
- For the macro kernel
- If an application wants to access the operating system, the operating system is a black box to it. I want to read files. No problem
- And for the microkernel
- If the user wants to access the file system, I have to deal with the kernel, the kernel helps me access the file system, the file system feeds back to the kernel, the kernel returns to me;
- If my application wants to access another application, I first talk to the kernel, the kernel finds another application, the application returns to the kernel, and the kernel returns to me:
- Even when you schedule a CPU, you have to go through the core, and all the access goes through the core, and the core is very small, and everything else can be distributed and not put together
- disadvantages
- It runs slightly slower because all access requires the core to rotate hands once
- advantages
- It can be deployed very flexibly, with all kinds of different levels of resources
- Moreover, it can be flexibly dismantled and assembled. Some processes I don’t need will be dismantled: I don’t need to be connected to the Internet, so I will release the processes processed by the network.
- At present, the world’s major manufacturers are doing micro kernel, Microsoft, Apple, Google are doing, Huawei is the first to launch and commercial. In his screen of wisdom, Hongmeng has been applied
- Outer core
- Not yet. It’s just a concept, in the lab
- concept
- The kernel manages some things
- At the same time, for a certain type of application, I specifically optimize for that type of application at the kernel level, and when you start the application, my operating system changes, and I optimize for that type of application
- For example, if I want to go online, my operating system will be changed to make the inside of my operating system more web-friendly, so my outer core will be more application-friendly. This is called the outer core
- VMM
- concept
- Hardware is awesome these days
- Sometimes you only have one operating system running on it
- He has too many applications to run. He has too many resources
- What do I do
- Add a layer. This layer is called VMM
- There are a lot of virtualization vendors doing this right now. The hardware is too strong. Have you ever seen a 128 CPU machine? 8 cores per CPU, 1.5T memory, 60 million PCS. This machine runs on one operating system? How to make full use of computer resources?
- concept
Start the
- How does an operating system start?
- Generally, when you turn it on, when you’re done, the operating system runs the machine, and the rest of the time you have to deal with the operating system, you don’t have to deal with the hardware
- What exactly does this process look like?
- It used to be that when you buy a computer, you buy it part by part and assemble it yourself, and then you put an operating system on it, and then you can run it
- Press the power button
- At the same time
- The mainboard has a chip called the BASIC Input Output System (BIOS).
- It’s a dead program. He does the same thing
- This chip has also been evolved and is now UEFI. It boots in black and white if you turn it on with BIOS, and in color if you turn it on with UEFI. It’s a BIOS upgrade
- The operating system thing, we usually install on the hard disk, how does the operating system on the hard disk start to put into memory, and then take over the hardware?
- This process, BIOS inside the small program
- As soon as the power is turned on, this little program will run itself, running the first program that dies
- This program will check the hardware, memory is inserted, there is no bad reaction, generally bad reaction is a short call
- Once the hardware is checked, a boot program called BootLoader is loaded into memory
- How does a dead program find the BootLoader?
- Is the BootLoader write-dead? Definitely not, but his program is in a fixed location
- What is a BootLoader?
- When installing dual systems, he will ask you to choose which system to boot, that is the BootLoader program
- The BootLoader program is placed in the first sector of the hard disk
- In the past, there was a particularly violent virus, CIH, which was designed to get into this area, and this area went wrong and the system never got started
- This process will have some problems, the BIOS inside the program is written dead
- Some of the things that I can set up, when I boot up, when I don’t touch the operating system, I set up hard drive to boot, CD to boot, USB drive to boot
- When I’m done with these Settings, I turn off the power, I turn it back on, and it’s still there, which means there’s a place where I can write data and not lose it
- It definitely didn’t work on the memory, and it didn’t work on the hard drive, because the operating system hadn’t taken over yet, and you couldn’t access the hard drive
- The piece that records the power-on information is called CMOS
- He’s the other chip
- He is powered by a special battery on the motherboard, usually a 3V battery
- A lot of time boot set password, enter the password in the setting how to do after forgetting? The password is stored in CMOS, which is powered by battery. If the battery is deducted, the INFORMATION of CMOS will be lost
- After writing to the BootLoader, you can select the operating system and which disk to install the operating system on, which is recorded in the BootLoader.
- Once the operating system boots up, it takes over, and you don’t have to deal with the hardware anymore, you just have to deal with the operating system
Some basic concepts of system programming
interrupt
- define
- On a hardware level, I hit the keyboard, and I really want the operating system to give me feedback, even if you’re running something else
- I press CTR + Alt +del on the keyboard, I ask you to give me a feedback, kill some programs, this is some signal from the keyboard, it will be sent to the machine kernel
- My machine core is running well, you suddenly come over a thing, I do not have to break
- So this is called interrupt
- On a hardware level, I hit the keyboard, and I really want the operating system to give me feedback, even if you’re running something else
- Hardware interacts with the operating system through interrupts
- The hardware sends an interrupt signal to the operating system
- The operating system is interrupted
- The operating system then finds the processing table for the corresponding interrupt routine
- Let’s see which program is dealing with the keyboard
- Different types of hardware produce different types of interrupts
- These interrupts are already programmed in the operating system
- In addition, software can create interrupts
- This is called a soft interrupt
- Soft interrupt has only one symbol 0x80. 0x represents hexadecimal. It can also be called 80H, or 80 interrupt for short
Kernel mode and user mode
- Early operating systems, such as DOS, allowed applications direct access to the hardware and could format the hard disk directly
- No mesosphere
- Operating systems now block this very dangerous operation
- In other words, today’s operating systems make it difficult for me to do anything particularly dangerous
- The user wants to access the hard disk, wants to access the network, wants to access various sensitive hardware, needs to go through my operating system kernel
- So now the operating system is not easy to crash, like the original DOS operating system, very easy to write a program to DOS kill machine. But now, writing programs to kill Windows and Linux is too difficult
- This is because of the separation of various operations within the operating system
- The operating system itself is at a particularly high priority level, for it can access hardware, it can manage processes, it can manage threads, it can do direct access to memory
- But not the user. The user can only do what the user is supposed to do. That makes it particularly difficult for users to kill the operating system, so this operating system is much safer than that
- The CPU tiers the instructions, and Intel cpus have four tiers: 0, 1, 2, and 3
- Level 0 can do anything
- Many operations at level 3 must go through 0
- The operating system’s job is to work at level 0, called kernel mode, where it can access any memory
- Our own program runs at level 3 and can only access its own memory, not the memory of other processes, nor the memory of the operating system
- What happened to 1 and 2? Linux doesn’t work
What’s the difference between a program, a process, a thread, and a coroutine
- The program
- An executable file on your hard drive is a program
- QQQ. Exe on the hard disk is a program
- When we double-click the file, the operating system will start the corresponding process, double-click again, another process, a program can have several processes
- process
- A process is a program that runs, puts it in memory and starts executing, and the CPU starts executing its instructions one by one
- The unit that allocates resources
- When you start a process, you allocate memory, virtual memory, and virtual memory mapped to physical memory
- thread
- A lot of the work in the process is done in parallel, like UI presentation, receiving network traffic, saving, all of that stuff is done in parallel.
- How do you do parallel tasks in a process? Through the thread
- Perform unit
- No memory is allocated when starting a thread
- Coroutine/fiber
- You can also do parallel tasks in a thread
- A coroutine is a thread in which different execution paths can be executed simultaneously
- It’s called coroutine in Go
- It’s called fiber in Java
- Simply put, it is a thread within a thread
What exactly is a coroutine?
First, add some knowledge:
- When the CPU executes the program, it is the main thread that executes the program
- Nature of the program
- A bunch of instructions
- Plus a bunch of data
- When the CPU executes
- There’s a place in the register that keeps track of which instructions I executed into the program
- When the CPU executes, it finds the first instruction, brings it over, brings the data associated with it into the CPU, calculates it, puts it back, and proceeds to the next instruction. When the program is over, the calculation is over.
- The nature of a program is to keep fetching instructions
- This process also records the content related to the current thread
- For example, where is the thread going to execute, and these are in registers inside the CPU
- The stack associated with threads also records some information
- As a CPU
- I have many, many tasks to carry out
- However, a CPU core can only execute one thread at a time
- I want to save the data associated with the current thread
- When I want to switch to another thread
- Thread A switches to thread B
- All the data associated with thread A, all the data in these registers, all the data in this stack, I’m going to save it
- And then you bring B in and execute it
- Thread scheduling must go through the operating system
-
Let’s assume that there are two threads in the JVM that must pass through the operating system when switching
-
Each of the JVM’s threading models corresponds to a kernel thread of the kernel
-
The number of threads an operating system can open, which is a valuable resource, is limited
-
If Java wants to start a thread, it’s actually quite heavyweight because it has to go through the operating system
-
The JVM is working in user mode, so when I want to start a thread, I have to go through the operating system, and I have to go through the kernel mode switch and then map back, so I can start the thread
-
Starting a thread on the JVM adds up to about a Megabyte of memory
-
- So is there a lightweight, no pass no alarm operating system
-
I’m in my user mode, not through the operating system, inside my JVM, simulating some threads out
-
I do multiple stacks inside the thread
-
The so-called a thread is some register information and some information on the stack, can keep the thread of the site, keep the process of execution of the thread
-
I can simulate some threads in user space, and these simulated threads are called coroutines
-
- JDK13 currently does not support coroutines. Coroutines are where Kotlin is better than Java. The rest is syntactic sugar. As soon as JDK14 comes out, prepare to shake the Go language. Since JDK11 has ZGC and shenandoah, his garbage collector’s pause time can be controlled under 1ms at best, and most of them must be under 10ms. Prepare for C++ to shiver
- Where are coroutines commonly used?
- Generally used in callback functions, user space asynchronous programming
- Supplement: Why is working with kernel mode inefficient
- It’s essentially an 80 interrupt problem
- Because when you’re dealing with the kernel, you go through a couple of things
- User programs can ask the operating system to call some functions of the operating system
- The operating system controls access to hardware, such as the network, that you request from the system
- The application process needs to be reported, 80 interrupted
- In general, there are hundreds of kernel functions that an application can access in order to call kernel mode
- Which function do you want to call? I want to call the read function, and the read function number is 2
- This is the old CPU, and now there are some new cpus that support system primitives, which are supported during the assembly phase