SchOS/kernel/dev
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
..
audio.c include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00
bio.c include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00
blkdev.c include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00
cdev.c Pseudo-terminals, and what tmux and htop needed around them 2026-10-25 02:11:10 +01:00
dbg.c include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00
device.c include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00
disk.c include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00
dmi.c boot: driver chatter goes to the log; the console clears its margins 2026-10-25 01:53:46 +02:00
fb.c X on the console: /dev/tty0, a palette, and startx that works 2026-10-24 19:44:10 +02:00
gfx.c display: confirm a resolution change, and size the console font to the screen 2026-10-24 23:11:22 +02:00
ide.c include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00
input.c kernel: HTTPS through wget, half-close, and /proc/<pid>/fd 2026-10-24 20:28:03 +02:00
irq.c irq: turn a PS/2 line over when its device waits and nothing comes 2026-10-24 11:10:29 +02:00
kbd.c X gets a VT: keyboard, terminal switching, and a way out 2026-10-24 21:45:50 +02:00
keymap.c Job control, function keys, and real sleeps 2026-10-25 02:37:45 +01:00
mouse.c irq: turn a PS/2 line over when its device waits and nothing comes 2026-10-24 11:10:29 +02:00
netuser.c include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00
pci.c include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00
pciuser.c Threads 2026-10-25 03:03:50 +01:00
procfs.c Pseudo-terminals, and what tmux and htop needed around them 2026-10-25 02:11:10 +01:00
pty.c Job control, function keys, and real sleeps 2026-10-25 02:37:45 +01:00
ramdisk.c boot: driver chatter goes to the log; the console clears its margins 2026-10-25 01:53:46 +02:00
text.c include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00
ttf.c include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00
uart.c include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00
vt.c Pseudo-terminals, and what tmux and htop needed around them 2026-10-25 02:11:10 +01:00