hg.3 (2010 09)

h
hg(3) hg(3)
(Mercury Library)
NAME
hg: hg_busywait(), hg_context_switch_involuntary(), hg_context_switch_tries(),
hg_context_switch_voluntary(), hg_gethrcycles(), hg_gethrtime(), hg_getspu(), hg_nano_to_cycle_ratio(),
hg_public_init(), hg_public_is_onRunQ(), hg_public_is_reporting(), hg_public_is_running(),
hg_public_nMailboxes(), hg_public_nMailboxesInUse(), hg_public_remove(), hg_setcrit() - Mercury
Library Interfaces to transfer data between user and kernel space in a lightweight manner
SYNOPSIS
#include<sys/mercury.h>
cc flags filename -lhg
Mercury Public Interfaces
uint64_t hg_public_init(void);
uint64_t hg_public_remove(void);
uint64_t hg_public_is_reporting(uint64_t hg_public_handle);
uint64_t hg_public_is_running(uint64_t hg_public_handle);
uint64_t hg_public_is_onRunQ(uint64_t hg_public_handle);
uint64_t hg_public_nMailboxes(void);
uint64_t hg_public_nMailboxesInUse(void);
Mercury Private Interfaces
uint64_t hg_gethrcycles(void);
uint64_t hg_gethrtime(void);
double hg_nano_to_cycle_ratio(void);
uint64_t hg_busywait(double seconds);
spu_t hg_getspu(void);
uint64_t hg_context_switch_tries(void);
uint64_t hg_context_switch_involuntary(void);
uint64_t hg_context_switch_voluntary(void);
uint64_t hg_setcrit(unsigned long on_or_off, int willing_to_block);
DESCRIPTION
The Mercury Library Interface (HG) provides a high performance interface between user programs
and the kernel, making it possible to transfer key pieces of information back and forth at high speed.
Communication between the user space and kernel is relatively slow due to the overhead of making a sys-
tem call. The Mercury APIs help by avoiding most or all of this overhead.
The information exchanged can be divided into two broad categories:
Public data:
Information about specific kernel threads likely to be of interest to other threads. This is provided by
the Mercury Public Interface functions. This information received is the present run state of the
threads being queried.
Private data:
Information likely to be of interest to the same thread alone. The Mercury Private Interfaces allow
the kernel to keep a thread informed of a number of events usually of use or interest only to that
thread.
A thread needs to register before any other thread can view its public information. There is no need to
register to view the information of other threads.
If a thread does register itself, it is provided a handle, which may be communicated to other threads.
Mercury Library provides APIs that query the handle for the underlying thread’s run state. Hence the
thread is recognized by the handle assigned to it.
HP-UX 11i Version 3: September 2010 1 Hewlett-Packard Company 1

Summary of content (6 pages)