useful for implementing queues. */StaticInlinevoidList_add_tail (structList_head *New,structList_head *head) {__list_add (New, head->prev, head);}/*** The difference between List_add and List_add_tail is:* List_add is always inserted in the first position after the chain header: For example, linked list: head-to-data 1--Data 2--data 3, after inserting new elements: head-to-new--> ; Data 1--Data 2 --Data 3* List_add_tail always inserts new elements at the end of the list: for example, linked li
Task_running
Can run
Task_interruptible
interruptible Wait Status
Task_uninterruptible
Non-interruptible wait state
Task_zombie
Dead
task_stopped
Time out
Task_swapping
Swapping in/swapping out the status of the Linux process
• Operational statusProcesses that are in this state are either running or ready to run. The process that
should not appear task_ The slub structure of a struct occupies the largest amount of memory, which means that a large number of processes are open on this server (the Linux kernel is a single unit for processes and threads, so do not tangle with this, which may be followed by process and thread mixing).Through this information, the brothers found that the server has nearly 30,000 threads, but also to locate the problem of the network
In this article "Linux kernel Virtual File System Analysis", we can see how files are opened and how file read/write is triggered.
When you call the read/write System for an opened file fd, f_op-> read/f_op-> write of the file structure corresponding to the file in the kernel is called.
This article will follow this path to see how the reading and writing of common disk files is achieved.
The
identifier.
Camel spelling, Studly caps, or other mixed uppercase and lowercase characters are not allowed in the name. Global variables and functions should select names that contain descriptive content, use lowercase letters, and underline words when necessary.
In the source code less use TypeDef, IFDEF.
diff -urN linux-old/ linux-new/ > my-patch //通过源码和加进了所修改部分的源代码两份代码创建补丁diff -u
Lea EAX,[EBX+ECX]
Leal (%EBX,%ECX),%eax
Sub eax,[ebx+ecx*4h-20h]
subl-0x20 (%ebx,%ecx,0x4),%eax
As can be seen from the table, the grammar of at-and-T is more obscure, because [Base+index*scale+disp] can see its meaning at a glance, and disp (Base,index,scale) is unlikely to do so.This approach is often used to access a field within a particular element of the data structure array, where base is the star
time determines the RCU lock implementation of the algorithm core, it can directly determine all the data structure. To be exact, writer must waitting for all readers leaving to update the original data, and the question is, how does it know that all the reader is gone?Several implementations of the Linux kernel for RCU locks 1. Original implementation-The concept of RCU lock was introduced by using preemption to prohibit the
counter becomes 0, at this moment, it is time to overwrite all copies of the original data.Now summarize all of the three elements:Read Flag New reader counter for the RCU lock plus 1Write-time copy assumes that the old reader counter for the RCU lock is not 0, then the write-time copy is run.Update time each time the unlock operation, the reader counter for this task (or new reader. or old reader) minus 1. Once the RCU lock's old reader counter becomes 0. All update operations are run.Evaluati
column-based ACL for autonomous access control, that is, the access permission information of this file is stored in each file. Here we use the index node inode (defined in include/Linux/Fs. h) as the starting point for analysis. The inode struct contains the I _uid and I _gid elements, and an I _mode element. This I _mode is represented by a 16-bit unsigned int
Summary:Based on the list definition of the Linux kernel, this paper attempts to complete the related interface design, and constructs the test case to realize the usage of the list interface.Body:Let's start by looking at the list interfaces provided by the Linux kernel as follows:struct head_node{struct head_node* pre;struct head_node* next;};That is, there are only two pointers in the node: one pointing
Inter-process communication-pipelines-Linux Kernel Analysis (8)MPs queue
A pipe is a one-way communication mechanism between two processes.
Because pipelines transmit data in one direction, pipelines are also called half-duplex pipelines.
This feature of MPs queues determines the limitations of the tool. As one of the first Unix IPC formats supported by Linux, p
Forget_original_parent () and the latter invokes Find_new_reaper () to perform the parent-seeking process.It then iterates through all the child processes and sets up a new parent process for them.Then call Ptrace_exit_finish () to do the same for the new parent process, which is to find the father for Ptraced's child process.Traversed two linked lists: the child process list and the Ptrace child process chain list, which sets a new parent process for each child process.The final init process r
the underlying empty element, similar to writing of_device_id[] when the last empty element, this application layer should be noted when parsing.
The event processing layer does not cache the received events, and if a new event arrives, it will be overwritten even if the old event is not read, so the application needs to be read in a timely manner.
As mentioned earlier, the macros in "Include/uapi
PS. He Bong Original works reproduced please specify the source "Linux kernel Analysis" MOOC course http://mooc.study.163.com/course/USTC-10000290001.mykernelExperimental Guidance (how the operating system works)Use the lab building virtual machine to open the shell and enter the following code
1 CD linuxkernel/linux-3.9.4
2 Qemu-kernel Arch/x86/boot
ObjectiveFrom our previous chapter "Linux C Development-memcached source analysis based on the Libevent network model " We have a basic understanding of the Memcached network model. In this chapter, we need to interpret Memcached's command parsing in detail.We review the previous chapter and found that memcached is divided into the main thread and n worker threads. The main thread is primarily used to liste
embedded linux QT Development (III.)--GUI principle Analysis First,command-line programscommand-line programs are process-oriented programming.Features of the command-line program:A. Execution based on sequential structureB, the program execution process does not need to interact with the userC, program execution end gives the final running resultCommand-line Application occasions:A, single-task occasionsB,
. The code is as follows:ENTRY (RET_FROM_INTR) get_current (%EBX) //Place a pointer to the TASK_STRUCT structure of the current process into the Register EBXMOVL eflags (%ESP),%eax# mix eflags and Csmovb CS (%ESP),%altestl $ (vm_mask | 3),%eax//see if the interrupt is in User state jne Ret_with_reschedule //assumed to be in user state, then run Ret_with_ RESCHEDULEJMP Restore_allRet_with_reschedule:cmpl $0,need_resched (%EBX)//View the contents of the TASK_STRUCT structure at need_resched jne
advance, and when this function is called, all commands in the function are executed. The shell functions are defined in the following way:[function] Name () {Compound-command} [redirection]This allows you to define a function named "name". The reserved character function is optional. If we give this function reserved word, the parentheses are optional. The body of a function is a compound command. Those commands are usually contained in a compound command between "{" and "}". The entire compou
)//IRQ as interrupt request number {int shared = 0;unsigned long flags;struct irqaction *ol D, **p;irq_desc_t *desc = Irq_desc + irq;//find the corresponding channel */* Some drivers like serial.c use REQUEST_IRQ () heavily, * so we have To is careful not to interfere with a * running system. */if (New->flags Sa_sample_random) {/* * This function might sleep, we want to call it first, * outside of the Omic block. * Yes, this might clear the entropy pool if the wrong * driver are attempted to be
Name: Wang ChenguangStudy No.: 20133232Wang Chenguang + original works reproduced please specify the source + "Linux kernel analysis" MOOC course http://mooc.study.163.com/course/USTC-1000029000First, the process of starting and switching source code and analysistypedef struct PCBs are used to represent a process that defines a process-management-related data structure. The data types used to hold the EIP a
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.