Small notes (overloaded, rewritten, polymorphic) (Linux du and DF)

Source: Internet
Author: User
Tags disk usage

1. A method name, with different parameters, is called method overloading . (overload)
void foo (String str);
void foo (int number);


2. The parent class has the same method name and parameters as the subclass, which is called method overrides . (Override)
Class Parent {
void Foo () {
System.out.println ("Parent foo ()");
}
}

Class Child extends Parent {
void Foo () {
System.out.println ("Child foo ()");
}

}


3. The parent class reference points to the subclass object, which invokes the implementation of the subclass, rather than the implementation of the parent class, which is called polymorphism .
Parent instance = new Child ();
Instance.foo (); ==> Child foo ()

Three prerequisites for polymorphism:
1. To have an inheritance relationship
2. Subclasses to override methods of the parent class
3. Parent class reference to child class object

I understand that polymorphism is related to the inheritance system, which is related to method overrides and is independent of method overloading.

Du and df*******************************************

Du (disk usage) calculates the size of each file by searching for a file, and then accumulates the files that du can see only some of the current ones that are not deleted. The size of his calculations is the cumulative sum of all the file sizes that he currently thinks exist.


DF (disk free) through the file system to quickly obtain information about the size of the space, when we delete a file, the file is not immediately disappear in the file system, but temporarily disappeared, when all the programs are not used, will be released according to the rules of the OS deleted files, DF records the size of files obtained through the file system, where he is able to see the deleted files more than Du, and when the size is calculated, this part of the space is added, more accurate. When the file system also determines that the file has been deleted, the Du and DF coincide.


Du and DF inconsistency reasons:
Common DF and du inconsistencies are issues with file deletion. When a file is deleted, it is not visible in the file system directory, so du will not count it anymore. However, if there is a running process that holds the handle to the deleted file, the file will not actually be deleted on the disk and the information in the partition's Super block will not change. This way DF will still count the deleted files.

In fact, even if you have nothing at home/home, the DF command will still show that it takes up a portion of the space, and the file system's metadata takes up some of the space.

The data for DF and du statistics are different.
For example , files need to be placed in the file cabinet, even if there is only one file, also occupy a file cabinet. The file cabinet occupies a larger space than the file.
DF is the number of file cabinets used in the statistics.
Du then counts the actual number of files.
This way down, DF Count is big, du is small.


In a simple way, the DF command is calculated by using the inode of the volume, and the Du is the number of characters that accumulate all the files. A file can occupy an inode even if it has only 1 characters.

Small notes (overloaded, rewritten, polymorphic) (Linux du and DF)

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.