Unit 2 Lecture 32 - Synchronization Examples
Unit 2 Lecture 32 - Synchronization Examples
UE22CS242B
Synchronization Examples
Suresh Jamadagni
Department of Computer Science
OPERATING SYSTEMS
Slides Credits for all the PPTs of this course
Synchronization Examples
● Windows
● Linux
● Pthreads
● Solaris
Suresh Jamadagni
Department of Computer Science
OPERATING SYSTEMS
Windows Synchronization
● Linux:
● Prior to kernel Version 2.6, disables interrupts to implement
short critical sections
● Version 2.6 and later, fully preemptive
● Linux provides:
● Semaphores
● atomic integers
● spinlocks
● reader-writer versions of both
● On single-cpu system, spinlocks replaced by enabling and disabling
kernel preemption
OPERATING SYSTEMS
Linux Synchronization (Cont.)
▪ Atomic variables
atomic_t is the data type for atomic integer
▪ Consider the variables
atomic_t counter;
int value;
OPERATING SYSTEMS
Pthreads (POSIX) Synchronization
▪ Another process can access the semaphore by referring to its name SEM.
▪ Acquiring and releasing the semaphore:
OPERATING SYSTEMS
POSIX Unnamed Semaphores
Suresh Jamadagni
Department of Computer Science and Engineering
[email protected]