Lightweight Process Data

Kernel Level Data Structures

Overview

  • Kernel level data structures maintain vital information about processes and their execution contexts.

Process Information

  • Each process has specific data that is tracked, which includes the following:

    • Kernel Level Threads:

    • Information about all kernel level threads executing within the process's address space.

    • Mappings between virtual and physical memory.

    • User Credentials:

    • Validation of the user’s access to specific files. The operating system needs to ensure that the user attempting to access a file has the appropriate rights.

    • Signal Handlers:

    • Responses defined for various operating system events impacting the process, which will be elaborated upon later.

Lightweight Process Data Structure

  • Contains information pertinent to subsets of the process, particularly related to the user level threads.

    • User Level Thread Information:

    • Maintains data about user level registers and the system call arguments for one or more executing user level threads.

    • Visibility to Kernel:

    • The information is accessible to kernel to facilitate scheduling decisions by the operating system level schedulers.

    • Resource Usage Tracking:

    • The resource usage is monitored at the kernel thread level, and this information is held within the lightweight process data structure tied to each kernel level thread.

Aggregate Resource Usage
  • To compute the aggregate resource usage for an entire process:

    • The kernel must traverse all lightweight processes associated with that process.

Kernel Level Thread Structure

  • Maintains essential execution context information for kernel level threads:

    • Registers

    • Stack Pointers

    • Scheduling Class

    • Pointers to various kernel data structures, including:

    • Lightweight process and its associated actual address space.

    • The CPU where the thread operates.

Non-swappable vs Swappable Data Structures
  • Kernel Level Thread Structure:

    • Contains non-swappable information; it is always needed by operating system services, even when a thread is inactive (e.g., scheduling information).

  • Lightweight Process Structure:

    • Information may be swapped out if the system experiences memory pressure, allowing for the support of a larger number of threads without utilizing excessive memory.

CPU Data Structure

  • Contains critical information about the current state of the CPU:

    • Current scheduled thread.

    • List of other kernel level threads that have executed on that CPU.

    • Procedures for thread dispatching and handling peripheral device interrupts.

Accessing Information via CPU Structure
  • Knowing the current thread state allows retrieval of data structures needed to restore the entire process state.

    • The architecture used in systems like Solaris (SPARC architecture) has additional registers that aid this process:

    • A dedicated register always points to the current thread; this allows quick access during context switches without needing to read from memory, enhancing performance.

Data Structure Relationships

  • According to the I Called paper on multithreading in the SANOS kernel:

    • Process Data Structure:

    • Contains user information and points to the address space and a list of kernel level thread structures.

    • Each Kernel Level Thread Structure:

    • Points to the corresponding lightweight process, stack, and other relevant data.

    • Information related to lightweight processes and stacks is swappable, while the cache state is crucial.

Figure Description (Not Provided)
  • There are additional pointers and information not displayed in the cited figure, to maintain clarity, such as connections from threads back to the process.