GIL को disable करने की अनुमति

  • PYTHON_GIL=0 या -X gil=0 सेट करके GIL(Global Interpreter Lock) को disable किया जा सकता है.
  • GIL से संबंधित data structures initialize होते हैं, लेकिन GIL को disable करने पर take_gil() और drop_gil() जल्दी return हो जाते हैं.
  • GIL disabled स्थिति में कुछ tests और छोटे programs चलाकर देखे गए, और बुनियादी thread programs भी कभी-कभी काम करते हैं.
  • पूरा test suite चलाने पर test_asyncio में जल्दी crash हो जाता है.

GIL disable mechanism जोड़ा गया

  • GIL disable mechanism जोड़ने वाले issue (#116167) पर चर्चा हुई.
  • free-threaded build में GIL को disable करने की सुविधा जोड़ी गई.
  • GIL को फिर से enable करने वाले काम (#116322) और default रूप से GIL को disable करने वाले काम (#116329) को track किया गया.

कोड review और tests

  • code review request और test cases जोड़ने पर चर्चा हुई.
  • PYTHON_GIL environment variable के documentation और user feedback पाने के लिए सुझाव दिए गए.
  • -X gil option जोड़ना, उसे sys.flags में reflect करना, और environment variable को संभालने वाले tests में बदलाव शामिल हैं.

GN⁺ की राय

  • यह बदलाव Python community पर बड़ा प्रभाव डाल सकता है, क्योंकि GIL Python की multithreading performance को सीमित करने वाला एक जाना-पहचाना तत्व है.
  • GIL को disable करने की सुविधा performance improvements ला सकती है, लेकिन साथ ही stability और compatibility issues भी पैदा कर सकती है, इसलिए सावधानी से आगे बढ़ने की ज़रूरत है.
  • GIL के बिना Python चलाना, खासकर parallel processing से जुड़े कामों में, फ़ायदा दे सकता है, लेकिन मौजूदा बहुत-सा Python code GIL को मानकर लिखा गया है, इसलिए इस बदलाव के असर का आकलन करना महत्वपूर्ण है.
  • दूसरी languages या runtimes में अक्सर GIL जैसा mechanism इस्तेमाल नहीं होता; उदाहरण के लिए Node.js asynchronous I/O के जरिए single-thread performance को अधिकतम करने का तरीका अपनाता है.
  • इस तकनीक को अपनाते समय मौजूदा code की thread safety की समीक्षा करनी चाहिए और ज़रूरत पड़ने पर refactoring पर विचार करना चाहिए. GIL को disable करने से मिलने वाले performance benefits और stability के बीच संतुलन बनाए रखना महत्वपूर्ण है.

अभी कोई टिप्पणी नहीं है.

अभी कोई टिप्पणी नहीं है.