📞Kernel Threads
Threading at its best!
Threads are a great way to asynchronously do things in your mod! They play a huge role on preventing the block from happening on the main thread. Single-threaded aplications usually get blocked by long operations, but threads solve this problem.
Nitrocid KS manages the threads that are created by the KernelThread instances. It allows the kernel to manipulate with these threads more efficiently, and they stop each time the kernel is requested to shut down or restart by any power management functions, either locally or br remotely by RPC.
ThreadManager provides you a whole set of functions and properties to efficiently manage your threads from listing all active threads to sleeping to benchmarking the sleep function.
How to make your thread
To make your KernelThread, just call its constructor with the following parameters:
ThreadNameThread name
BackgroundWhether the thread is a background thread
ExecutorA function to execute in the thread
It can be either of the type
ThreadStartor of the typeParameterizedThreadStart
You can then start the thread using the Start() function for normal threads or the Start(object) function for parameterized threads.
You can't start the kernel thread once it's stopped by Stop(false) until it's regenerated either automatically by Stop() or manually by Regen(), and you can't call Regen() before calling the Stop(false) function.
Task manager
The task manager can be called by taskman in the normal shell. It allows you to list both the Nitrocid KS threads and the unmanaged operating system threads, and it provides you with their information.
The left pane of the task manager shows you a list of threads, and the right pane shows you the selected thread info.
Controls
F1Kills a Nitrocid KS thread and regenerates it
This can't be used on unmanaged OS threads
TabSwitches between the Nitrocid KS thread listing and the unmanaged OS thread listing
ESCExits the program
Thread information
The selected thread information can be found on the right pane of your task manager. However, depending on the type of the thread you're currently at, it might show different information.
Nitrocid KS threads
The below information are shown:
Task nameThe kernel thread name
AliveWhether the kernel thread is running or not
BackgroundWhether the kernel thread is running in the background or not
CriticalThreads that are crucial to the kernel is usually set to
Trueand thus can't be killed
ReadyWhether the thread is ready to be started or not
Unmanaged OS threads
The below information are shown:
Task IDUnmanaged OS thread number assigned by the operating system
Privileged processor timeAmount of work a processor is completing while executing in privileged mode
User processor timeAmount of work a processor is completing while executing in user space
Total processor timeTotal amount of work a processor is completing
Task stateThe thread state holding one of the ThreadState values
Priority levelThe unmanaged thread priority level
Task memory addressA hexadecimal representation of the memory address for an unmanaged thread assigned by the operating system that points to the thread entry point (start) in this format:
0x00000000
Last updated