sync/{sem_mutex_symmetric/sem_mutex.alg.c → multiplex/multiplex.alg.c} RENAMED
@@ -1,12 +1,15 @@
1
  shared count := 0
2
- shared mutex := semaphore(1)
3
 
4
  main:
 
 
 
5
  thread_count := read_integer()
6
  create_thread(secondary, thread_count)
7
 
8
  secondary:
9
- wait(mutex)
10
  // Critical section
11
  count := count + 1
12
- signal(mutex)
1
  shared count := 0
2
+ shared multiplex
3
 
4
  main:
5
+ upper_limit := read_integer()
6
+ multiplex := semaphore(upper_limit)
7
+
8
  thread_count := read_integer()
9
  create_thread(secondary, thread_count)
10
 
11
  secondary:
12
+ wait(multiplex)
13
  // Critical section
14
  count := count + 1
15
+ signal(multiplex)