"LINUX" Programming notes

Source: Internet
Author: User

A storage class can only is specified for objects and functions

extern modification of a struct error, the reason for the mistake, C + + storage class modifier has auto, register, extern, static, these modifiers can only modify objects or functions, here with extern to modify the struct is wrong.

The command-shared that g++ generates a dynamic-link library is a standard object, and-fpic indicates that the function can be redirected. g++-o libthreadpool.so-shared-fpic threadpool.cpp-l pthread

g++ calls the local dynamic Library compilation command-l specifies the dynamic Library search path, and if the system default path is not found, go to-l to specify the path to search g++-o testpool testpool.cpp-l threadpool-l./g++ command-G after generating debug information, BT can view the call stack when viewing the core

View core information gdb A.outcore CORE.XXXXXBT

You can now view the values of each variable to locate the error more precisely

View dynamic Library information for a file link ldd execfile

Synchronous/asynchronous synchronization and Asynchrony are often related to threads, such as sendmsg, thread a-> thread B, which waits for a response from another thread or process after the message is sent. If sendmsg later thread a waits for thread B to return a response message, the line friend continues processing, which is synchronization if thread a continues to do its thing after sendmsg, and registers a callback or response thread to process the response message of thread B, This is where asynchronous synchronization tends to be blocking async, which is often non-blocking

Blocking/nonblocking blocking read: The thread will block until there is readable data. Non-blocking read: After setting o_noblock, if FD has no readable data, read will immediately return 1 and set errno to Eagain. Blocking is the same as non-blocking read when there is readable data. Blocking the write:data from the User-mode space move to the Kernel-mode space, after which the system completes the processing of the kernel-mode to the physical buffer and returns, then blocks the IO return. Non-blocking Write:data from User-mode space move to Kernel-mode space, write returns.

Linux signal Linux sends a specified signal to the specified process kill-s signal_name/signal_no pid signal_number sig Value 0 0 1 Sighu P 2 SIGINT 3 sigquit 6 SIGABRT 9 SIGKILL sigalrm 1 5 SIGTERM

A long length of 64 bits is 64

How to view memory under Linux x/100x 0x46505650

Undefined reference to may depend on the library in the wrong order

GDB Debug signal to prevent GDB from taking over the signal handle SIGINT nostop Print pass signal SIGINT

How the child process knows if the parent process exits 1.getppid, or if equals 1 indicates that the parent process has exited 2. Register the signal and send a signal to the child process when the parent process exits 3. Pipeline processing, parent process and child process to establish a pipeline, scheduled to send and receive messages, through the pipeline to maintain contact 4. The parent process locks a file, the child The parent process is still

Nohup mode START process Nohup processname & start in nohup mode, play the role of Daemon

resolving gcc garbled lang=en_us

GDB Multi-Process Debugging Method 1: Debug multi-process the most soil approach: Attach PID method 2:set Follow-fork-mode Child + main breakpoint method 3:set Follow-fork-mode child + catch exec

Recently the most fun joke: friends want to make a bun, the results made Daguokui, sigh: "Bun Ah, you are doomed to do not yourself."

And my idea of super-divergent daughter-in-law, we talk about more recruit a few people, recruit enough 4 people can playing mahjong will, she instantaneous back to a sentence, recruit enough 7 how good, can summon Dragon bead!

I am a boring guy, but my life is very fun, cheap friends, Meng Da's wife, as well as photographers + chef's friends, there are ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.