rump_lwproc man page on NetBSD

Man page or keyword search:  
man Server   9087 pages
apropos Keyword Search (all sections)
Output format
NetBSD logo
[printable version]

RUMP_LWPROC(3)		 BSD Library Functions Manual		RUMP_LWPROC(3)

NAME
     rump_lwproc — rump process/lwp management

LIBRARY
     rump kernel (librump, -lrump)

SYNOPSIS
     #include <rump/rump.h>

     int
     rump_pub_lwproc_rfork(int flags);

     int
     rump_pub_lwproc_newlwp(pid_t pid);

     void
     rump_pub_lwproc_switch(struct lwp *l);

     void
     rump_pub_lwproc_releaselwp();

     struct lwp *
     rump_pub_lwproc_curlwp();

DESCRIPTION
     In a normal operating system model a process is a resource container and
     a thread (lwp) is the execution context.  Every lwp is associated with
     exactly one process, and a process is associated with one or more lwps.
     The current lwp (curlwp) indicates the current process and determines
     which resources, such as UID/GID, current working directory, and file
     descriptor table, are currently used.  These basic principles apply to
     rump kernels as well, but since rump uses the host's thread and process
     context directly, the rules for how thread context is determined are dif‐
     ferent.

     In the rump model, each host thread (pthread) is either bound to a rump
     kernel lwp or accesses the rump kernel with an implicit thread context
     associated with pid 1.  An implicit thread context is created every time
     the rump kernel is entered and disbanded upon exit.  While convenient for
     occasional calls, creating an implicit thread uses a shared resource
     which can become highly contended in a multithreaded situation.  It is
     therefore recommended that dedicated threads are created.

     The association between host threads and the rump kernel curlwp is left
     to the caller.  It is possible to create a dedicated host thread for
     every rump kernel lwp or multiplex them on top of a single host thread.
     After rump lwps have been created, switching curlwp is very cheap --
     faster than a thread context switch on the host.  In case multiple
     lwps/processes are created, it is the caller's responsibility to keep
     track of them and release them when they are no longer necessary.	Like
     other rump kernel resources, procs/lwps will be released when the process
     hosting the rump kernel exits.

     rump_pub_lwproc_rfork()
	   Create a process, one lwp inside it and set curlwp to the new lwp.
	   The flags parameter controls how file descriptors are inherited
	   from the parent.  By default (flags=0) file descriptors are shared.
	   Other options are:

	   RUMP_RFFDG	  Copy file descriptors from parent.  This is what
			  fork(2) does.

	   RUMP_RFCFDG	  File descriptors neither copied nor shared, i.e. new
			  process does not have access to the parent's file
			  descriptors.

	   This routine returns 0 for success or an errno indicating the rea‐
	   son for failure.  The new process id can be retrieved in the normal
	   fashion by calling rump_sys_getpid().

     rump_pub_lwproc_newlwp(pid)
	   Create a new lwp attached to the process specified by pid.  Sets
	   curlwp to the new lwp.  This routine returns 0 for success or an
	   errno indicating the reason for failure.

     rump_pub_lwproc_switch(l)
	   Sets curlwp to l.  In case the new thread is associated with a dif‐
	   ferent process than the current one, the process context is also
	   switched.  The special value NULL sets curlwp to implicit context.
	   Switching to an already running lwp, i.e. attempting to use the
	   same curlwp in two host threads simultaneously causes a fatal
	   error.

     rump_pub_lwproc_releaselwp()
	   Release curlwp and set curlwp to context.  In case curlwp was the
	   last thread inside the current process, the process container is
	   also released.  Calling this routine without a dedicated curlwp is
	   a fatal error.

     rump_pub_lwproc_curlwp()
	   Returns curlwp or NULL if the current context is an implicit con‐
	   text.

SEE ALSO
     getpid(2), rump(3)

HISTORY
     rump_lwproc first appeared in NetBSD 6.0.

BSD				January 2, 2011				   BSD
[top]
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server NetBSD

List of man pages available for NetBSD

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net