Baidu measured deadlock MySQL open face questions of

Face by a (part of the answer)

https://www.nowcoder.com/discuss/293663?type=all&order=time&pos=&page=1

notes:

About the function name is stored there

If there is a function: void fun (); if the output function name that is printf ( "% d", fun); and output printf ( "% d", & fun); namely, how much, and why

Stored in the symbol table .
The function name itself is only used to define the domain alleged a function (if taking into account the function overloading in C ++, it may be more than one), the compiler will generally save the name to the symbol table, and retain the function name in the object file (weight carrier function may be renamed) for use by other compilers, linkers, etc. used. Generally does not appear in memory at runtime function name, operating system or the program itself determines that a specific function of the address of the function code. For users of the language, in addition to declarations, definitions, like function call expression, the function name and the same identifier of general resources can not be exploited directly, not as strings.
For the case of non-call function, the function name can be implicitly converted to the corresponding function pointer, and (different predetermined C and C ++, but embodied the same result) for the result of the function monohydric & effect is a corresponding function pointer . Thus printf ( "% d", fun ); and printf ( "% d", & fun); action output value is a pointer to the fun, is fun address. (However, output pointer should use% p,% d is not standard usage.)
1L errors, fun with no arguments reference function names to the list is not a function call; in addition% d output decimal,% x is the hexadecimal (% p are generally hexadecimal).

In c ++ class member function is stored in a static memory area, static function that is stored in the static storage area, they are all stored in the same class in part exhausted

In C ++ member functions, static member functions, virtual functions are how the stored? Which of them is called first?

https://blog.csdn.net/urecvbnkuhbh_54245df/article/details/6437106  (General)

 1. The non-static data member is placed on each of the objects within the object as a member of the proprietary data.
 2. static data members are extracted on the program's static data area, for the class to share all the objects , there is only one copy.
 3. static and non-static member functions will eventually be extracted on the program code segments and to all such shared objects , so each member function can only exist a code entity. In c ++ class member functions are stored in static memory of that static function is stored in a static memory area, they are exhausted to save the same part in the class.
   Therefore, only the data object itself constitute any member functions are not affiliated with any object, the relationship between non-static member function of the object is binding, binding mediation is this pointer .

Memory distribution and vtable C ++ object  http://blog.sina.com.cn/s/blog_60e96a410100lirk.html  (see detail, good memory object picture)

Note that, when multiple inheritance and virtual inheritance, the derived class virtual function is added newly added at the position of a virtual table pointer.

 Pattern C ++ program memory is usually divided into four areas:

Global data area (data area), area code (code area), the stack area (stack area), heap (heap area) (i.e., the free store) .

Global data storage global variables, static data and constants;

All members of the class member functions and the function code stored in the non-code area;

Assign a function to run local variables, function arguments, return data stored in the return address stack area;

The remaining space was called heap area.

https://blog.csdn.net/fuzhongmin05/article/details/59112081

C / C ++ to print the file name, line number, function name method

https://blog.csdn.net/cabinriver/article/details/8960119

Use macros

1) __VA_ARGS__ is a variable parameter of the macro, the macro may be the new norm in the new C99 seems currently supported (VC6.0 compiler does not support) after gcc and VC6.0. Macro role is preceded by ##, when the number of the variable parameter is 0, the front ## where the excess play "," effect removed.
2) __FILE__ precompiled macro will be replaced when the current source file name
3) __LINE__ macro replaced with the current line number in the pre-compile time
4) __FUNCTION__ macro function name replaced with the current time in the pre-compiled

linux view the status of the process deadlock

Pstack and use gdb tool to analyze the deadlock program

pstack process ID to see the stack information for each thread

When the process hanged, use many times, deadlocks and other thread has been in a state of lock, determine certain thread has not changed, and so has been in a state of lock. Then the thread is likely to deadlock. If you suspect a deadlock which threads can be used to further attach gdb thread and analyzed.

Run gdb attach process ID, enter gdb debugging terminal

Run: (gdb) info thread

MySQL face questions of deadlock

What is a deadlock? Lock wait? How to optimize this kind of problem? What can be monitored through a database table?

https://www.cnblogs.com/FengGeBlog/p/10284318.html

Deadlock face questions (deadlock causes and necessary conditions for deadlock, the solution)

https://blog.csdn.net/hd12370/article/details/82814348 (see details)

Eight kinds of sorting algorithms

Time complexity (average, worst, best)

 

Stability

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ref

https://www.nowcoder.com/discuss/161635?type=post&order=time&pos=&page=1

Guess you like

Origin www.cnblogs.com/GuoXinxin/p/11699658.html