CPU subsystem
The most common parameter of the CPU subsystem is CPU. Shares. We can trace the read and write operations on this parameter through the cgroup Learning (3)-pseudo file table.Through systemtap, we can see the read BT :( cat CPU. shares)
2327 (cat) cpu_shares_read_u64 call trace: 0xffffffff8104d0a0 : cpu_shares_read_u64+0x0/0x20[kernel] 0xffffffff810be3aa :cgroup_file_read+0xaa/0x100 [kernel] 0xffffffff811786a5 : vfs_read+0xb5/0x1a0[kernel] 0xffffffff811787e1 : sys_read+0x51/0x90[ker
: found DTCM1 8k @ 00000000, not enabledCPU: moved DTCM1 8k to fffea000, enabledCPU: found ITCM0 8k @ 00000000, not enabledCPU: moved ITCM0 8k to fffe0000, enabledCPU: found ITCM1 8k @ 00000000, not enabledCPU: moved ITCM1 8k to fffe2000, enabledBuilt 1 zonelists in Zone order, mobility grouping on. Total pages: 65024Kernel command line: root=/dev/mtdblock2 rootfstype=cramfs console=ttySAC0,115200PID hash table entries: 1024 (order: 0, 4096 bytes)Dentry
cgroup-o cpu cpu0/cgroup/CPU, BT in this process is as follows (obtained using the print_backtrace () function of systemtap ):
74447240 8388 (mkdir) call trace: 0xffffffff81054e60 :cpu_cgroup_populate+0x0/0x30 [kernel] 0xffffffff810c007a : cgroup_populate_dir+0x7a/0x110[kernel] 0xffffffff810c11fc : cgroup_mkdir+0x33c/0x540[kernel] 0xffffffff811850a7 : vfs_mkdir+0xa7/0x100[kernel] 0xffffffff8118816e : sys_mkdirat+0xfe/0x120[kernel] 0xffffffff811881a8 : sys_mkdir+0x18/0x20[kernel] 0xffffffff8100b
In Linux, we generally do not need to release the memory because the system has managed the memory well. But there are exceptions in everything. Sometimes the memory will be occupied by the cache, which will affect the system's performance by using SWAP space. In this case, you need to release the memory (clear the cache.
The Caching mechanism in Linux is quite advanced. It will be used for dentry (for VFS, to accelerate the conversion from file pa
operating system, buffers/cached are both used, so it is considered that free is only 27824.For applications (-/+ buffers/cach ). buffers/cached is equivalent to available, because buffer/cached is used to improve the performance of program execution. When the program uses memory, buffer/cached will be quickly used.
The third line is the swap partition swap, which lists used and idle swap.
So what is the difference between buffers and cached?In order to improve disk access efficiency, Linux has
.
Reference
[Root @ server ~] # Cp-r/etc ~ /Test/
[Root @ server ~] # Free-m
Total used free shared buffers cached
Mem: 249 244 4 0 8 174
-/+ Buffers/cache: 62 187
Swap: 511 0 511
After I run the command, used is 244 MB, free is 4 MB, buffers is 8 MB, and cached is 174 MB. Don't be nervous. This is to improve the efficiency of File Reading.
In order to improve disk access efficiency, Linux has made some careful designs, in addition to caching dentry (
= kobject_get ( kobj-> kset-> kobj); // if no parent is specified, set the parent to its kset
List_add_tail ( kobj-> entry, kobj-> kset-> list); // Add kobject to the kset linked list, which is equivalent to adding the kset directory.
Kobj-> parent = parent;
}
Create_dir (kobj, shadow_parent );
Sysfs_create_dir (kobj, shadow_parent); // generate a file directory under sysfs
Populate_dir (kobj) // generate a directory based on the attribute of kobj
If (T T-> default_attrs) {// de
data synchronously from the device
Ssize_t (* write) (struct file *, const char *, size_t, loff_t *);
// Send data to the device
INT (* readdir) (struct file *, void *, filldir_t );
// Read directory only. For device files, this field is null.
Unsigned int (* poll) (struct file *, struct poll_table_struct *);
// Round-robin function to determine whether non-blocking read or write operations can be performed currently
INT (* IOCTL) (struct inode *, struct file *, unsigned int, unsigned long );
/
into newly created processes and passes its address down to glibc upon exec (). this feature is enabled by default. vdso is a virtual DSO (dynamic shared object) exposed by the kernel at some address in every process 'memory. it's purpose is to speed up system CILS. the mapping address used to be fixed (0xffffe000), but starting with 2.6.18 It's randomized (besides the security implications, this also helps debuggers twenty-seven vfs_cache_pressurecontrols the tendency of the kernel to reclaim
The Unified Call uses MMAP () to map a common file to implement shared memory. System V maps files in the SHM of a special file system to implement shared memory communication between processes. That is to say, each shared memory area corresponds to a file in the shm of the special File System (this is linked through the shmid_kernel structure), and will be elaborated later.
1. Principle of System V shared memory
Data to be shared between processes is stored in a region called IPC shared memory,
-Buffers/cache memory: Used-Buffers-cached
+ Buffers/cache memory: Free + buffers + cached
Available memory = free memory + buffers + cached
With this foundation, we can know that I now used is 163 MB, free is 86, buffer and cached are respectively 10, 94
Let's take a look at the memory changes if I copy the file.
[Root @ server ~] # Cp-r/etc ~ /Test/[Root @ server ~] # Free-mTotal used free shared buffers cachedMem: 249 244 4 0 8 174-/+ Buffers/cache: 62 187Swap: 511 0 511
After I run the comm
~] # Cp-r/etc ~ /Test/[Root @ server ~] # Free-mTotal used free shared buffers cachedMem: 249 244 4 0 8 174-/+ Buffers/cache: 62 187Swap: 511 0 511
After I run the command, used is 244 MB, free is 4 MB, buffers is 8 MB, and cached is 174 MB. don't be nervous. This is to improve the efficiency of File Reading.
Reference http://www.wujianrong.com/archives/2007/09/linux_free.html "in order to improve disk access efficiency, Linux has made some careful design, in addition to the
specially used for slab distributor caching, for example, for caching the dentry cache of the file directory structure and for caching the inode cache of the index node.
Before the page is recycled by the operating system, all associated process page items must be disconnected from the page. For an anonymous page, before the page is recycled, the content on the anonymous page must be first exchanged to the swap area. If the page to be recycled is a "
of Tree node files. operating all files is the same as the logic of the tree.
What is an index node in linux? What is it used?
In Linux, each file has an I node that stores the owner's identity, permissions, and time information. Note: I node does not save the file name. The file name is saved in a dentry named directory item.You can use ls-I and stat to add file names to view the I node information of the file,The Linux kernel often uses the I node
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.