SchOS/kernel/core
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Nexoniarz f4d7f9100d Threads
A thread is a struct proc that shares three counted objects with others of
its group: the address space (struct mm: page tables, heap top, VMAs and a
lock for changing them), the descriptor table, and the signal dispositions.
clone() shares what its flags say and fork() copies.

- clone(): pthread_create's shape (VM, FILES, SIGHAND, THREAD, SETTLS,
  PARENT_SETTID, CHILD_CLEARTID) and posix_spawn's (VM, VFORK, a stack).
- futex: WAIT, WAIT_BITSET with timeouts, WAKE, REQUEUE, CMP_REQUEUE, keyed
  by the word's kernel address so shared pages meet. set_tid_address keeps
  the word that exit zeroes and wakes, for pthread_join.
- exit ends a thread; exit_group, a fatal signal, or the leader exiting ends
  them all. reapd frees exited threads; the leader is reaped by its parent
  once the rest are gone. getpid is the group, gettid the thread.
- Stops and resumes reach every thread; other process signals the leader.
- exec kills the other threads and unshares the dispositions.
- No TLB shootdown, so pages unmapped from a shared address space are freed
  only once every CPU has reloaded CR3 or is idle.
- procfs: /proc lists processes, task/ lists threads, comm, Threads:, Tgid.
- The console honours VMIN 0 / VTIME (btop's input drain hung on it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
2026-10-25 03:03:50 +01:00
..
console.c Threads 2026-10-25 03:03:50 +01:00
dma.c include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00
kalloc.c include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00
klog.c GMMOS: the Guru Meditation Micro OS, alive under the PSOGM 2026-10-25 01:11:04 +02:00
kmem.c include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00
ksym.c include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00
main.c Threads 2026-10-25 03:03:50 +01:00
panic.c GMMOS: the Guru Meditation Micro OS, alive under the PSOGM 2026-10-25 01:11:04 +02:00
qr.c qr: every version, 1 to 40 2026-10-25 00:43:36 +02:00
sbuf.c include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00
sleeplock.c include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00
spinlock.c include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00
string.c include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00
time.c include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00
uaccess.c include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00