Doors (computing)
Encyclopedia
Doors are an inter-process communication
Inter-process communication
In computing, Inter-process communication is a set of methods for the exchange of data among multiple threads in one or more processes. Processes may be running on one or more computers connected by a network. IPC methods are divided into methods for message passing, synchronization, shared...

 facility for Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 computer systems. They provide a form of procedure call
Subroutine
In computer science, a subroutine is a portion of code within a larger program that performs a specific task and is relatively independent of the remaining code....

.

History

Doors were developed by Sun Microsystems
Sun Microsystems
Sun Microsystems, Inc. was a company that sold :computers, computer components, :computer software, and :information technology services. Sun was founded on February 24, 1982...

 as a core part of the Spring operating system, then added to Solaris
Solaris Operating System
Solaris is a Unix operating system originally developed by Sun Microsystems. It superseded their earlier SunOS in 1993. Oracle Solaris, as it is now known, has been owned by Oracle Corporation since Oracle's acquisition of Sun in January 2010....

 in version 2.5 as an undocumented internal interface. They became a documented feature in Solaris 2.6. Recent versions of Solaris use doors in many places, including nscd (the name service
Name server
In computing, a name server is a program or computer server that implements a name-service protocol. It maps a human-recognizable identifier to a system-internal, often numeric, identification or addressing component....

 cache daemon) and syslog
Syslog
Syslog is a standard for computer data logging. It allows separation of the software that generates messages from the system that stores them and the software that reports and analyzes them...

.

The doors facility has been ported to Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

, but is only available for version 2.4.18.

Overview

The doors subsystem is implemented as a user-space
User space
A conventional computer operating system usually segregates virtual memory into kernel space and user space. Kernel space is strictly reserved for running the kernel, kernel extensions, and most device drivers...

 library with some kernel support, and relies heavily on threads
Thread (computer science)
In computer science, a thread of execution is the smallest unit of processing that can be scheduled by an operating system. The implementation of threads and processes differs from one operating system to another, but in most cases, a thread is contained inside a process...

. It is designed for low overhead, and the Solaris implementation uses some assembler code for maximum efficiency.

Doors are created by server processes (which must use threads) and called by client processes. (It is possible for one process to both create and call a door.) When creating a door, the server must specify a server procedure, which will be called by the doors library on behalf of clients. Unlike most Remote procedure call
Remote procedure call
In computer science, a remote procedure call is an inter-process communication that allows a computer program to cause a subroutine or procedure to execute in another address space without the programmer explicitly coding the details for this remote interaction...

 systems, each door has only one server procedure. A server can "attach" a door to a file, enabling clients to connect to that door simply by opening that file. The ls -l
Ls
In computing, ls is a command to list files in Unix and Unix-like operating systems. ls is specified by POSIX and the Single UNIX Specification.- History :An ls utility appeared in the original version of AT&T UNIX...

 command will then show the file with a 'type' of "D" (not to be confused with "d" for a directory) — for example:

    Drw--r--r-- 1 smith dev 876 May 16 9:42 myfile

Clients use door_call to invoke the door's server procedure, passing a contiguous region of memory and a list of file descriptor
File descriptor
In computer programming, a file descriptor is an abstract indicator for accessing a file. The term is generally used in POSIX operating systems...

s as arguments, and getting back another contiguous region and list of file descriptors. Either region may be empty, as may either list. Usually, two C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....

 structs will be defined, one for the input data and one for the output data. (Alternatively, tagged union
Tagged union
In computer science, a tagged union, also called a variant, variant record, discriminated union, or disjoint union, is a data structure used to hold a value that could take on several different, but fixed types. Only one of the types can be in use at any one time, and a tag field explicitly...

s may be used, allowing a door procedure to provide multiple actions in much the same way as the ioctl
Ioctl
In computing, ioctl, short for input/output control, is a system call for device-specific operations and other operations which cannot be expressed by regular system calls. It takes a parameter specifying a request code; the effect of a call depends completely on the request code. Request codes are...

 system call.) Every file descriptor is accompanied by a flags word. The DOOR_RELEASE flag requests that a file descriptor be closed in the sending process after being duplicated in the receiving process. If a file descriptor that refers to a door is sent, the system records the properties of that door in the flags word.

As well as representing a procedure, or a group of procedures, a door can represent a stateful data object
Object (computer science)
In computer science, an object is any entity that can be manipulated by the commands of a programming language, such as a value, variable, function, or data structure...

, making it possible to pass references to such objects between processes. Such a door would typically take a tagged union
Tagged union
In computer science, a tagged union, also called a variant, variant record, discriminated union, or disjoint union, is a data structure used to hold a value that could take on several different, but fixed types. Only one of the types can be in use at any one time, and a tag field explicitly...

 as input data with each tag value denoting a different method
Method (computer science)
In object-oriented programming, a method is a subroutine associated with a class. Methods define the behavior to be exhibited by instances of the associated class at program run time...

.

The doors system also provides a way for clients and servers to get information about each other. For example, a server can check the client's user credentials or process ID to decide whether the client is allowed to do something.

The doors library normally creates and manages a pool of threads in the server process to handle calls, but it is possible to override this behaviour. The doors system does not provide any form of synchronization, but servers can use the normal thread-level synchronization primitives. Doors can be used to synchronize access to shared memory
Shared memory
In computing, shared memory is memory that may be simultaneously accessed by multiple programs with an intent to provide communication among them or avoid redundant copies. Depending on context, programs may run on a single processor or on multiple separate processors...

 segments, allowing single-copy data transfer.

External links

  • Solaris 10 man pages section 3: Realtime Library Functions (man pages
    Manual page (Unix)
    Man pages are the extensive documentation that comes preinstalled with almost all substantial Unix and Unix-like operating systems. The Unix command used to display them is man. Each page is a self-contained document.- Usage :...

    for the door-related functions)
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK