As handle ( English for grip or handle ) is known in the computer science a unique reference value to a managed by the OS system resource such. B. Screen objects or individual files on hard drives. If an application program wants to use such a resource, by calling a suitable system function (for example, to open or create files) , it receives the reference as a return value that must be specified for further use of the resource by system functions (for example, to read from a file) .
The operating system checks when opening a resource access rights, sets - if needed - internal administrative structures needed to coordinate and further access attempts of other applications to the resource. If an application releases the resource again by calling Close , the management structures are cleared down again and the handle becomes invalid.
Other terms that have a more specific meaning depending on their use are, in addition to handle ( Microsoft Windows ), capability (academic) or descriptor ( POSIX ). The terminology is not consistent across different systems. For example, POSIX capabilities are not references to specific system resources but represent the permission to carry out a certain action.
If the system resource in question is a file, the handle is also known as the file handle or file descriptor .
A handle connects the identification of a system resource with access rights. For example, an application that opens a file through a system call with write permissions can subsequently execute write operations on the file by receiving the handle by specifying the handle as the target of the operation.
The principle can be illustrated by comparing it with a business reference in correspondence with authorities. As a citizen, you do not have direct access to the documents, but refer to the previous process by giving a business reference.
In programming with assembler and other programming languages, there are function calls for opening or creating files that return an integer. If this number is positive, then this is a handle to a file which can then be used for further operations with the file. In almost all implementations of the programming language C for today's operating systems get the standard streams
stderras a handle, the values 0, 1 or 2. However, this is not part of standard C, but will implement a UNIX operating systems, and then often adopted convention.
The NFS protocol for file access over a network uses file handles to address file operations.
In Matlab , placing the
@symbol in front of a function creates a function handle that is comparable to function pointers in C, for example .
In the Windows API is HANDLE defined as data type, said further resource-specific types of data are derived therefrom (eg. B. HBITMAP or HBRUSH).
A handle system is used to assign and manage identifiers in the World Wide Web , which are also referred to as handles . Similar to the Domain Name System , a handle system in this sense represents a method for resolving namespaces . A corresponding application of such handles, which is better known in German-speaking countries, are digital object identifiers . Another system are the Persistent Uniform Resource Locators .
- Sam Sun, Larry Lannom, Brian Boesch: Handle System Overview . RFC 3650 November 2003.
- Sam Sun, Sean Reilly, Larry Lannom: Handle System Namespace and Service Definition . RFC 3651 November 2003
- Sam Sun, Sean Reilly, Larry Lannom, Jason Petrone: Handle System Protocol (ver 2.1) Specification . RFC 3652 November 2003
- Details handle use in Windows programming (English)
- ePIC Persistent Identifier Consortium for eResearch - Website of the ePIC Persistent Identifier Consortium for eResearch as a service provider for handles in research
- Filehandle (Perl-Specific)
- Working with Files (Perl Specific)
- ↑ Thomas W. Döppner: Operating Systems In Depth: Design and Programming . John Wiley & Sons, 2010, ISBN 0-471-68723-5 , pp. 20 ( limited preview in Google Book search).
- ↑ Archive link ( Memento of the original from July 7, 2013 in the Internet Archive ) Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice. Handles on Windows (German)
- ↑ stackoverflow.com Brief description (English)
- ↑ Max Hailperin: Operating Systems And Middleware: Supporting Controlled Interaction . Cengage Learning, 2006, ISBN 978-0-534-42369-8 , pp. 242 ff . ( limited preview in Google Book search).
- ^ Richard Blum: Professional Assembly Language . Wrox, 2005, ISBN 0-7645-9561-X , pp. 457 ( limited preview in Google Book search).
- ↑ Peter Prinz, Ulla Kirch-Prinz: C: Introduction and professional application . S. 335 f . ( limited preview in Google Book search).
- ^ Aaron R. Bradley: Programming for Engineers . A Foundational Approach to Learning C and Matlab. Springer, 2011, ISBN 3-642-23302-3 , pp. 204 ( limited preview in Google Book search).
- ↑ Windows data types. msdn.microsoft.com (English)
- ↑ The Handle System - Corporation for National Research Initiative website (English)