To install click the Add extension button. That's it.

The source code for the WIKI 2 extension is being checked by specialists of the Mozilla Foundation, Google, and Apple. You could also do it yourself at any point in time.

4,5
Kelly Slayton
Congratulations on this excellent venture… what a great idea!
Alexander Grigorievskiy
I use WIKI 2 every day and almost forgot how the original Wikipedia looks like.
Live Statistics
English Articles
Improved in 24 Hours
Added in 24 Hours
What we do. Every page goes through several hundred of perfecting techniques; in live mode. Quite the same Wikipedia. Just better.
.
Leo
Newton
Brights
Milds

Handle (computing)

From Wikipedia, the free encyclopedia

In computer programming, a handle is an abstract reference to a resource that is used when application software references blocks of memory or objects that are managed by another system like a database or an operating system.

A resource handle can be an opaque identifier, in which case it is often an integer number (often an array index in an array or "table" that is used to manage that type of resource), or it can be a pointer that allows access to further information. Common resource handles include file descriptors, network sockets, database connections, process identifiers (PIDs), and job IDs. PIDs and job IDs are explicitly visible integers; while file descriptors and sockets (which are often implemented as a form of file descriptor) are represented as integers, they are typically considered opaque. In traditional implementations, file descriptors are indices into a (per-process) file descriptor table, thence a (system-wide) file table.

YouTube Encyclopedic

  • 1/3
    Views:
    95 804
    107 404
    133 698
  • How Does Hardware and Software Communicate?
  • buying best laptop for programming
  • An Introduction to the Scratch Programming Language for Education

Transcription

A System resource is a tool used by either hardware or software to communicate with each other. When software wants to send data to a device, such as when you want to save a file to a hard drive. Or when the hardware needs attention, such as when you press a key on the keyboard. The hardware or software uses system resources to communicate. There are four types of system resources. memory addresses input output addresses interrupt requests and direct memory access channels when we press a key on the keyboard, the keyboard wants to tell the CPU that a key has been pressed. but CPU is already busy doing something else. So the keyboard places a volatage on the IRQ line assigned to it. And this voltage serves as a signal to the CPU that the device has a request which needs processing. An operating system relates to memory as a long list of cells that it can use to hold data and instructions, somewhat like one dimensional spreadsheet. Think of a memory address as a seat number in a theatre. Each seat is assigned a number regardless of whether someone is sitting in it. The person sitting in a seat can be data or instructions. And the OS does not refer to the person by the name but only by the seat number. For example, the operating system might say, I want to print data in memory address 500. These addresses are most often displayed on the screen as hexadecimal number in segment offset form. Input output addresses which are simply called ports, the CPU can use to access hardware devices in much the same way it uses memory address to access physical memory. The address bus on the motherboard sometimes carries memory addresses and sometimes carries input output addresses. If the address bus has been set to carry input output addresses, then each hardware device listens to this bus. For example, if CPU wants to communicate with keyboard, It will place the Input Output address of keyboard on the address bus. Once address is placed, CPU announces, Input Output addresses are on the address line. Now all input output controllers listen for their address. Hard drive controller says not my address. Floppy disk controller says not my address. But keyboard controller says its mine, I'll respond. Input Output address lines on the bus work much like an old telephone party line. All devices hear the addresses but only one responds. Another system resource used by hardware and software is a direct memory access channel. A shortcut method that lets an input output device send data directly to memory bypassing the CPU. some devices such as the printer are designed to use DMA channels. and others such as the mouse are not. DMA channels are not as popular as they once were. because their design makes them slower than newer methods.. however slower devices such as floppy drives, sound cards and tape drives may still use DMA channels. So basically hardware devices call the CPU for attention using Interrupt Requests. Software calls a hardware by input output address of hardware device. software looks at a memory as a hardware device and calls it with memory address. DMA channels pass data back and forth between hardware device and memory. So thats how.. the hardware.. communicates with software !

Comparison to pointers

While a pointer contains the address of the item to which it refers, a handle is an abstraction of a reference which is managed externally; its opacity allows the referent to be relocated in memory by the system without invalidating the handle, making it similar to virtual memory for pointers, but even more abstracted. Similarly, the extra layer of indirection also increases the control that the managing system has over the operations performed on the referent. Typically the handle is an index or a pointer into a global array of tombstones.

A handle leak is a type of software bug that occurs when a computer program does not free a handle that it previously allocated. This is a form of resource leak, analogous to a memory leak for previously allocated memory.

Security

In secure computing terms, because access to a resource via a handle is mediated by another system, a handle functions as a capability: it not only identifies an object, but also associates access rights. For example, while a filename is forgeable (it is just a guessable identifier), a handle is given to a user by an external system, and thus represents not just identity, but also granted access.

For example, if a program wishes to read the system password file (/etc/passwd) in read/write mode (O_RDWR), it could try to open the file via the following call:

int fd = open("/etc/passwd", O_RDWR);

This call asks the operating system to open the specified file with the specified access rights. If the OS allows this, then it opens the file (creates an entry in the per-process file descriptor table) and returns a handle (file descriptor, index into this table) to the user: the actual access is controlled by the OS, and the handle is a token of that. Conversely, the OS may deny access, and thus neither open the file nor return a handle.

In a capability-based system, handles can be passed between processes, with associated access rights. Note that in these cases the handle must be something other than a systemwide-unique small integer, otherwise it is forgeable. Such an integer may nevertheless be used to identify a capability inside a process; e.g., file descriptor in Linux is unforgeable because its numerical value alone is meaningless, and only in the process context may refer to anything. Transferring such a handle requires special care though, as its value often has to be different in the sending and receiving processes.

In non-capability-based systems, on the other hand, each process must acquire its own separate handle, by specifying the identity of the resource and the desired access rights (e.g., each process must open a file itself, by giving the filename and access mode). Such usage is more common even in modern systems that do support passing handles, but it is subject to vulnerabilities like the confused deputy problem.

Examples

Handles were a popular solution to memory management in operating systems of the 1990s, such as Mac OS[1] and Windows. The FILE data structure in the C standard I/O library is a file handle, abstracting from the underlying file representation (on Unix these are file descriptors). Like other desktop environments, the Windows API heavily uses handles to represent objects in the system and to provide a communication pathway between the operating system and user space. For example, a window on the desktop is represented by a handle of type HWND (handle, window).

Doubly indirect handles (where the handle is not necessarily a pointer but might be, for example, an integer) have fallen out of favor in recent times, as increases in available memory and improved virtual memory algorithms have made the use of the simpler pointer more attractive. However, many operating systems still apply the term to pointers to opaque, "private" data structuresopaque pointers—or to indexes into internal arrays passed from one process to its client.

See also

References

  1. ^ Hertzfeld, Andy (January 1982), The Original Macintosh: Hungarian, retrieved 2010-05-10

External links

This page was last edited on 28 September 2023, at 13:25
Basis of this page is in Wikipedia. Text is available under the CC BY-SA 3.0 Unported License. Non-text media are available under their specified licenses. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc. WIKI 2 is an independent company and has no affiliation with Wikimedia Foundation.