+unsigned int global_count = 0;
+
+/*
+ * Proc scheduling test subthread 1
+ */
+static void proc_test1(void)
+{
+ unsigned int local_count = 0;
+
+ for (int i = 0; i < INC_PROC_T1; ++i)
+ {
+ kputs("> test1\n");
+ sem_obtain(&sem);
+ kputs("> test1: Obtain semaphore.\n");
+ local_count = global_count;
+ kprintf("> test1: Read global count [%d]\n", local_count);
+ timer_delay(DELAY_PROC_T1);
+ local_count += INC_PROC_T1;
+ global_count = local_count;
+ kprintf("> test1: Update count g[%d] l[%d]\n", global_count, local_count);
+ sem_release(&sem);
+ kputs("> test1: Relase semaphore.\n");
+ }
+}
+
+/*
+ * Proc scheduling test subthread 2
+ */
+static void proc_test2(void)
+{
+ unsigned int local_count = 0;
+
+ for (int i = 0; i < INC_PROC_T2; ++i)
+ {
+ kputs("> test2\n");
+ sem_obtain(&sem);
+ kputs("> test2: Obtain semaphore.\n");
+ local_count = global_count;
+ kprintf("> test2: Read global count [%d]\n", local_count);
+ timer_delay(DELAY_PROC_T2);
+ local_count += INC_PROC_T2;
+ global_count = local_count;
+ kprintf("> test2: Update count g[%d] l[%d]\n", global_count, local_count);
+ sem_release(&sem);
+ kputs("> test2: Relase semaphore.\n");
+ }
+}
+
+// Define process stacks for test.
+static cpu_stack_t proc_test1_stack[CONFIG_KERN_MINSTACKSIZE / sizeof(cpu_stack_t)];
+static cpu_stack_t proc_test2_stack[CONFIG_KERN_MINSTACKSIZE / sizeof(cpu_stack_t)];
+