Processes and Threads

The process manager is responsible for keeping track of all processes in the system, and all their associated threads, memory and other resources.

Process API

The following table lists all functions related to the process manager API.

API Description

BT_CreateProcess()

Creates a BitThunder process.

BT_DestroyProcess()

Destroys a BitThunder process.

BT_GetProcessHandle()

Gets the handle of the current process.

Thread API

API Description

BT_CreateThread()

Creates a new thread.

BT_GetThreadHandle()

Get the handle of the currently executing thread.

BT_ThreadSleep()

Causes the current thread to sleep for the specified time..

BT_ThreadSleepUntil()

Causes the current thread to sleep until a specified time in the future.

BT_ThreadYield()

Yields the processor to allow execution of another thread or process.

Kernel-space / Driver API

Design Overview

The primary object of execution in BitThunder is a thread. A process is simply an abstraction that allows the grouping of 1 or more threads together into a system (or application).

A process usually takes responsibility for a major task in a BitThunder system, and should require little or no communication with other processes. Although there are some IPC constructs available.

Processes always contain at least 1 thread,

On full-featured platforms (like Xilinx Zynq) this abstraction can be optionally enforced by enabling MMU and virtual memory support. In such cases, attempts to access pointers in memory not allocated to that process will result in a seg-mentation fault and the process will be closed and all resources free’d and cleaned.

If configured, a BitThunder process can be restarted automatically by the BitThunder watchdog system.

Further Reading

The full API is defined under:

os/include/gpio/bt_gpio.h

See the implementation under:

os/src/gpio/bt_gpio.c

Back