Skip to content

Document TSI (Thread State Indicator) - Value 5 #49

@LSantha

Description

@LSantha

TSI (Thread State Indicator)

Document the TSI (Thread State Indicator) JNode concept in the wiki.

Value: 5

Concept Summary

Per-thread state tracking mechanism that records thread state changes atomically. TSI is a critical component of JNode's hybrid preemptive/cooperative thread scheduler, providing atomic state updates and thread management.

Key Files

  • core/src/core/org/jnode/vm/scheduler/TSI.java (lines 35-42: state constants, lines 60-70: atomic updates)
  • core/src/native/x86/kernel.asm (line 450: TSI manipulation)

Occurrences

~50 references in kernel.asm, Scheduler.java

Wiki Status

NOT documented

Bridges

Scheduler, Interrupt handling, VM internals

Instructions

Skill to Use

Use the [[update-wiki|update-wiki skill]] (load with skill({ name: "update-wiki" })) for understanding JNode internals.

Context Research

Research the thread scheduler in TSI.java and understand how atomic state updates work. Review kernel.asm for TSI manipulation patterns. Study how TSI integrates with interrupt handling and cooperative scheduling.

Update index.md

  • Pages table: Add entry for TSI.md
  • Concepts → Pages table: Add "TSI" mapping to [[TSI]]
  • Source Path → Pages table: Add mappings for core/src/core/org/jnode/vm/scheduler/TSI.java and core/src/native/x86/kernel.asm
  • Task Routing table: Add relevant task route(s)

Task Routing Suggestions

  1. Understanding thread scheduling: Read TSI.md before working on scheduler modifications
  2. Debugging thread issues: TSI state dumps are crucial for diagnosing thread problems
  3. Adding new thread state: Understand atomic update mechanisms before extending TSI

Wiki Page Structure

# TSI (Thread State Indicator)

> Per-thread state tracking mechanism that records thread state changes atomically.

## Overview
2-3 paragraph explanation of the TSI concept, its role in the hybrid scheduler, and how it enables atomic thread state management.

## Key Components
| Class / File | Role |
|---|---|
| `core/src/core/org/jnode/vm/scheduler/TSI.java` | Core TSI implementation with atomic state tracking |
| `core/src/native/x86/kernel.asm` | TSI manipulation in assembly code |

## How It Works
Step-by-step explanation of TSI's atomic state updates, thread state transitions, and integration with the scheduler.

## Gotchas & Non-Obvious Behavior
- TSI state changes must be atomic to prevent race conditions
- TSI manipulation in kernel.asm requires careful interrupt handling
- Thread state transitions follow specific patterns that must be respected

## Related Pages
- [[CoreThreadScheduling]]
- [[Yieldpoint]]
- [[ThreadScheduler]]

Related Concepts: CoreThreadScheduling, Yieldpoint, ThreadScheduler, Dispatcher

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions