اعتبارًا من 27 آذار (مارس) 2025، ننصحك باستخدام android-latest-release
بدلاً من aosp-main
لإنشاء AOSP والمساهمة فيه. لمزيد من المعلومات، يُرجى الاطّلاع على التغييرات في AOSP.
لمحة عن عمليات Zygote
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
Zygote هي عملية في نظام التشغيل Android تعمل بمثابة الجذر
لجميع عمليات النظام والتطبيقات التي تستخدم واجهة ملف ثنائي التطبيق (ABI) نفسها.
على الأجهزة الحديثة، مثل هواتف Pixel 7 والإصدارات الأحدث، تتوفّر عملية Zygote بإصدار 64 بت.
بالإضافة إلى ذلك، هناك WebView Zygote لوحدة ABI الأساسية، وهو مكتبة
مخصّصة لـ Zygote
تحتوي على مكتبات وموارد خاصة بالعمليات التي تعمل على WebViews.
في ما يلي المهام التي ينفّذها عنصر Zygote:
ينشئ الخادم الدائم init عملية Zygote عند بدء تشغيل نظام التشغيل Android. في بعض أنظمة البنية المزدوجة، يتم إنشاء عمليتَي Zygote (بإصدارَي 64 بت
و32 بت). لا تتناول هذه الصفحة سوى أنظمة الهندسة المعمارية الفردية.
يمكن أن تنشئ عملية Zygote على الفور عمليات تُعرف باسم عمليات التطبيقات
غير المتخصّصة (USAP) أو تنتظر لإنشاء العمليات حسب الحاجة من التطبيقات.
يجب تفعيل الخيار السابق من خلال خاصيّة نظام أو أمر Android Debug Bridge. لمزيد من المعلومات عن ضبط Zygote لإنشاء
العمليات على الفور، يُرجى الاطّلاع على
تفعيل حزمة عمليات التطبيقات غير المتخصّصة .
تفعيل مجموعة USAP
لتفعيل استخدام مجموعة USAP، عليك تنفيذ أحد الإجراءات التالية:
عند تفعيل هذه الميزة، يحتفظ كلّ مثيل من Zygote بمجموعة من عمليات التفرّع التي تُنفِّذ الأجزاء غير المستندة إلى التطبيق من عملية بدء تشغيل التطبيق.
تحديد المشاكل وحلّها في Zygote
يحتوي هذا القسم على حلول للمشاكل المتعلّقة بتطبيق Zygote.
تعطُّل Zygote
إذا لم تتم إعادة تشغيل جهازك بشكل صحيح وظهرت في السجلات أو تقارير الأعطال
مشاكل في Zygote، من المحتمل أن يكون ذلك بسبب إجراء تغيير مؤخرًا يؤدي إلى
تعطُّل initd أو خادم النظام. من المفترض أن يؤدي إصلاح الرمز البرمجي إلى حلّ
المشكلة.
عمليات رفض SELinux أو أخطاء I/O
يهتمّ Zygote بنظافة ملف الوصف على مستوى حدود
العملية. عندما تكون أوصاف الملفات متوفّرة في وقت التفرع ولكنّها ليست في قائمة
السماح، نستخدم طلب نظام dup
إلى /dev/null
لمنع استخدام أوصاف
الملفات المخزّنة مؤقتًا عن غير قصد للوصول إلى الملفات التي تم فتحها حديثًا.
إذا كنت تُجري تغييرات على إطار العمل تشمل محاولة تحميل موارد في Zygote، وكنت تتلقّى رفضات SELinux أو أخطاء I/O:
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],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."]]