Q: 1 The most common technique used for protecting a critical section in Linux is:
Critical lock protocol
Spinlock
Critical Spinning
Mutex interlocking
[ Option B ]
In Linux, a critical section is a part of the code that accesses shared resources, such as variables, files, or hardware, that must not be used by more than one process or thread at a time. To prevent data corruption or race conditions, Linux uses synchronization mechanisms to protect these critical sections. The most common technique used in the Linux kernel for this purpose is the spinlock.
A spinlock is a lightweight lock used in Linux to protect a critical section. It makes a process “spin” in a loop until it can enter the section, ensuring that only one process accesses the shared resource at a time without using heavy context switching.
Q: 2 Which type of semaphore can be used to provide mutual exclusion when mutex locks are not available?
Counting semaphore
Binary semaphore
Timed semaphore
Spinlock
[ Option B ]
Semaphore is a synchronization tool used to control access to shared resources in concurrent systems. There are two types of semaphores:
Mutex locks are specialized locks for mutual exclusion, but if they are not available, a binary semaphore can perform the same function.
Q: 3 A counting semaphore was initialized to 8. Then 12 P (wait) operations and 7 V (signal) operations were completed on this semaphore. The resulting value of semaphore is—
4
3
5
1
[ Option C ]
Thank you so much for taking the time to read my Computer Science MCQs section carefully. Your support and interest mean a lot, and I truly appreciate you being part of this journey. Stay connected for more insights and updates! If you'd like to explore more tutorials and insights, check out my YouTube channel.
Don’t forget to subscribe and stay connected for future updates.