Unit5 - Subjective Questions

CSE325 • Practice Questions with Detailed Answers

1

Explain the concept of a thread within an Operating System and distinguish it from a process.

2

Describe the syntax and parameters of the pthread_create() function in the POSIX library.

3

Explain the significance of pthread_join() and pthread_exit() in thread management.

4

Define a Race Condition and provide a scenario where it might occur.

5

What is the Critical Section Problem? List the three conditions that a solution to the critical section problem must satisfy.

6

What is a Mutex Lock? Explain how it is used to solve the Critical Section problem using POSIX APIs.

7

Differentiate between Binary Semaphores and Counting Semaphores.

8

Mathematically define the wait() and signal() operations of a Semaphore .

9

Compare Mutexes and Semaphores. When would you choose one over the other?

10

Explain the solution to the Producer-Consumer Problem using Semaphores. Provide the pseudocode logic.

11

What are the arguments passed to sem_init() in the POSIX semaphore library?

12

Explain the concept of Deadlock in the context of Multithreading using Mutex locks.

13

How can you pass arguments to a thread function during creation? Provide a code snippet.

14

Discuss the difference between pthread_mutex_lock() and pthread_mutex_trylock().

15

What are Condition Variables in Pthreads, and why are they used with Mutexes?

16

What is Busy Waiting? How do Semaphores/Mutexes in modern OS avoid this?

17

Explain the Readers-Writers Problem and the challenges in solving it.

18

What is the function of pthread_self() and how is it useful?

19

Write a C program snippet to initialize a semaphore, wait on it, and then destroy it.

20

List the advantages of Multithreading over a single-threaded approach.