JS Technology Sharing

Source: Internet
Author: User

File fragmentation is due to the fact that files are scattered across different parts of the disk, rather than being kept in contiguous clusters of disks. [1]

Chinese name

File fragmentation

Foreign names

File fragmentations

Membership

File system

Define listening voice

Files and folders on disk typically occupy multiple clusters of disks, and each cluster is mostly scattered on disk, and these scattered clusters are called file fragments. The more file fragments on a disk, the slower the system reads and creates new files. [2]

When the application requires insufficient physical memory, the general operating system generates temporary swap files on the hard disk and uses the hard disk space that the file occupies for virtual memory. The Virtual memory management program frequently reads and writes to the hard disk, producing a large amount of fragmentation, which is the main cause of disk fragmentation.

Other settings, such as temporary files or temporary file directories that are generated when browsing information from IE browsers, can create a large amount of fragmentation in the system. File fragmentation generally does not cause problems in the system, but too much file fragmentation can cause the system to look back and forth while reading files, causing system performance to degrade, and to shorten hard disk life. In addition, excessive file fragmentation can lead to the loss of storage files.

File fragments Listen to voice

Produce

(1) During a file operation, the Windows system may invoke virtual memory to synchronize the hypervisor, which causes each program to read and write to the hard disk frequently, resulting in file fragmentation.

(2) Another situation is when the middle of a sector content is deleted, a new write to a smaller file, so that there will be some space on both sides of the file, this time to write a file, two pieces of space can not accommodate any part of the file, it is necessary to split the file into two parts, fragments again produced.

(3) The most common is to download large files such as movies, during which people generally deal with other things, and the downloaded movie files are forced to split into a number of fragments stored on the hard disk. So downloading is an important source of fragmentation. There is often delete, add files, this time if the file space is not large enough to produce a large number of file fragments, as the file is frequently deleted, this situation will become increasingly serious.

Effect

Although file fragmentation does not have a significant impact on normal work, it can significantly reduce the speed of the hard drive, mainly because the hard disk reads files need to jump between multiple fragments, increasing the latency of waiting for the disc to rotate to the specified sector and the seek time required for the magnetic head to switch tracks. [1]

The principle of disk read and write operation listening to speech

Knowing the cause of the file fragment, it is necessary to understand the read and write actions of the disk when the program runs. In general, when a program is run, the disk drive's head does the job of searching the program to run the necessary files, then reading the data, and finally doing the post-processing-transferring the data to the disk cache (cache) and memory. Search time is referred to as average seek time (Average seek times) in the hard disk performance index, in milliseconds (ms), and the average seek time for mainstream hard drives is less than 9.5ms. If you can put the application's related files in a contiguous disk space, the head search time will be much reduced. This is also the case when the disk reads data that is located in the sector below the head to only one-fifth of the time it takes to move the head to another location and read the same data. Read the disk, the system first check whether the data in the cache, if there is a direct read, if there is no access to the disk, that is, read disk. The cache works great when you need to read the same data multiple times, but the cache is powerless to read a file for the first time. Therefore, the search time and the reading time affect the efficiency of program execution to a great extent.

Why defragmenting a disk Windows system does not automatically put each file in the most appropriate location on disk by minimizing the principle of head search time. Microsoft added "Disk Defragment" (File defragmenter) to Windows and provided "Taskmonitor" (Task monitor) to track disk activity during program startup to facilitate "disk defragment" Able to work more effectively. "Taskmonitor" is automatically run with Windows startup (of course, "Taskmonitor" is selected in "Startup"). When an application is loaded, it monitors the disk's access actions to understand which files are searched and invoked when the program starts, locates the desired files, and stores the monitoring results in the "C:\Windows\Applog" hidden directory. Most of the files in this directory have ". LGX" as the extension, where "LG" stands for record files (log file), "x" denotes a drive letter, such as ". Lgd" as the extension of the D-disk program, and the file name of the record file is the file name of the application monitored by taskmonitor. If the WinZip on the e-disk is recorded as "Winzip32.lge". When a user is defragmenting a file, the program moves the application's related files to contiguous space on the disk, based on the information in the Applog directory.

Taskmonitor only searches for file information during program loading and adjusts the order of optimization based on how often the program is loaded, meaning that the most frequently used software can receive the most attention. The Applog.ind file in the Applog directory records the number of times the application is running. Users need to start the common software multiple times, accept taskmonitor monitoring and recording, and then use disk defragment to organize, in order to truly realize the program start speed improvement. But if users change the common software in the middle, such as previously used WinZip, instead of ZipMagic, then for a long time disk defragment or the file related to WinZip moved to a continuous space, rather than zipmagic, Unless ZipMagic is loaded more frequently than WinZip. To solve this problem, the user can delete the "WINZIP32.LGX" file, the record file does not exist, Disk defragment will not optimize it.

1. Blocking IO

Figure 1

From Figure 1 We see a process of the simplest IO operation, from notifying the kernel to preparing the data phase to the data from the kernel copy to the user space two processes are blocked.

2. Non-blocking IO

Figure 2

The application process receives polling continuously during the kernel data preparation phase until the data is ready. Data from kernel Copy to user space This phase of I/O operations is still blocked.

3.I/O multiplexing

Figure 3

In the kernel data preparation (I) phase, when one or more Io is ready, the notifier, the data from the kernel copy to the user space phase or blocked, in phase I or polling implementation, but all the IO is concentrated in one place, this place polling. Multiple I/O operations are blocked at the same time, and multiple read operations, I/O functions of multiple writes can be detected at the same time, and the I/O operation function is not actually invoked until there is data readable or writable.

4. Signal-driven IO

Figure 4

When the data is ready for the kernel data preparation phase, the signal notifier data is ready and the data is blocked from the kernel copy to the user space stage.

5. Asynchronous IO

Figure 5

When a system call is issued, it is returned directly. Notifies the IO operation to complete.

The first four IO operations are synchronous IO operations, the last of which is asynchronous IO. The difference: Synchronous IO must require the process to invoke recvfrom actively during the kernel copy-to-user control phase. Asynchronous IO sends all IO operations to the kernel to complete and signal notification. During this period, the user does not need to check the status of the IO operation, and does not need to actively copy the data

H5 is the abbreviation of HTML5. HTML5 is the most recent revision of HTML and is a Hypertext Markup language. H5 has two major features: first, to enhance the performance of Web pages. Second, the functionality of WEB applications such as local databases is appended.

H5 page is the use of HTML5 made out of the page, especially in the rapid development, by this mobile social platform, is entering more people's vision, such as from the H5 of the circle of friends, "surround the nerve cat", to subvert the traditional advertising of the public Reviews H5 feature page "We have only one word", Various H5 games and feature pages are emerging.

The H5 page for campaign promotion is the most common type, with varying forms, including invitations, greeting cards, and test questions. Unlike previous simple static advertising images, today's H5 activity pages need more interaction, higher quality, and more topical design to enable users to share their communications. How do I make a H5 page from entering the H5 page to the final landing to the inside of the brand app?

In fact, the production of H5 page is very simple, the preferred platform is the application of the star. The entire production process without technical requirements, graphical operation, simple and easy to get started. The steps are as follows:

The first step: Login to the site click "Application Production" to enter the production page.

Second step: Select "Advanced Mode" and click "+" to create the app.

Step three: Go to the production page. Nine controls, by clicking Add to the Authoring interface, the control is selected to be used according to your needs.

The fourth step: wait for you to make a good, click Save, Publish, you can generate H5 page.

Fifth step: After publishing, you will see the preview page, where the Web is the H5 page you want, scan the QR code will see the content of the page, but also can share to your friends circle.

If you want to build an Android app while creating a H5 page, see this tutorial: Can app stars generate apps? How to generate?

Sixth step: If you still want to modify your content, please go directly to the application management in the personal center to modify, re-release to complete the content of the update.

This article mainly introduces JavaScript to get the current mouse coordinates of the method, can be used for different browsers to get the coordinates of the mouse position, is very practical skills, the need for friends can refer to the next

This example describes how JavaScript obtains the current mouse coordinates. Share to everyone for your reference. The implementation method is as follows:

For JavaScript to get the current mouse coordinates, you have to know the coordinates of different browsers. The specific code is as follows:

Copy the code code as follows:

<title>javascript get current mouse coordinates </title>

<meta http-equiv= "Content-type" content= "Text/html;charset=utf-8"/>

<script type= "Text/javascript" >

function mouseposition (EV) {

if (Ev.pagex | | ev.pagey) {//FIREFOX, chrome and other browsers

return {X:ev.pagex,y:ev.pagey};

}

return {//IE browser

X:ev.clientx + Document.body.scrollleft-document.body.clientleft,

Y:ev.clienty + document.body.scrolltop-document.body.clienttop

};

}

function MouseMove (EV) {

EV = EV | | window.event;

var mousepos = mouseposition (EV);

document.getElementById (' x '). InnerHTML = mousepos.x;

document.getElementById (' y '). InnerHTML = Mousepos.y;

}

Document.onmousemove = MouseMove;

</script>

<style type= "Text/css" >

H3{color:blue;}

p{line-height:30px;height:30px;font-size:14px;width:500px;}

Span{color:orange;font-weight:bold;}

</style>

<body>

<p> x-Axis coordinates: <span id= "x" ></span></p>

<p> y axis coordinates: <span id= "y" ></span></p>

</body>

JS Technology Sharing

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.