Operating System » Semaphores 2
Operating System Subcategories
Memory Management Swapping 1Process Scheduling Queue
Virtual Memory Page Replacement Algorithms 1Linux
Cpu SchedulingMemory Management
Computer FundamentalsCpu Scheduling Benefits
Threads Signal HandlingThreads Ult Klt
Distributed Operating SystemBasics
Operating SystemProcesses
Cpu Scheduling Algorithms 1Cpu Scheduling Algorithms 2
DeadlockDeadlock Avoidance
Memory Management Swapping 2Memory Allocation 1
Secondary StorageMemory Management Paging 1
Memory Management Paging 2Rtos
Multimedia System Cpu Disk SchedulingSecurity Intrusion Detection
Virtual Memory ThrashingFile System Interface Access Methods 1
File System Interface Directory Structure 1File System Interface Directory Structure 2
File System Interface Mounting SharingFile System Allocation Methods 1
Disk Scheduling 2Disk Management
Classic Sync ProblemsSemaphores 1
Process CreationMultimedia System Network Management
Semaphores 2Cpu Scheduling 2
Application Io Interface 1Inter Process Communication
Process SynchronizationMultimedia System Compression 1
Network File System 1Disk Scheduling 1
Mass Storage Raid 1File System 1
Communication Systems Bandwidth Transmission MediumSecurity Cryptography
Two Port NetworkProcess Rpc
Virtual Memory Page Replacement Algorithms 2Virtual Memory Frame Allocation
Network File System 2File System Allocation Methods 2
File System Allocation Methods 3Process Control Block
Process StructuresCritical Section Problem
Process Sync MonitorsAtomic Transactions
Deadlock RecoveryMemory Allocation 2
Memory Management SegmentationApplication Io Interface 2
Kernel Io SubsystemsMultimedia System Compression 2
Multimedia System Compression 3Security User Authentication
Security Program System ThreatsSecurity System Facility
Threads Fork ExecThreads Cancellation
Threads PoolsMulti Threading Models
Virtual Memory Demand PagingVirtual Memory
File System ConceptsFile System Implementation
File System Interface Access Methods 2File System Recovery
Io SubsystemSwap Space Management
Mass Storage Raid 2Mass Storage Tertiary Storage
Protection ConceptsProtection Access Matrix
SecurityProtection Memory Protection
Protection Revocation Access RightsNetwork Structure Topology
RobustnessDistributed File System
Distributed SynchronizationDeadlock Prevention
Deadlock DetectionThreads
File System Interface ProtectionFile System Free Space Performance
What will happen if a non-recursive mutex is locked more than once?

A. Starvation
B. Deadlock
C. Aging
D. Signaling

Explanation: If a thread which had already locked a mutex, tries to lock the mutex again, it will enter into the waiting list of that mutex, which results in a deadlock. It is because no other thread can unlock the mutex.

What is a semaphore?

A. Is a binary mutex
B. Must be accessed from only one process
C. Can be accessed from multiple processes
D. None of the mentioned

What are the two kinds of semaphores?

A. Mutex & counting
B. Binary & counting
C. Counting & decimal
D. Decimal & binary

What is a mutex?

A. Is a binary mutex
B. Must be accessed from only one process
C. Can be accessed from multiple processes
D. None of the mentioned

Explanation: میوٹیکس (Mutex) کیا ہے؟ میوٹیکس (جس کا پورا نام Mutual Exclusion ہے) آپریٹنگ سسٹم میں ایک ایسا تالا (Lock) ہے جو یہ یقینی بناتا ہے کہ کمپیوٹر کا کوئی بھی خاص حصہ یا ڈیٹا (Shared Resource) ایک وقت میں صرف ایک ہی پروگرام یا تھریڈ (Thread) استعمال کرے۔

At a particular time of computation the value of a counting semaphore is 7.Then 20 P operations and 15 V operations were completed on this semaphore. The resulting value of the semaphore is? (GATE 1987)

A. 42
B. 2
C. 7
D. 12

Explanation: P represents Wait and V represents Signal. P operation will decrease the value by 1 every time and V operation will increase the value by 1 every time. In semaphore operations:P Operation (Wait/Down): Decrements the value of the semaphore ($S = S - 1$).V Operation (Signal/Up): Increments the value of the semaphore ($S = S + 1$).Step-by-step:Initial Value: $7$After 20 P operations: $7 - 20 = -13$After 15 V operations: $-13 + 15 = 2$

The program follows to use a shared binary semaphore T. Process A int Y; A1: Y = X*2; A2: X = Y; signal(T); Process B int Z; B1: wait(T); B2: Z = X+1; X = Z; T is set to 0 before either process begins execution and, as before, X is set to 5. Now, how many different values of X are possible after both processes finish executing?

A. One
B. Two
C. Three
D. Four

Explanation: The semaphore T ensures that all the statements from A finish execution before B begins. So now there is only one way in which statements from A and B can be interleaved: A1 A2 B1 B2: X = 11.

Semaphores are mostly used to implement ____________

A. System calls
B. Ipc mechanisms
C. System protection
D. None of the mentioned

Spinlocks are intended to provide __________ only.

A. Mutual exclusion
B. Bounded waiting
C. Aging
D. Progress

Explanation: A spinlock is a mutual exclusion mechanism that uses busy-waiting (looping) instead of sleeping, making it ideal for very short critical sections in multi-core systems.