Python Concurrency and Parallelism
Python Concurrency and Parallelism - Important Points
36. | What is the GIL in Python? |
---|
A. A global interpreter lock that ensures only one thread can execute Python bytecode at a time.
B. A threading mechanism that allows Python to execute multiple threads in parallel.
C. A module for managing concurrent I/O in Python.
D. A library for creating and managing parallel processes in Python.
View Answer Discuss Work SpaceAnswer: option a
Explanation:
37. | Which of the following is a way to overcome the limitations of the GIL in Python? |
---|
A. Using multiprocessing instead of threading
B. Using asyncio instead of threading
C. Using coroutines instead of threads
D. Using locks to manage access to shared resources
View Answer Discuss Work SpaceAnswer: option a
Explanation:
38. | What is the purpose of the Queue class in Python threading? |
---|
A. To provide a way to communicate between threads.
B. To prevent race conditions in multithreaded code.
C. To ensure only one thread can access a shared resource at a time.
D. To provide a way to limit the number of threads that can access a resource at a time.
View Answer Discuss Work SpaceAnswer: option a
Explanation:
39. | Which of the following is an example of a parallel processing framework in Python? |
---|
A. Dask
B. Flask
C. Django
D. Pyramid
View Answer Discuss Work SpaceAnswer: option a
Explanation:
40. | What is the purpose of the concurrent module in Python? |
---|
A. To provide a way to execute code concurrently using coroutines.
B. To provide a way to execute code concurrently using threads and processes.
C. To provide a way to manage and control concurrency in Python code.
D. To provide a way to create and manage threads and processes.
View Answer Discuss Work SpaceAnswer: option b
Explanation: