next up previous contents
Next: 2.3 References Up: 2 Thread Previous: 2.1 Overview

2.2 State

The processor architecture-independent portion of a thread object consists of:

struct fluke_thread_state  {

	integer_t	hash;		/* object hash value */
	oskit_addr_t	thread_va;	/* virtual address of thread object */
	integer_t	sched_val;	/* scheduler-assigned thread id */
	unsigned	flags;		/* general thread flags */
 
}

fluke_ref_t*task_ref;
fluke_ref_t*scheduler_ref;
fluke_ref_t*waiting_for_ref;
fluke_ref_t*client_ref;
fluke_ref_t*server_ref;

hash is the immutable hash value for the object.

thread_va is the virtual address in the associated task at which the thread object must be mapped in order to run. It is an insanity condition if a thread attempts to run with thread_va not matching the actual mapped address. em thread_va is the value returned by fluke_thread_self.

sched_val is a scheduler assigned thread identifier. A scheduler can use this value to distinguish cooperating client threads.

flags contains a number of thread state bits. Most are architecture/implementation specific, but one is of general use. FLUKE_THREAD_STOPPED is set whenever a thread was stopped at the time its state was collected. Clearing the bit when restoring a thread's state, may not actually resume the thread (a thread's runability depends on its task and scheduler reference) but is a prerequisite to doing so.

task_ref is a reference to the task object to which the thread belongs. If task_ref is null the thread cannot execute. An otherwise runnable thread will fault as soon as it attempts to execute user code and then block until a task reference is restored.

scheduler_ref is a reference to the port to which the thread sends an idempotent IPC to request CPU time. If null, the thread can only run using donated time from another thread; e.g., as the server in an idempotent or reliable IPC call.

waiting_for_ref is a reference to a number of possible objects indicating that the thread is blocked waiting for the object. The referenced object may be:

Note that the application does not need to save this reference in order preserve the ``critical'' state of the thread; it can be regenerated at any time from the thread's CPU state. For example, if the thread is waiting in an idempotent IPC, then the thread's saved program counter will point to the Fluke fluke_ipc_call operation entrypoint and the saved register state will contain all the information necessary to restart the operation.

client_ref is a reference to a thread object. If non-null and the referenced thread's server_ref points to this thread, then this thread is acting in the server role of a reliable IPC connection with the referenced thread.

server_ref is a reference to a thread object. If non-null and the referenced thread's client_ref points to this thread, then this thread is acting in the client role of a reliable IPC connection with the referenced thread.


next up previous contents
Next: 2.3 References Up: 2 Thread Previous: 2.1 Overview

Utah Flux Research Group