Welcome to

w3study.github.io




Topics

Introduction to Threads

Features of Threads

Types of Threads



Introduction to Threads in Hindi, Features of Threads in Hindi


Introduction to Threads

Features of Threads

  1. Multi-threading Support – Android में multiple threads को एक साथ run किया जा सकता है, जिससे application fast और responsive बनी रहती है।
  2. Main (UI) Thread Handling – UI-related tasks केवल main thread (UI thread) पर ही execute होते हैं, जिससे application crash या freeze होने से बचती है।
  3. Background Processing – Network operations, database queries, और अन्य heavy tasks को background threads पर execute किया जा सकता है, जिससे UI thread block नहीं होता।
  4. Thread Synchronization – Multiple threads को synchronize करने के लिए synchronized blocks, Locks, और Executors जैसी techniques दी गई हैं, जिससे data corruption और race conditions को रोका जा सकता है।
  5. Message Queue & Looper – Looper और Message Queue का उपयोग करके threads के बीच communication किया जा सकता है, जिससे long-running operations को efficiently manage किया जा सकता है।
  6. Handler Mechanism – Handlers का उपयोग background threads से main thread को update करने के लिए किया जाता है, जिससे UI elements को modify किया जा सके।
  7. AsyncTask (Deprecated) – Background tasks को manage करने के लिए एक simplified API थी, लेकिन अब इसे deprecated कर दिया गया है और इसकी जगह Coroutines और WorkManager को recommend किया जाता है।
  8. Kotlin Coroutines Support – Modern Android development में Coroutines का उपयोग किया जाता है, जिससे lightweight और efficient background processing संभव होती है।
  9. WorkManager for Scheduled Tasks – अगर कोई task periodic या scheduled तरीके से चलाना हो, तो WorkManager का उपयोग किया जाता है, जो battery optimization को भी ध्यान में रखता है।
  10. Thread Priority Management – Android में threads को high, normal, या low priority दी जा सकती है, जिससे critical tasks को पहले execute करने की flexibility मिलती है।

Types of Threads

  1. Main Thread (UI Thread) – यह Android application का primary thread होता है, जो UI rendering, user interactions और event handling को manage करता है। यदि इस पर heavy task execute किया जाए, तो ANR (Application Not Responding) error आ सकता है।
  2. Worker Thread (Background Thread) – यह ऐसे tasks के लिए उपयोग होता है जो UI के साथ directly interact नहीं करते, जैसे network requests, database operations, और file handling। इसे Thread, Runnable, या Executors के माध्यम से बनाया जाता है।
  3. Handler Thread – यह Looper के साथ काम करता है और background thread पर running tasks को schedule और manage करने की सुविधा देता है। इसे तब उपयोग किया जाता है जब background thread को continuously tasks handle करने होते हैं।
  4. AsyncTask (Deprecated) – यह पहले background operations को manage करने के लिए उपयोग होता था, लेकिन अब इसे Kotlin Coroutines और WorkManager से replace कर दिया गया है क्योंकि यह memory leaks और inefficient threading issues create कर सकता था।
  5. Intent Service (Deprecated) – यह background में long-running tasks को execute करने के लिए उपयोग होता था, लेकिन अब इसे WorkManager से replace किया गया है।
  6. Executors – यह एक advanced threading framework है जो thread pools को manage करता है और CachedThreadPool, FixedThreadPool, SingleThreadExecutor जैसी विभिन्न strategies provide करता है।
  7. Looper & Handler Threads – Looper एक message queue maintain करता है, और Handler उस queue में tasks को schedule करके execute करता है। यह background से UI thread को update करने के लिए उपयोग किया जाता है।
  8. Kotlin Coroutines – यह modern threading approach है जो lightweight और efficient concurrency provide करता है। यह suspend functions और async-await जैसे features का उपयोग करके background tasks को handle करता है।
  9. WorkManager – यह recommended approach है background tasks को efficiently execute करने के लिए, खासकर जब tasks को device restart या app close होने के बाद भी चलाना हो।
  10. JobScheduler – यह Android के system-managed background jobs को schedule करता है, जिससे tasks को optimize तरीके से execute किया जा सके, जैसे network availability या charging condition को देखते हुए।

  • Threads Running on UI Threads in Hindi
  • Development of Android Applications Notes in Hindi


  • Request:

    हैलो दोस्तों! उम्मीद करता हूं आपको हमारा यह content/post पसंद आया होगा। अगर आपको हमारा ये content/post पसंद आई हो तो अपने दोस्तों के पास भी share करे। और अगर आपको कोई problem या कोई specific content हिन्दी में चाहिए है तो आप हमें नीचे दिए गए Email या whatsapp number के जरिए बता सकते है।

    अगर आप CCC/diploma/polytechnic/MCA/BCA etc कर रहे है तो ये website स्पेशली आपके लिए ही है, जो student हिंदी में पढ़ाई करते है।

    Contact Us

    Email: deepanshuranjan8057@gmail.com

    Whatsapp: +91 8057754706



    Follow Us

    Facebook Logo    Instagram Logo