当前位置:网站首页>Byte practice plane longitude 2
Byte practice plane longitude 2
2022-07-03 14:50:00 【III VII】
See the title here : Byte internship
one side
Introduce C++ polymorphic
Class when calling member functions , It will execute different functions according to the different objects called ;
Through virtual functions ;
Virtual functions , Add before function definition virtual;
C++ Initialization order of class objects , Sequence with multiple inheritance
- Constructor of each base class ;
- Initialization of member variables ;
- Derived class ( Class itself ) Construction ;
notes : Destructors are executed in reverse order to constructors .
If the same level contains both virtual base classes and non virtual base classes , First call the constructor of the virtual base class , Then call the constructor of the non virtual base class .
Non virtual base classes in the same hierarchy are called only once .
. If a member of a derived class has the same name as a member of a base class , Then the derived class will hide the base class member in its scope .(C++ Prime 5)
Inline functions and macros , When to use inline functions
Macro definition is replaced by preprocessor during preprocessing , Inline functions are executed by the compiler at compile time .
Inline functions still have function properties , And the macro definition is really just a simple string replacement , It's easy to have some problems .
Virtual functions
Used to implement polymorphism ;
Virtual function table ;
Introduce the network 5 Layer model , What functions are implemented in each layer
1. The physical layer : Manage and maintain physical connections , Determine the characteristics of the transmission media , Providing bitstream transmission services , On the upper ( Data link layer ) Shield the differences between physical devices and protocols . Information turns to signal .
2. Data link layer : Receive network layer ip Data packets , Add the head and tail and package them into frames .
In the physical layer, the transmission of bit streams on media is unreliable , The data link layer provides error detection based on the physical layer , Error control , flow control . Provide a reliable transmission for the network layer . The network layer is shielded from the differences of different transmission media .
3. The network layer : The network layer is connectionless , Unreliable services that try to deliver packets . The transport layer of the host is responsible for providing reliability to the process
service .
4. Transport layer : Provide end-to-end connection and data transmission services ( Process to process ), The network layer provides host to host connection services
5. application layer : Specify the protocol followed by the application process communication
MAC Address and IP What are the functions of addresses
MAC The address is used to determine the hardware ( Data link layer )
IP The address is used to confirm the area ( The network layer )
- IP The address can be modified ,MAC The address cannot be modified ;
- IP32 position ,MAC48 position ;
- Are unique addresses ;
TCP、UDP The difference between
- TCP Byte stream oriented ,UDP Message oriented ;
- TCP reliable ,UDP unreliable ;
- UDP Support one to many ;
- UDP There is no connection ;
- UPD Small overhead , The eight word Festival ,TCP20-60 byte ;
TCP Specific steps of connection release
The steps of four waves ;
What happens if the other party doesn't receive the handshake message each time when shaking hands three times , Short answer
The first two direct timeout retransmissions ;
The last time the timeout is not received, the connection will be closed after being retransmitted for a certain number of times ;
Virtual memory
Management style : piecewise , Pagination , Segment page memory management ;
Mapping of physical memory and virtual memory ;
Several ways of process communication
The Conduit ( Anonymous pipeline , name pipes )
Message queue ;
Semaphore ;
Shared memory ;
socket() Socket ;
Two sides
Characteristics of the transaction
ACID
Atomicity ;
Isolation, ;
persistence ;
Uniformity ;
Isolation level
Read uncommitted ;
Read the submission ;
It can't be read repeatedly ;
Read serialization ;
Processes and threads
Difference between process and thread :
- Process crash does not affect other processes , But thread crash will affect other threads ;
- A process is the smallest unit of resource allocation , Thread is the smallest unit of operation ;
- Threads can access the resources of the process ;
- Process overhead is high , Low thread overhead ;
What is the virtual memory space divided into , Benefits of virtual memory , How to convert a virtual address to a physical address
The operating system bit provides an independent virtual address space for each process , It is mainly divided into user space and kernel space ; User space has code snippets , Global variables , Constant string , Stack, etc ;
Use external memory as memory , Relieve the pressure of physical memory ;
Segmented , Pagination ;
Synchronization of threads
Semaphore ;
The mutex ;
A critical region ;
event or The signal ;
The difference between user mode and kernel mode
- Kernel mode and user mode are the two operation levels of the operating system , When the program runs in 3 When the privilege level is up , It can be called running in user mode . Because it's the lowest privilege level , It's the privilege level of a normal user process , Most of the programs that users face directly run in user mode ;
- When the program runs in 0 When the privilege level is up , It can be called running in kernel state .
- Programs running in user mode cannot directly access the kernel data structure and programs of the operating system . When we execute a program in the system , Most of the time it runs in user mode , When it needs the help of the operating system to complete some work that it does not have the power and ability to complete, it will switch to the kernel state .
- The main difference between the two states is :
When executing in user mode , The memory space and objects that the process can access are limited , The processor in its possession is preemptive ;
The process in the core state execution , Can access all memory space and objects , And the occupied processor is not allowed to be preempted ;
Redis What are the basic data types
string;
Hash;
List;
Set;
SortedSet(zset)
On three sides
stay C++ In an inheritance relationship , Why is the destructor of the parent class defined as a virtual function ; At what stage are global static variables initialized
If it is not defined as a virtual function , But after the subclass inherits the parent class, if the destructor is called, the destructor of the parent class will be called ;
stay main() Pre initialization , And then destroy ;
TCP How to ensure the reliability of data transmission
Inspection and 、 Serial number / Confirm response 、 Over time retransmission 、 Maximum message length 、 Slide window control ;
Say sliding window , If the receiver sliding window is full , What will the sender do
be based on TCP Sliding window protocol in flow control , We know that the receiver returns to the sender ACK The package will contain its own receive window size , If the receiving window is full , At this time, the size of the receiving window returned by the receiver to the sender is 0, At this time, the sender will wait for the window size sent by the receiver until it becomes non 0 until , However , The recipient responded to ACK There is a possibility of packet loss , In order to prevent deadlock caused by both sides waiting , At this time, it is necessary to adhere to the timer to assist the sender to periodically query the receiver , To find out if the window is getting bigger , When the window size becomes non-zero , Sending is convenient to continue sending data
What is a deadlock ? And how to solve the deadlock problem ?
Two threads occupy each other's resources , Do not release , Stuck in there ;
resolvent :
- Necessary conditions for breaking deadlock :① Resources are mutually exclusive / Resources are not shared ;② To possess and wait for / Ask and keep ;③ Resources cannot be taken away ;④ Loop waiting
- Judge “ System security status ” Law : Before allocating system resources , First calculate the security of this resource allocation . If this assignment does not cause the system to enter an unsafe state , The resource is assigned to the process ; otherwise , Let the process wait .
- Banker Algorithm :
边栏推荐
- [graphics] real shading in Unreal Engine 4
- Zzuli: cumulative sum of 1050 factorials
- Zzuli:1049 square sum and cubic sum
- Tonybot humanoid robot infrared remote control play 0630
- Use of constraintlayout
- Timecho of Tianmou technology completed an angel round financing of nearly 100 million yuan to create a native timing database of the industrial Internet of things
- 表单文本框的使用(一) 选择文本
- Four data flows and cases of grpc
- cpu飙升排查方法
- 创业团队如何落地敏捷测试,提升质量效能?丨声网开发者创业讲堂 Vol.03
猜你喜欢
Detailed explanation of four modes of distributed transaction (Seata)
Protobuf and grpc
Paper sharing: generating playful palettes from images
[qingniaochangping campus of Peking University] in the Internet industry, which positions are more popular as they get older?
Frequently asked questions: PHP LDAP_ add(): Add: Undefined attribute type in
adc128s022 ADC verilog设计实现
Talking about part of data storage in C language
C string format (decimal point retention / decimal conversion, etc.)
Luogu p4047 [jsoi2010] tribal division solution
tonybot 人形机器人 红外遥控玩法 0630
随机推荐
Container of symfony
Showmebug entered Tencent conference, opening the era of professional technical interview
Output student grades
Luogu p5018 [noip2018 popularization group] symmetric binary tree problem solution
[ue4] cascading shadow CSM
Implement Gobang with C language
The picture quality has been improved! LR enhancement details_ Lightroom turns on AI photo detail enhancement: picture clarity increases by 30%
Luogu p4047 [jsoi2010] tribal division solution
Bucket sorting in C language
[qingniaochangping campus of Peking University] in the Internet industry, which positions are more popular as they get older?
Zzuli:1046 product of odd numbers
Tonybot humanoid robot checks the port and corresponds to port 0701
puzzle(016.4)多米诺效应
[graphics] adaptive shadow map
How can entrepreneurial teams implement agile testing to improve quality and efficiency? Voice network developer entrepreneurship lecture Vol.03
.NET六大设计原则个人白话理解,有误请大神指正
Adobe Premiere Pro 15.4 has been released. It natively supports Apple M1 and adds the function of speech to text
Zzuli:1059 highest score
Use of constraintlayout
Optical cat super account password and broadband account password acquisition