Index: libcfa/src/bits/locks.hfa
===================================================================
--- libcfa/src/bits/locks.hfa	(revision 1959528943f80644f53138c6bb1c3c33883c8ceb)
+++ libcfa/src/bits/locks.hfa	(revision 42daeb4e7403d43cd525897dd510b83f331ddae4)
@@ -31,4 +31,6 @@
 		// previous thread to acquire the lock
 		void* prev_thrd;
+		// keep track of number of times we had to spin, just in case the number is unexpectedly huge
+		size_t spin_count;
 	#endif
 };
@@ -48,4 +50,7 @@
 	static inline void ?{}( __spinlock_t & this ) {
 		this.lock = 0;
+		#ifdef __CFA_DEBUG__
+			this.spin_count = 0;
+		#endif
 	}
 
@@ -72,4 +77,7 @@
 		for ( unsigned int i = 1;; i += 1 ) {
 			if ( (this.lock == 0) && (__atomic_test_and_set( &this.lock, __ATOMIC_ACQUIRE ) == 0) ) break;
+			#ifdef __CFA_DEBUG__
+				this.spin_count++;
+			#endif
 			#ifndef NOEXPBACK
 				// exponential spin
Index: libcfa/src/concurrency/io.cfa
===================================================================
--- libcfa/src/concurrency/io.cfa	(revision 1959528943f80644f53138c6bb1c3c33883c8ceb)
+++ libcfa/src/concurrency/io.cfa	(revision 42daeb4e7403d43cd525897dd510b83f331ddae4)
@@ -548,4 +548,6 @@
 			/* paranoid */ verify( proc == __cfaabi_tls.this_processor );
 			/* paranoid */ verify( ! __preemption_enabled() );
+
+			return true;
 		}
 	#endif
Index: libcfa/src/concurrency/kernel.cfa
===================================================================
--- libcfa/src/concurrency/kernel.cfa	(revision 1959528943f80644f53138c6bb1c3c33883c8ceb)
+++ libcfa/src/concurrency/kernel.cfa	(revision 42daeb4e7403d43cd525897dd510b83f331ddae4)
@@ -554,5 +554,4 @@
 	/* paranoid */ verify( 0x0D15EA5E0D15EA5Ep == thrd->canary );
 
-	const bool local = thrd->state != Start;
 	if (thrd->preempted == __NO_PREEMPTION) thrd->state = Ready;
 
@@ -737,5 +736,9 @@
 
 	// Check if there is a sleeping processor
-	int fd = __atomic_load_n(&this->procs.fd, __ATOMIC_SEQ_CST);
+	// int fd = __atomic_load_n(&this->procs.fd, __ATOMIC_SEQ_CST);
+	int fd = 0;
+	if( __atomic_load_n(&this->procs.fd, __ATOMIC_SEQ_CST) != 0 ) {
+		fd = __atomic_exchange_n(&this->procs.fd, 0, __ATOMIC_RELAXED);
+	}
 
 	// If no one is sleeping, we are done
Index: libcfa/src/concurrency/ready_queue.cfa
===================================================================
--- libcfa/src/concurrency/ready_queue.cfa	(revision 1959528943f80644f53138c6bb1c3c33883c8ceb)
+++ libcfa/src/concurrency/ready_queue.cfa	(revision 42daeb4e7403d43cd525897dd510b83f331ddae4)
@@ -681,5 +681,7 @@
 	// Actually pop the list
 	struct thread$ * thrd;
-	unsigned long long tsc_before = ts(lane);
+	#if defined(USE_WORK_STEALING) || defined(USE_CPU_WORK_STEALING)
+		unsigned long long tsc_before = ts(lane);
+	#endif
 	unsigned long long tsv;
 	[thrd, tsv] = pop(lane);
Index: libcfa/src/concurrency/thread.cfa
===================================================================
--- libcfa/src/concurrency/thread.cfa	(revision 1959528943f80644f53138c6bb1c3c33883c8ceb)
+++ libcfa/src/concurrency/thread.cfa	(revision 42daeb4e7403d43cd525897dd510b83f331ddae4)
@@ -10,6 +10,6 @@
 // Created On       : Tue Jan 17 12:27:26 2017
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Jan 12 18:28:18 2022
-// Update Count     : 35
+// Last Modified On : Wed Jan 12 18:46:48 2022
+// Update Count     : 36
 //
 
@@ -197,5 +197,8 @@
 } // LCG
 
-void set_seed( uint32_t seed ) { active_thread()->random_state = seed; __global_random_seed = seed; }
+void set_seed( uint32_t seed ) {
+ 	active_thread()->random_state = __global_random_seed = seed;
+	GENERATOR( active_thread()->random_state );
+} // set_seed
 uint32_t prng( void ) { return GENERATOR( active_thread()->random_state ); } // [0,UINT_MAX]
 
Index: libcfa/src/device/cpu.cfa
===================================================================
--- libcfa/src/device/cpu.cfa	(revision 1959528943f80644f53138c6bb1c3c33883c8ceb)
+++ libcfa/src/device/cpu.cfa	(revision 42daeb4e7403d43cd525897dd510b83f331ddae4)
@@ -427,10 +427,9 @@
 			unsigned c = pairings[i].cpu;
 			unsigned llc_id = pairings[i].id;
-			unsigned width = maps[llc_id].raw->width;
 			unsigned start = maps[llc_id].start;
-			unsigned self  = start + (maps[llc_id].count++);
-			entries[c].count = width;
+			entries[c].count = maps[llc_id].raw->width;
 			entries[c].start = start;
-			entries[c].self  = self;
+			entries[c].self  = start + (maps[llc_id].count++);
+			entries[c].cache = llc_id;
 		}
 
Index: libcfa/src/device/cpu.hfa
===================================================================
--- libcfa/src/device/cpu.hfa	(revision 1959528943f80644f53138c6bb1c3c33883c8ceb)
+++ libcfa/src/device/cpu.hfa	(revision 42daeb4e7403d43cd525897dd510b83f331ddae4)
@@ -16,8 +16,19 @@
 #include <stddef.h>
 
+// Map from cpu entry to a structure detailling cpus with common topologies
+// Note that the cpu-groups are contiguous so the indexing is different from
+// the cpu indexing
 struct cpu_map_entry_t {
+	// Where this particular cpu is in the group
 	unsigned self;
+
+	// Starting index of the cpus with the same topology
 	unsigned start;
+
+	// Number of cpus with the same topology
 	unsigned count;
+
+	// Index of the cache this entry describes
+	unsigned cache;
 };
 
Index: libcfa/src/startup.cfa
===================================================================
--- libcfa/src/startup.cfa	(revision 1959528943f80644f53138c6bb1c3c33883c8ceb)
+++ libcfa/src/startup.cfa	(revision 42daeb4e7403d43cd525897dd510b83f331ddae4)
@@ -10,6 +10,6 @@
 // Created On       : Tue Jul 24 16:21:57 2018
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Jan 12 16:25:37 2022
-// Update Count     : 49
+// Last Modified On : Wed Jan 12 18:51:24 2022
+// Update Count     : 51
 //
 
@@ -20,5 +20,5 @@
 #include "bits/defs.hfa"
 
-extern uint32_t __global_random_seed;
+extern uint32_t __global_random_seed, __global_random_state;
 
 extern "C" {
@@ -51,5 +51,5 @@
 	void __cfaabi_core_startup( void ) __attribute__(( constructor( STARTUP_PRIORITY_CORE ) ));
 	void __cfaabi_core_startup( void ) {
-		__global_random_seed = rdtscl();
+		__global_random_state = __global_random_seed = rdtscl();
 		__cfaabi_interpose_startup();
 		__cfaabi_device_startup();
Index: libcfa/src/stdlib.cfa
===================================================================
--- libcfa/src/stdlib.cfa	(revision 1959528943f80644f53138c6bb1c3c33883c8ceb)
+++ libcfa/src/stdlib.cfa	(revision 42daeb4e7403d43cd525897dd510b83f331ddae4)
@@ -10,6 +10,6 @@
 // Created On       : Thu Jan 28 17:10:29 2016
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Jan 12 16:25:36 2022
-// Update Count     : 578
+// Last Modified On : Wed Jan 12 18:52:41 2022
+// Update Count     : 582
 //
 
@@ -242,15 +242,13 @@
 } // LCG
 
-uint32_t __global_random_seed;
+uint32_t __global_random_seed;							// sequential/concurrent
+uint32_t __global_random_state;							// sequential only
 
 void set_seed( PRNG & prng, uint32_t seed_ ) with( prng ) { state = seed = seed_; GENERATOR( state ); } // set seed
 uint32_t prng( PRNG & prng ) with( prng ) { callcnt += 1; return GENERATOR( state ); }
 
-void set_seed( uint32_t seed ) {
-	active_thread()->random_state = __global_random_seed = seed;
-	GENERATOR( active_thread()->random_state );
-} // set_seed
+void set_seed( uint32_t seed ) { __global_random_seed = seed; GENERATOR( __global_random_state ); }
 uint32_t get_seed() { return __global_random_seed; }
-uint32_t prng( void ) { return GENERATOR( active_thread()->random_state ); } // [0,UINT_MAX]
+uint32_t prng( void ) { return GENERATOR( __global_random_state ); } // [0,UINT_MAX]
 
 //---------------------------------------
Index: libcfa/src/stdlib.hfa
===================================================================
--- libcfa/src/stdlib.hfa	(revision 1959528943f80644f53138c6bb1c3c33883c8ceb)
+++ libcfa/src/stdlib.hfa	(revision 42daeb4e7403d43cd525897dd510b83f331ddae4)
@@ -10,6 +10,6 @@
 // Created On       : Thu Jan 28 17:12:35 2016
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Jan 12 09:09:48 2022
-// Update Count     : 620
+// Last Modified On : Wed Jan 12 18:56:13 2022
+// Update Count     : 621
 //
 
@@ -437,5 +437,5 @@
 
 void set_seed( uint32_t seed_ ) OPTIONAL_THREAD;
-uint32_t get_seed() __attribute__(( warn_unused_result )) OPTIONAL_THREAD;
+uint32_t get_seed() __attribute__(( warn_unused_result ));
 uint32_t prng( void ) __attribute__(( warn_unused_result )) OPTIONAL_THREAD; // [0,UINT_MAX]
 static inline {
