Knowledge point 4

1 Classification of network systems
Core system: communication subnet , such as routers, switches, repeaters and other communication equipment in the network;
Edge system: Resource subnet , such as hosts in the network, terminals such as networked peripherals.

2 DNS

The choice of DNS protocol for UDP and TCP is usually in the following two cases:

(1) If the DNS client program knows in advance that the length of the response message is greater than 512B, it should use a TCP connection ;

           NOTICE: When the primary domain name server and the secondary domain name server perform zone transfer, the amount of data is usually relatively large. All DNS regulations stipulate that the zone transfer uses the TCP protocol.


(2) If the parsing program does not know the length of the response message, it generally uses the UDP protocol to send the DNS query message. If the length of the DNS response message is greater than 512B, the server will truncate the response message. In this case, the DNS client The program usually resends the original query request using TCP so that it can receive a complete response from the DNS server in the future.

          To sum up: The DNS client program usually uses UDP to connect with the DNS server program without knowing it (does not know whether the length of the DNS response message exceeds 512B), and uses TCP to connect with the knowledge .  

3 Fiber
According to the transmission mode of light in the fiber, it can be divided into: single-mode fiber and multi-mode fiber . Multi Mode Fiber: The central glass core is thicker (50 or 62.5 μm), which can transmit light in multiple modes. Single-mode fiber (Single Mode Fiber): The central glass core is very thin (the core diameter is generally 9 or 10 μm), and only one mode of light can be transmitted.

4 Activeness failed

When using locks to ensure on-site security, there may be situations where liveness failures may occur  ,  including  starvation, loss of signals, and livelocks and deadlocks  . [In addition to deadlock, multi-threading encounters the most active problem]

Starvation : Refers to the permanent denial  of resources that a thread needs to access   , so that it can no longer continue. Solving the starvation problem requires balancing thread competition for resources, such as thread priority, task weight, and execution cycle.

Livelock  : Although the thread is not blocked , it keeps trying to retry but always fails due to a certain condition not being met. Solving the livelock problem requires   introducing some randomness to the retry mechanism . For example, if a collision is detected, then pause for a random amount of time to retry, which greatly reduces the chance of a collision.


5 subtypes
A subtype must be a subclass that inherits all inheritable features of the parent class, that is, public inheritance , in order to be said to be a subtype, otherwise it is just a simple subclass

6 flexible arrays
A flexible array, which can only be placed at the end of a structure, is to declare an array with a length of 0, so that the structure can be made variable. For the compiler, the array of length 0 does not occupy space at this time, because the array name itself does not occupy space , it is just an offset, and the symbol of the array name itself represents an unmodifiable address constant (Note: the array The name will never be a pointer!), but for the size of this array, we can do dynamic allocation Please understand the second half carefully, for the compiler, the array name is just a symbol, it does not take up any space, it In the structure, it just represents an offset, representing an unmodifiable address constant!
 For this feature of 0-length arrays, it is easy to construct structures, such as buffers, packets, etc.:
Note: The construction of the buffer is to facilitate the management of the memory buffer and reduce the fragmentation of the memory. Its function is not to mark the end of the structure, but to expand
A flexible array is an extension of C99. In short, it is an identifier placeholder in a struct structure (does not occupy the space of the structure struct)

7 Function overloading

When a friend function is overloaded, the parameter list is 1, indicating that it is 1 yuan, and it is 2, indicating that it is a 2-element
member function .


8 Affects the number of concurrent connections to a Linux server

The number of ip addresses , the more the system ip number, the more the number of established connections. 

Memory, let's talk about it from the perspective of the configuration file. Open the configuration file with vim: #vim /etc/sysctl.conf 

 net.ipv4.tcp_mem[0]: Below this value, TCP has no memory pressure.

 net.ipv4.tcp_mem[1]: At this value, the memory pressure phase is entered.

 net.ipv4.tcp_mem[2]: Above this value, TCP refuses to allocate the socket. The above unit of memory is a page, not a byte . Memory size affects network 

The maximum number of handles affects the upper limit of
network operations in vfs. The role of the network card is to encapsulate and unencapsulate data, and does not involve concurrency

Memory size, IP address and the maximum number of file handles will affect the number of concurrent connections to the Linux server


Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326585126&siteId=291194637