हमारा सुझाव है कि 27 मार्च, 2025 से AOSP को बनाने और उसमें योगदान देने के लिए, aosp-main
के बजाय android-latest-release
का इस्तेमाल करें. ज़्यादा जानकारी के लिए, AOSP में हुए बदलाव लेख पढ़ें.
Zygote प्रोसेस के बारे में जानकारी
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
Zygote, Android ऑपरेटिंग सिस्टम में मौजूद एक प्रोसेस है. यह एक ही ऐप्लिकेशन बाइनरी इंटरफ़ेस (एबीआई) वाली सभी सिस्टम और ऐप्लिकेशन प्रोसेस के रूट के तौर पर काम करती है.
Pixel 7 और उसके बाद के वर्शन वाले मॉडर्न डिवाइसों पर, 64-बिट Zygote प्रोसेस होती है.
इसके अलावा, प्राइमरी एबीआई के लिए WebView Zygote भी होता है. यह एक खास Zygote होता है, जिसमें वेबव्यू चलाने वाली प्रोसेस के लिए लाइब्रेरी और संसाधन होते हैं.
ज़ाइगोट ये काम करता है:
Android OS के शुरू होने पर, init डेमन, Zygote प्रोसेस को शुरू करता है. कुछ ड्यूअल आर्किटेक्चर सिस्टम पर, दो Zygote प्रोसेस (64-बिट और 32-बिट) शुरू की जाती हैं. इस पेज पर सिर्फ़ सिंगल आर्किटेक्चर सिस्टम के बारे में बताया गया है.
Zygote, ऐप्लिकेशन के लिए खास तौर पर बनी प्रोसेस (यूएसएपी) नाम की प्रोसेस को तुरंत शुरू कर सकता है. इसके अलावा, ऐप्लिकेशन के हिसाब से प्रोसेस शुरू करने का इंतज़ार भी कर सकता है.
पहले विकल्प को सिस्टम प्रॉपर्टी या Android डीबग ब्रिज कमांड की मदद से चालू किया जाना चाहिए. प्रोसेस को तुरंत शुरू करने के लिए, Zygote को कॉन्फ़िगर करने के बारे में ज़्यादा जानने के लिए, ऐप्लिकेशन की सामान्य प्रोसेस पूल को चालू करना लेख पढ़ें.
अगर आपके डिवाइस पर USAP पूल चालू है, तो:
- सिस्टम सर्वर, पूल से उपलब्ध यूएसएपी से कनेक्ट करने के लिए, यूनिक्स डोमेन सॉकेट का इस्तेमाल करता है. सिस्टम सर्वर, प्रोसेस के आईडी (पीआईडी), सीजी ग्रुप, और अन्य जानकारी में बदलाव करके, ऐप्लिकेशन के इस्तेमाल के लिए यूएसएपी को पहले से कॉन्फ़िगर करने का अनुरोध करता है.
- जब USAP को पहले से कॉन्फ़िगर कर लिया जाता है, तो वह पीआईडी के साथ सिस्टम सर्वर को जवाब देता है.
- जब कोई ऐप्लिकेशन इनमें से किसी यूएसएपी को हासिल कर लेता है, तो वह यूएसएपी पूल का हिस्सा नहीं रह जाता. जब पूल में एक या उससे कम यूएसएपी हो जाते हैं, तो Zygote पूल में नए यूएसएपी जोड़ देता है.
अगर आपका Zygote, लेज़ी इवैल्यूएशन का इस्तेमाल करके प्रोसेस शुरू करता है, तो:
- सिस्टम सर्वर को एक निर्देश मिलता है कि किसी ऐप्लिकेशन को प्रोसेस करने की ज़रूरत है.
- सिस्टम सर्वर, सही Zygote को निर्देश भेजने के लिए Unix डोमेन सॉकेट का इस्तेमाल करता है.
- Zygote, प्रोसेस को फ़ॉर्क करता है और PID, cgroup, और अन्य जानकारी में बदलाव करता है.
- प्रोसेस पूरी होने पर, यह PID को Zygote में वापस भेजता है. इसके बाद, Zygote इसे सिस्टम सर्वर पर भेजता है.
USAP पूल चालू करना
USAP पूल का इस्तेमाल करने के लिए, इनमें से कोई एक काम करें:
इस सुविधा के चालू होने पर, हर Zygote में फ़ॉर्क की गई प्रोसेस का एक पूल होता है. यह प्रोसेस, ऐप्लिकेशन के शुरू होने की प्रोसेस के उन हिस्सों को पूरा करती है जो ऐप्लिकेशन पर निर्भर नहीं होते.
Zygote से जुड़ी समस्याएं हल करना
इस सेक्शन में, Zygote से जुड़ी समस्याओं को हल करने के तरीके बताए गए हैं.
Zygote क्रैश हो रहा है
अगर आपका डिवाइस ठीक से रीबूट नहीं होता और आपके लॉग या क्रैश रिपोर्ट में Zygote से जुड़ी समस्याएं दिखती हैं, तो हो सकता है कि आपने हाल ही में कोई ऐसा बदलाव किया हो जिसकी वजह से initd या सिस्टम सर्वर क्रैश हो गया हो. कोड में बदलाव करने से समस्या ठीक हो जाएगी.
SELinux से जुड़ी गड़बड़ियां या इनपुट/आउटपुट से जुड़ी गड़बड़ियां
Zygote, प्रोसेस की सीमाओं के बीच फ़ाइल डिस्क्रिप्टर की साफ़-सफ़ाई के बारे में खास तौर पर ध्यान रखता है. जब फ़ाइल डिस्क्रिप्टर, फ़ॉर्क के समय मौजूद होते हैं, लेकिन अनुमति वाली सूची में नहीं होते, तो हम dup
से /dev/null
के लिए सिस्टम कॉल का इस्तेमाल करते हैं. इससे, कैश मेमोरी में सेव किए गए फ़ाइल डिस्क्रिप्टर का इस्तेमाल, अनजाने में नई फ़ाइलों को ऐक्सेस करने के लिए नहीं किया जा सकता.
अगर फ़्रेमवर्क में बदलाव किए जा रहे हैं और इनमें Zygote में संसाधन लोड करने की कोशिश शामिल है, तो आपको SELinux से अनुमति न मिलने या आईओ के काम न करने की गड़बड़ियां मिल सकती हैं. ऐसे में:
बिना नाम वाले फ़ाइल डिस्क्रिप्टर के लिए, Restat
को कॉल करते समय, फ़ाइल डिस्क्रिप्टर को fds_to_ignore
वेक्टर में शामिल करें.
नाम वाले फ़ाइल डिस्क्रिप्टर के लिए:
WORKING_DIRECTORY/frameworks/base/core/jni/fd_utils.cpp
में बदलाव करें.
- अनुमति वाली सूची में, खोली जा सकने वाली फ़ाइलों का पाथ जोड़ें.
इस पेज पर मौजूद कॉन्टेंट और कोड सैंपल कॉन्टेंट के लाइसेंस में बताए गए लाइसेंस के हिसाब से हैं. Java और OpenJDK, Oracle और/या इससे जुड़ी हुई कंपनियों के ट्रेडमार्क या रजिस्टर किए हुए ट्रेडमार्क हैं.
आखिरी बार 2025-07-27 (UTC) को अपडेट किया गया.
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 2025-07-27 (UTC) को अपडेट किया गया."],[],[],null,["# About the Zygote processes\n\nThe *Zygote* is a process in the Android operating system that acts as the root\nof all system and app processes with the same application binary\ninterface (ABI).\n\nOn modern devices, such as Pixel 7 and later, there is a 64-bit Zygote process.\nIn addition, there is the *WebView Zygote* for the primary ABI, which is a\nspecialized Zygote\nthat contains libraries and resources specific to processes that run WebViews.\n\nHere are the tasks the Zygote performs:\n\n1. The init daemon spawns the Zygote process when the Android OS is\n initialized. On some dual architecture systems, two Zygote processes (a 64-bit\n and 32-bit) are spawned. This page covers only single architecture systems.\n\n2. The Zygote can immediately spawn processes called *unspecialized app\n processes (USAP)* or wait to spawn processes as needed by applications.\n The former option must be enabled through a system property or Android\n debug bridge command. For more information on configuring the Zygote to spawn\n processes immediately, see\n [Enable unspecialized app processes pool](#enable).\n\n - If the USAP pool is enabled on your device:\n\n 1. The system server uses a Unix domain socket to connect to an available USAP from a pool. The system server requests that the USAP is preconfigured for application use by changing the process's ID (PID), cgroup, and other information.\n 2. When the USAP is done preconfiguring, it replies to the system server with the PID.\n 3. When an application occupies one of these USAPs, the USAP is no longer part of the pool. When the pool reaches one or fewer USAPs in the pool, the Zygote replenishes the pool with new USAPs.\n - If your Zygote spawns processes using\n [lazy evaluation](https://en.wikipedia.org/wiki/Lazy_evaluation):\n\n 1. The system server receives a command that an app needs a process.\n 2. The system server uses a Unix domain socket to send a command to the appropriate Zygote.\n 3. The Zygote forks the process and changes the PID, cgroup, and other information.\n 4. When the process is complete, it sends the PID back to the Zygote which then passes it back to the system server.\n\nEnable USAP pool\n----------------\n\nTo enable the use of USAP pool, do one of the following:\n\n- Set the `dalvik.vm.usap_pool_enabled` system property to `true` in `/build/make/target/product/runtime_libart.mk`.\n\n- Run the following command:\n\n adb shell am broadcast -a \\\"com.google.android.gms.phenotype.FLAG_OVERRIDE\\\" --es package \\\"com.google.android.platform.runtime_native\\\" --es user \\\"\\*\\\" --esa flags \\\"usap_pool_enabled\\\" --esa values \\\"true\\\" --esa types \\\"string\\\" com.google.android.gms\n\nWhen this feature is enabled, each Zygote maintains a pool of forked processes\nthat perform the application-independent portions of the application startup\nprocess.\n\nTroubleshoot Zygote issues\n--------------------------\n\nThis section contains solutions to Zygote-related issues.\n\n### The Zygote is crashing\n\nIf your device doesn't reboot properly and your logs or crash reports show\nissues with the Zygote, it's likely because you made a recent change that\ncauses initd or the system server to crash. Fixing your code should fix\nthe problem.\n\n### SELinux denials or IO Failures\n\nThe Zygote is particular about file descriptor hygiene across process\nboundaries. When file descriptors are present at fork time but not in an\nallowlist, we use a `dup` system call to `/dev/null` to prevent cached file\ndescriptors from being used unintentionally to access newly opened files.\n\nIf you're making framework changes that include trying to load\nresources into the Zygote, and you're receiving SELinux denials or IO failures:\n\n- For unnamed file descriptors, include the file descriptors in the `fds_to_ignore` vector when `Restat` is called.\n\n- For named file descriptors:\n\n 1. Edit \u003cvar translate=\"no\"\u003eWORKING_DIRECTORY\u003c/var\u003e`/frameworks/base/core/jni/fd_utils.cpp`.\n 2. Add the path to the allowlist for open files."]]