gdb showing only 1 thread

I see that i threads only show 1 thread, while running threadtest.

Is this thread of the sys161 ? This does not represent the thread_fork.
Also, it seems that it uses single thread to give deterministic execution in case of explicit seednum in sys161.conf file.

(gdb) i threads

Id Target Id Frame

  • 1 Thread 10 (CPU 0) thread_switch (newstate=newstate@entry=S_SLEEP, wc=wc@entry=0x8002fbe0, lk=lk@entry=0x8002fc08) at …/…/thread/thread.c:662

(gdb) bt

#0 thread_switch (newstate=newstate@entry=S_SLEEP, wc=wc@entry=0x8002fbe0, lk=lk@entry=0x8002fc08) at …/…/thread/thread.c:662

#1 0x8001a310 in wchan_sleep (wc=0x8002fbe0, lk=lk@entry=0x8002fc08) at …/…/thread/thread.c:1044

#2 0x80019208 in P (sem=0x8002fc00) at …/…/thread/synch.c:116

#3 0x80017ff0 in runthreads (doloud=doloud@entry=1) at …/…/test/threadtest.c:115

#4 0x80018108 in threadtest (nargs=nargs@entry=1, args=args@entry=0x8002eef0) at …/…/test/threadtest.c:128

#5 0x8000d4ac in cmd_dispatch (cmd=cmd@entry=0x8002ef88 "tt1") at …/…/main/menu.c:845

#6 0x8000d5a4 in menu_execute (line=line@entry=0x8002ef88 "tt1", isargs=isargs@entry=0) at …/…/main/menu.c:885

#7 0x8000ddb4 in menu (args=args@entry=0x8002d1c0 "") at …/…/main/menu.c:926

#8 0x8000d190 in kmain (arguments=0x8002d1c0 "") at …/…/main/main.c:215

#9 0x80021d4c in __start () at …/…/arch/sys161/main/start.S:216

(gdb)

I found that number of threads in gdb is == no of cpus in sys161.conf.
When i use cpus=2, i see 2 threads.

(gdb) i threads
Id Target Id Frame

  • 2 Thread 11 (CPU 1) thread_exit () at …/…/thread/thread.c:805
    1 Thread 10 (CPU 0) 0x80018e18 in spinlock_release (splk=0x80032fa4) at …/…/thread/spinlock.c:139