









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










1
CSC 4103 - Operating Systems Spring 2007
Louisiana State University February 6th, 2007
Lecture - VI
2
3
4
while (true) /* produce an item and put in nextProduced while (count == BUFFER_SIZE) ; // do nothing buffer [in] = nextProduced; in = (in + 1) % BUFFER_SIZE; count++; }
7
8
A solution to the critical-section problem must satisfy the following requirements:
9
10
13
boolean TestAndSet (boolean *target) { boolean rv = *target; *target = TRUE; return rv: }
14
// critical section
lock = FALSE;
// remainder section
} while ( TRUE);
15
void Swap (boolean *a, boolean *b) { boolean temp = *a; *a = *b; *b = temp: }
16
19
20
21
22
25
26
do { wait (wrt) ;
// writing is performed
signal (wrt) ; } while (true)
27
28
31
32