The set and get of Android Systemproperties may have a delay analysis

Source: Internet
Author: User

First of allSystemproperties'sThe set and get implementations are different, and set requires communication with the property service (the Init process) via the local socket.
Then the property service receives the request and then sets the property workspace (shared memory mode).
But the property service (the init process) isSingle ThreadWork, so sometimes it maySlow Response(for example, it is shutting down a subprocess or doing something else),
Android found the problem when it was designed, so the action they took was to wait after set250msTo ensure that most of the timeRead-after-write can work correctly,
But 250ms does not guarantee that it will work correctly at all times, so we can assume that this is a design flaw . The comments in the Android source code already illustrate this point, as follows:



Another systemproperties.Getis directly from the map to the processProperty Workspace(shared memory) obtained,
If the property service is busy at this timewaiting for the 250msThen there is still no set to the property workspace (shared memory),
Sothe old value of the error is obtained at this time, instead of just sending it to the property service.New Value。

The implementation framework for Systemproperties is as follows:

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.