Threads and Multithreading - multicore programming, multithreading models, thread libraries, implicit threading, threading issues - Question Bank
1. Consider a scenario where Thread A holds Resource 1 and needs Resource 2, while Thread B holds Resource 2 and needs Resource 1. This is a classic example of:
2. What is the primary difference between a thread and a process?
3. Which of the following is a key component of the OpenMP API for implicit threading in C/C++?
4. What is a potential problem with fine-grained locking (using many locks for small sections of data)?
5. Which synchronization primitive is suitable for managing access to a resource that can be used by a limited number of threads concurrently (e.g., a connection pool)?
6. In multicore programming, what is 'granularity' referring to?
7. Which threading issue involves threads repeatedly making progress but failing to reach a final goal due to continuous changes in the system state?
8. What is the role of the 'scheduler' in a user-level threading implementation (like the many-to-one model)?
9. Which model offers a good balance between the overhead of the many-to-one model and the potential resource consumption of the one-to-one model?
10. What is the main limitation of the many-to-one threading model concerning parallelism?
11. Which of the following is a common synchronization problem that can occur if not managed carefully?
12. What is a 'detached thread' in multithreading?
13. In multicore programming, what does 'load balancing' refer to?
14. Which of the following best describes a 'task' in task-based parallelism (often used in implicit threading)?
15. What is the purpose of `pthread_join()` in POSIX threads?
16. Which threading issue is characterized by a process not making progress because it is waiting for a resource held by another process that is also waiting?
17. What is a potential issue with using a large number of kernel threads in the one-to-one model?
18. Which threading model is used by default in Java?
19. In the context of POSIX Threads (pthreads), what is a common function for creating a new thread?
20. What is a 'spin lock'?
21. Which of the following is a mechanism to prevent race conditions?
22. What is a primary goal of multicore programming?
23. Which type of threading abstracts thread creation and management away from the programmer, often using libraries or language features?
24. The many-to-many model attempts to combine the benefits of which other models?
25. What is the main benefit of the one-to-one multithreading model?
26. Which of the following is a disadvantage of the many-to-one multithreading model?
27. What is a 'critical section' in multithreading?
28. Which scenario is most likely to lead to a deadlock?
29. In multicore programming, the challenge of ensuring that multiple threads operate on shared data without corrupting it is known as:
30. What is the primary purpose of a thread pool?
31. Which programming paradigm is often associated with implicit threading, simplifying concurrent programming?
32. What is starvation in multithreading?
33. Which of the following is an example of a common threading issue related to resource contention?
34. What is thread-local storage (TLS)?
35. Which type of threading allows a large number of user threads to be mapped onto a smaller or equal number of kernel threads?
36. Which of the following is a benefit of the one-to-one multithreading model?
37. In the many-to-one multithreading model, what happens if one user thread performs a blocking system call?
38. What is the purpose of a condition variable?
39. A semaphore initialized to 1 can function similarly to which other synchronization primitive?
40. Which synchronization primitive is often used to ensure that only one thread can access a critical section of code at a time?
41. What is a deadlock in the context of multithreading?
42. Which threading issue arises when multiple threads access and modify shared data concurrently, leading to unpredictable results?
43. What is a common technique used in implicit threading to manage threads?
44. Which of the following is a characteristic of implicit threading?
45. What is the primary function of a thread library?
46. Which thread library operates entirely in user space and does not require kernel support for thread management?
47. In the one-to-one multithreading model, what is a potential drawback?
48. Which multithreading model maps many user-level threads to one or more kernel-level threads?
49. In the context of multicore programming, what is a common challenge faced by developers?
50. Which of the following best describes a thread?