Detailed analysis of the types of terminals and concepts that are confusing in Linux
Every day you use Linux to get in touch with Bash every day. The concept that always seems to be confusing when using Bash is the terminal. Sitting in front of the monitor of this Linux machine, this display is the output of the terminal, and it is inserted in the machine. The USB keyboard or PS/2 keyboard on the terminal is the input of the terminal. It seems that this is the most straightforward explanation of the terminal. But sometimes, the machine does not see the monitor or keyboard interface, but there is a serial port. I want to operate this machine. I only have to use this serial port. At this time, the monitor keyboard of the computer at the other end of the serial port. Also called the terminal. In addition to the above two terminals, SSH, Telnet, etc., which are used on software like SecureCRT, can be regarded as a terminal program, except that it is connected to the host through a TCP/IP network rather than through a serial port. Now you can give the terminal a non-strict definition, what is the terminal? A terminal is a device that processes the input and output of a host computer. It is used to display the output of the host computer and accept the input required by the host. Typical terminals include a display keyboard kit, a printer typewriter kit, and the like. But to thoroughly understand the concept of the terminal, it is still necessary to trace the source from the perspective of the history of computer development. In the beginning, the computer was as big as three houses, and it should be called three workshops. Such a behemoth has a special console, just like the console of a machine tool factory workshop, or it is more suitable for the console of an aircraft cockpit. Various instruments and meters, the operator only needs to issue instructions to the machine here. The whole machine begins to operate for his instructions, and the results of the machine operation are also fed back here instead of elsewhere, where the console is the most primitive terminal. It used to be the control center of the entire machine. Later, with the multi-user multi-tasking time-sharing system, different programs can be "simultaneously run". In order to allow different programs to independently accept input and process output, multiple different consoles are required. Of course, It is always the same person sitting or standing in front of the console, so that different people have different consoles to handle different programs, which has entered the era of multi-terminals. From then on, every terminal has been Is bound to a user. In order to guarantee this binding, a login occurs, that is, through a call called login, to evoke a terminal to work. In order to support multiple users, the terminal is separated from the hardware, and the terminal becomes a software concept. After successfully logging in on a hardware terminal, a software terminal is obtained. It can be seen that this era has been different from the era of the three workshops. The terminal is no longer only one, but has become more than one. Each successful login user has a working software terminal to process the input and output. It will take a long time. In the era of personal computers, computers and terminals became a one-to-one relationship. After all, the computer at this time is called a personal computer, and it can't be used by anyone. The computer itself belongs to the individual, so there is no need to support any multi-user, or at least dilute the concept of multi-user and multi-terminal. We all remember that when I bought a computer, I was equipped with a monitor and a set of keyboard and mouse. This situation lasted from the early 1980s to today. However, in recent years, when people gradually realize the one-to-one relationship between computers and terminals, the market for all-in-ones comes, since you almost never (I certainly know that some people will, but here I am talking about most people, Programmers account for the proportion, programmers in order to install X, will not use the all-in-one, even the brand machine set sometimes do not bother) on the same host to connect multiple monitors and multiple sets of keyboard, why bother again, simply put the host It’s not good to be with the monitor. Well, this idea is good, follow this path, and finally have a touch screen machine, even the keyboard is built-in. Comparing the following picture and the computer era in the third workshop, is it very similar? But the good times are not long. It must be divided for a long time. Everything seems to be back to the mainframe era. In the mainframe era, a machine with multiple terminals was fifty years ago. Today, we have a wide variety of small devices, smartphones, tablets, smart watches.... However, these things are just a series of terminals! So since these things have become terminals, where is the real computer? Of course, in the major computer rooms (also in the kind of room-like room), but now is not called the mainframe, but called the cloud, this technology is called cloud computing (it seems to be a little hype concept). If you don't believe that the equipment you bought for thousands of dollars is just a terminal that completes the input and output functions, then try to break the net and see if your iPhone is brick. It can be seen that the expensive computing service provided by the cloud, not the terminal device itself, we regard the so-called cloud as a computer. Is this picture very similar to that of fifty years ago? How long have you not opened your home PC, is it a long time, but the days are still decent. But can you endure not logging in to WeChat for even a few hours? In a sense, it is not these hardware devices that become new terminals, but various types of APPs based on modern Internet services based on cloud computing technology. ... Is it necessary to divide it again? There have been signs of this, from the use of QQ number can log in to WeChat, Weibo, and push the network when there are signs. Well, I have so much about the development of the terminal. In fact, it is basically a sentence. It can accept input and display output. This is enough. No matter what era, the terminal always plays the role of human-machine interface. Terminal, the edge of the machine! As long as it provides computer input and output functions, it is the terminal, regardless of its location. I can use the ls command to list the files in a directory on a computer other than 5,000 kilometers and display it on the screen in front of my eyes. As for how my input reaches 5,000 kilometers, this is not my concern. It is not a computer to pay attention to, this is obviously only a communication method. Then it is obvious that using TCP/IP networks for such communication transmissions. This is how SSH works. We know that SSH is a protocol of the TCP/IP protocol family, and it runs on a terminal stream after remote login. This obviously only constructs a tunnel with TCP/IP, and then the terminal circulates in the tunnel. In addition, simpler Telnet is no exception. It also encapsulates the terminal stream hosting remote login through a TCP/IP tunnel. Except for TCP/IP, if we insist on using trucks to carry our inputs and outputs, it is also appropriate, TCP/IP, trucks, they are just communication means, they are not the terminal itself. We can now imagine what the form of the terminal will exist. · Local terminal Connect the host and monitor with VGA and connect the host and keyboard with PS/2 or USB. Such a display/keyboard combination is a local terminal. · The remote terminal connected by serial port connects the host to another host with display and keyboard through the serial cable. By running a terminal emulation program, such as “Windows HyperTerminalâ€, the host's display and keyboard are loaned to the serial port. Host. · Remote terminals hosted by TCP/IP are similar to Telnet and SSH. Let's talk about these categories first. It can be seen that in the above three categories, the first two categories are directly related to physical devices locally, such as VGA port, PS/2 port, serial port, etc., such terminals are called physical terminals, and the third category There is no physical device associated with the local device. Note that the physical network card should not be regarded as the physical device associated with the terminal. It is only the physical device associated with the tunnel. The physical network card here can be completely replaced by a truck. They are not directly related to the terminal, so this A terminal whose class is not directly associated with a physical device is called a pseudo terminal. Now that you know what these terminals are all about, it's not a bad idea to understand the remaining terms. These terms exist not for the purpose of intentionally adding complexity, but because engineering must be operative, and at least one name must be called to be operational, and nothing more. This is very different from our traditional Chinese way; the name, the name is very different. It can be said that modern mathematics must be both famous and well-documented, while modern engineering must be named after it. First look at what the Linux terminal is called in the Linux system. Tty is the most familiar. In Linux, /dev/ttyX stands for the above physical terminal. Among them, /dev/tty1~/dev/tty63 represents the local terminal, that is, it is received by the local machine. A terminal that the keyboard display can operate. In other words, if you write something to /dev/tty3, it will be displayed on the corresponding terminal of the display. Why are there so many 63 terminals? After all, the display is just a separate display device, and the keyboard is often only one, but the Linux kernel has the ability to know what to do now, so in fact the Linux kernel will generate 63 local terminals during initialization, through the Fn-Alt-FX on the keyboard ( X is 1, 2, 3...) can be switched between these terminals. Each time you switch to a terminal, the terminal is the current focus terminal. For example, if you press the Fn-Alt-F4 key combination, then at this time The four terminals are the focus terminals, that is, /dev/tty4 is the focus terminal device. Who is the focus terminal will be recorded as a global variable by the kernel, so that as long as there is keyboard input, the input characters will be handed over to the focus terminal. By the way, for the serial port, there is no concept of the focus terminal, who is connected to the serial port, and for the pseudo terminal, the client is generally running in the GUI environment, which is Microsoft's business for Windows. For Linux, there are X systems that do the same thing, skip here and continue the topic we are talking about. Is there any variable in the system that can represent the focus terminal? Of course, there is /dev/console, no matter where you write to /dev/console, these things will always appear on the current focus of the system! According to others, we explained that /dev/console is actually a global variable that refers to the current focus terminal. If the current focus is /dev/tty4, then /dev/console refers to /dev/tty4, of course. This is all maintained by the kernel. So is there a global variable called the system? Of course, there is /dev/tty, which means that no matter which terminal you work on, when you write to /dev/tty, it will always appear in front of you. /dev/tty1~/dev/tty63 We know what they are, /dev/tty means itself, /dev/console means that the focus terminal we know, then how to represent the serial terminal? Very simple, starting with ttyS is the terminal connected to the serial port, such as ttyS1, ttyS2... Finally, explain the pseudo terminal. In fact, it is also very good to explain, as long as you understand the principle of TUN / TAP virtual network card, they are exactly the same! Similar to Telnet, is SSH not an actual physical device? Simple, do you have to simulate it? The system is hierarchical, and the execution flow only calls the interface, not the specific implementation. Simulate a virtual terminal device and implement its write, read, etc. callbacks. For a VGA-connected display, write actually refreshes the memory. For a pseudo-terminal, write actually wants to import the data into a user-mode program (otherwise, where can it go? There is no physical underneath it.) Something), this is very similar to the principle of many VPNs. To this end, Linux designed a pair of virtual terminal devices, namely /dev/ptmx and /dev/pts/X, which is consistent with the previous correspondence between the network card of the TUN/TAP network card and the character device. Simply put, when there is an ssh client connection, sshd will fork a process, then open a device called /dev/pts/1 (or 2,3,4,5...) in the child process, and then the sshd process The /dev/ptmx pairing, thus forming a pipeline between ptmx and pts, the data can be smoothly imported into sshd, and then sent to the machine where the ssh client is located through TCP/IP encapsulation. In order to help understand the above text, I deliberately made a picture, hoping to explain the relationship between these terminals and understand their workflow. In order to make the picture more compact, avoid the horizontal network bar Tula is too long to look good, I used a circular interpretation method, similar to Intel's earlier Ring1, Ring2, Ring3, I regard the innermost layer as hardware (more than it) There is also something called a person inside, the middle layer is regarded as the kernel, and the outermost layer is regarded as software. Understand the legend, I am on my map, this is what I finished late last night, I hope to have valuable comments (the map is a bit big, please check it separately): The various tty, ptmx, pts/X, console, etc. in the /dev directory are confusing roots. In fact, understanding these is tricky. Remember that they are just device files for operating a certain terminal device. This is The continuation of the UNIX style, the number of real devices corresponding to these device files, such as the display keyboard kit, the HyperTerminal opposite the serial port, the SSH, Telnet, etc. opposite the pseudo terminal. Then try to draw a picture above, basically understand it. Finally, let's talk about things related to getty and login. As mentioned in the history of terminal development, in the era of multi-terminal, each terminal must be bound to a user, and only a user who has successfully logged in can obtain a terminal. So when a person stands in front of a terminal does not mean that it can operate the computer on this terminal, the first thing he has to do is log in. The so-called login is to enter the username and password. If the input is correct, it will give you a Bash (or other shell) to let you operate the computer. If the input is incorrect, let you continue to input... Getty gives you the opportunity to log in and continue typing! The init process keeps calling getty, and then getty will initiate login to log you in. When you enter the correct username and password, ttyXYZ is yours. If you are using SSH for login, you will get a call called /dev/pts. /X, if you are logged in on the display keyboard, you will get /dev/tttX (X depends on the current focus terminal). All of this is actually a product of multi-terminal and multi-user, but in the end, its roots are in the time-sharing system. In the era when the computer was originally placed in a shop-sized room, it might be more important to make the house's access control and to make the authentication system outside the house more important than the later multi-user login. Only later, the terminal no longer belongs. Computer, the terminal is separated from the computer, and when the user is separated from the terminal, it is especially necessary to design a login mechanism, because first of all, even if you lock the computer in the iron house, as long as the terminal is outside, the computer will There is no sense of security. Secondly, you can't lock all the terminals in the iron house under your control. Especially after the emergence of TCP/IP, almost all computers are interconnected, which means any one. The computer can be used as the operating terminal of any other computer. Any external authentication system and physical protection are comparable to the Maginot defense in front of the TCP/IP network. It seems to be impregnable. If you want to test whether you have enough deep understanding of one thing, try to tell others, try to answer other people's deep questions and meet the challenge. This is the right way.
LED Linear Lights Driver
LED Linear lights driver Specifically for linear lights,indoor driver for non-waterproof,constant current with aluminum/iron casing, with the dimming function of 0-10V/PWM/RX/dali. Flicker free and SELV Safety output design, UL/FCC/TUV/RCM/CB/CE Certified. Europe and North America market.
Parameter:
Input Voltage:100-277V/100-240V
Output voltage: 25-40V/ 12V / 24V
Current: 100-1800mA / 2500mA / 5000mA
Power factor: >0.95
THD: <15%
Dimming: 0-10V/PWM/RX/Dali
FAQ: Linear Lighting Driver,Utra Slim Driver,Ul Dimmable Driver,Led Light Box ShenZhen Fahold Electronic Limited , https://www.fahold.net
Fahold, a 8 year old company brings light power to your life by illuminating your offices, factories, warehouses, shopping malls, airports, etc. with its high quality LED Linear lighting products and solutions. LED Linear lighting springs out few years ago, we see the power of the linear lighting solutions, so over the years, we have been innovating our Utra slim driver for these type products to give you healthy low carbon environment with low energy consumption. Application: LED Light boxes, led linear lights, led troffer ect.
Question 1:Are you a factory or a trading company?
Answer: We are a factory.
Question 2: Payment term?
Answer: 30% TT deposit + 70% TT before shipment,50% TT deposit + 50% LC balance, Flexible payment
can be negotiated.
Question 3: What's the main business of Fahold?
Answer: Fahold focused on LED controllers and dimmers from 2010. We have 28 engineers who dedicated themselves to researching and developing LED controlling and dimming system.
Question 4: What Fahold will do if we have problems after receiving your products?
Answer: Our products have been strictly inspected before shipping. Once you receive the products you are not satisfied, please feel free to contact us in time, we will do our best to solve any of your problems with our good after-sale service.