* Interview summary :
1. Because it was late ,10 month 8 On the afternoon of the 12th, we had a continuous meeting , Two sides , Three sides . The overall interview experience was excellent , In addition to discussing project experience , The problem involves : process / thread ,CPU dispatch ,C/C++
String distinction , Network three handshakes , Four waves ; Project experience ; Project requirement analysis ;MySQL Two engines of database , And comparison . Programming topics include : Radical 2 retain 10 Decimal place ; How to quickly start from hundreds of thousands IP Address segment to determine a IP Is it one of them ; The path whose sum is a certain value in binary tree ; from 1-10 Select four numbers that are not repeated in , Print all satisfied 24 Arithmetic sequence of point game rules .
* The difference between process and thread
* stay linux During the startup of the operating system , The first process to start is init process , All other processes are its children ;
* Processes and threads are descriptions of a time period , yes CPU Description of working hours . The main difference between processes and threads is that they are different ways of operating system resource management .
*
stay CPU It seems that all the tasks are carried out one by one in turn , The specific method is : Load the program first A Context of , And then it starts A, Save program A Context of , Call in the next program to be executed B Program context for , And then it starts B, Save program B Context of ;
* A process is the sum of the execution time of the program that changes the context = CPU Load context +CPU implement +CPU Save context ;
* Threads are smaller entities that share the context of a process CPU time slot ; And the process has independent memory unit in the process of execution , Multiple threads share memory ;
* There are multiple processes in the operating system , Each process can have 1 To multiple threads
* The minimum unit of system resource scheduling is
* Threads are CPU Basic unit of dispatching .CPU Scheduling is also called time slice scheduling . Scheduling units are time slices .
* C in char String and C++ Of string The difference and connection between the two
* char Is to define a character , Store one character , One byte .C++ In strign Is the encapsulated string class ;
* char There is an invisible character at the end of the string ’\0‘;
* string yes C++ Standard Library (C++ Standard library ) Part of , need #include <string>
* C In string.h A series of manipulations are provided in char String functions, such as :strcat,strncat,strcmp,strcpy,strstr etc .
* C++ Of string Class provides a return char string Interface for :c_str()
* Network three handshakes , Four wave process
*
TCP It is a connection oriented unicast protocol , Before sending data , Both sides of communication must establish a connection between each other . So called “ connect ”, In fact, it is a piece of information about each other stored in the memory of the client and server , as ip address , Port number, etc .
*
TCP It can be seen as a byte stream , It will deal with it IP Packet loss at or below layer , Repetition and errors . During the establishment of the connection , Both sides need to exchange some connection parameters . These parameters can be placed in the TCP head .
* TCP It provides a reliable method , Connection oriented , Byte stream , Transport layer services , Use three handshakes to establish a connection . use 4 Wave twice to close a connection .
* First handshake : Client sends network package , The server received it . In this way, the server can draw a conclusion : Sending capability of client , The receiving ability of the server is normal .
* The Second Handshake : Service side contract , The client received it . So the client can come to a conclusion : Receiving of server , Sending capability , Client reception , Sending capability is normal .
From the perspective of the client , I received a response packet from the server , It shows that the server received the network packet that I sent when I shook hands for the first time , And successfully sent the response packet , This shows that , Receiving of server , Normal transmission capacity . On the other hand , I received a response packet from the server , It shows that the network packet I sent for the first time successfully arrived at the server , such , My own sending and receiving capabilities are also normal .
* The third handshake : Client contract , The server received it . In this way, the server can draw a conclusion : Client reception , Sending capability , Sending of server , Reception is normal .
first , After the second handshake , The server does not know whether the receiving ability of the client and its sending ability are normal . And on the third handshake , The server receives the client's response to the second handshake . From the perspective of server , My response data at the second handshake was sent out , Client received . therefore , My sending ability is normal . And the receiving ability of the client is normal .
*
Four waves :TCP Connection is a peer-to-peer mode of two-way transmission , That is to say, both sides can send or receive data to each other at the same time . When one party wants to close the connection , Will send instructions to inform the other party , I'm going to close the connection . At this time, the other party will return one ACK, The connection in one direction is closed . But the other direction can still continue to transmit data , Wait until all the data is sent , One will be sent FIN Section to close the connection in this direction . Sent by receiver ACK Confirm closing connection .
* MySQL What are the database engines , Introduce and compare them respectively
*
MySQL Databases have multiple storage engines : such as :MyISAM,InnoDB,MERGE,MEMORY(HEAP),BDB(BerkeleyDB),EXAMPLE,FEDERATED,ARCHIVE,CSV,BLACKHOLE wait , The most common is MyISAM and InnoDB It's over
* MyISAM Transaction not supported , Fast recovery after crash is not supported , Using table lock is not suitable for high concurrency , Pursuit of performance , Depending on the operating system to manage the read and write cache , Cache index only, do not cache real data , Support compression
* InnoDB
Support services , Support foreign key , Support automatic disaster recovery , Using row lock to support high concurrency reading , Support hot backup and fast recovery after crash , Support full text search (5.6.4 Version only , So some interview questions may not be rigorous due to time ), It has its own read-write cache management mechanism , That is, cache index also cache data , Compression is not supported

Technology