I. Five I/O models
1. Blocking I/O
The I/O model we mentioned above is blocking I/O, that is, calling the Recv system call. If there is no data, the wait will be blocked, when the data arrives, the data is copied from the kernel space (set
There are two types of Linux linked files, which are similar to shortcuts in windows. However, the Linux link file type is different from that in windows.
One of the most important features of a Linux file system is its file link. The link is a
System
# Uname-A # view kernel/OS/CPU information # Head-N 1/etc/issue # view OS version # Cat/proc/cpuinfo # view CPU information # hostname # view computer name # lspci-TV # list all PCI devices # lsusb-TV # list all USB devices # lsmod # list
In the network, many servers use Linux systems. To further improve the server performance, you may need to recompile the Linux kernel based on specific hardware and requirements. To compile the Linux kernel, you must follow the required steps.
1. Principles
The Linux kernel uses an internal storage paging model that is applicable to both 32-bit and 64-bit systems. For 32-bit systems, two-level page tables are sufficient, while in x86_64 systems, 4-level page table, as shown in Figure 2-1.
During the sleep review, I want to verify that the spin lock cannot sleep, so I have compiled a module to sleep in the spin lock. However, when I test the single-core CPU of armv7 (Ti A8 chip), it will not lock and the spin lock can be obtained
In the previous section, we introduced UNIX domain socket programming. More importantly, Unix domain sockets can transmit file descriptors between processes on the same host.
Here are two functions:
# Include # Include
Ssize_t sendmsg (INT sockfd,
Thread data processing-thread data
To protect variables, we must use semaphores, mutex, and other methods to ensure correct use of variables.
1) thread dataIn a single-threaded program, there are two basic types of data: global variables and
Compile the program today and find that the program reports an error as follows:
Cannot find-liconv
Collect2: LD returned 1 exit status
Or
Undefined reference to 'libiconv _ open'
Collect2: LD returned 1 exit status
Because the liconv package is
I. sequential program and concurrent program features
Sequential program features
SequenceClosed: (closed runtime environment)CertaintyReproducibility
Concurrent program features
SharingConcurrencyRandomness
2. Process mutex
1. Because
I. Message Queue
1. Message Queue provides a method to send a piece of data from one process to another.2. Each data block is considered to be of a type. The data block received by the recipient process may have different types of values.
3. The
I. POSIX condition Variables
A scenario of Inter-thread synchronization: thread a needs to wait for a condition to be established before it can continue to run. Now this condition is not true, and thread a will block the wait, when thread B sets
Producer consumer problem: this problem describes two processes that share a fixed-size buffer-the so-called "producer" and "consumer"-problems that will occur during actual operation. The main function of the producer is to generate a certain
I. Concepts of terminals
In a UNIX system, a user logs on to the system through a terminal and obtains a shell process. The terminal becomes the controlling terminal of the shell process. The control terminal is the information stored in the PCB, we
N when creating a symbolic link, you must use an absolute path,For example:/Usr/local/cxxt/config-ToolsTo create/usr/bin/config-ToolsIf your current directory is in the cxxt directory, runLn-S./config-tools/usr/bin/config-ToolsRun config-tools.Too
Thread: A thread is created in a process, and its life cycle is in this process.
Thread: it allows a process to execute one or more execution paths (that is, a process can have multiple threads to execute different programs). These execution paths
# Include # Include # Include # Include
Int arr [] = {7,348 };Int g_ I = 0;Pthread_t thread [2];Pthread_mutex_t mutex_1, mutex_2; // mutex lock
Void print_arry () // print the Array{Int I = 0;For (; I {Printf ("% d \ t", arr [I]);}Printf ("\ n
Thread Synchronization:
Mutex (mutex) is required for thread synchronization, which is expressed in the pthread_mutex_t type.
Mutex is a simple locking method to control access to resources of interest. At the same time, only one thread can master
Linux inter-process communication (IPC) has the following methods:1-"pipelines (PIPE) and named pipelines (FIFO ).2-> Message Queue3-shared memory4-"semaphores5-"signal (signal)6-"socket (sicket)Here let's take a look at the 3rd types of =
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