shared count := 0 shared multiplex main: upper_limit := read_integer() multiplex := semaphore(upper_limit) thread_count := read_integer() create_thread(secondary, thread_count) secondary: wait(multiplex) // Critical section count := count + 1 signal(multiplex)