11.07.2015 Views

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

224 health, personalTo search a hashed database, the hashing formula is first applied tothe search key, yielding a hash value. That value can then be usedin a binary search to quickly zero in on the matching record, if any.the unique relationship between the original message <strong>and</strong>the hash maintains a high degree <strong>of</strong> security.Finally, hashing can be used for error detection. If amessage <strong>and</strong> its hash are sent together, the recipient canhash the received text. If the hash value generated matchesthe one received, it is highly likely the message was receivedintact (see also error correction).Further ReadingPartow, Arash. “General Purpose Hash Function Algorithms.”Available online. URL: http://www.partow.net/programming/hashfunctions/. Accessed August 6, 2007.Pieprzyk, Josef, <strong>and</strong> Babak Sadeghiyan. Design <strong>of</strong> Hashing Algorithms.New York: Springer-Verlag, 1993.health, personal See personal health informationmanagement.heapIn operating systems <strong>and</strong> certain programming languages(such as LISP), a heap is a pool <strong>of</strong> memory resources availablefor allocation by programs. The memory segments(sometimes called cells) can be the same size or <strong>of</strong> variablesize. If the same size, they are linked together by pointers(see list processing). Memory is then allocated for a variableby traversing the list <strong>and</strong> setting the required number<strong>of</strong> cells to be “owned” by that variable. (While some languagessuch as Pascal <strong>and</strong> C use explicit memory allocationor deallocation functions, other languages such as LISP usea separate runtime module that is not the responsibility <strong>of</strong>the programmer.)Deallocation (the freeing up <strong>of</strong> memory no longerneeded by a variable so it can be used elsewhere) is morecomplicated. In many languages several different pointerscan be used to refer to the same memory location. It istherefore necessary not only to disconnect a given pointerfrom the cell, but to track the total number <strong>of</strong> pointers connectedto the cell so that the cell itself is deallocated onlywhen the last pointer to it has been disconnected. Oneway to accomplish this is by setting up an internal variablecalled a reference counter <strong>and</strong> incrementing or decrementingit as pointers are connected or disconnected. The disadvantages<strong>of</strong> this approach include the memory overhead neededto store the counters <strong>and</strong> the execution overhead <strong>of</strong> havingto continually check <strong>and</strong> update the counters.An alternative approach is garbage collection. Here theruntime system simply connects or disconnects pointersas required by the program’s declarations, without makingan attempt to reclaim the disconnected (“dead”) cells. If<strong>and</strong> when the supply <strong>of</strong> free cells is exhausted, the runtimesystem takes over <strong>and</strong> begins a three-stage process. First,it provisionally sets the status indicator bit for each cell toshow that it is “garbage.” Each pointer in the program isthen traced (that is, its links are followed) into the heap,<strong>and</strong> if a valid cell is found that cell’s indicator is reset to“not garbage.” Finally, the garbage cells that remain arelinked back to the pool <strong>of</strong> free cells available for future allocation.The chief drawback <strong>of</strong> garbage collection is that themore cells actually being used by the program, the longerthe garbage-collecting process will take (since all <strong>of</strong> thesecells have to be traced <strong>and</strong> verified). Yet it is precisely whenmost cells are in use that garbage collection is most likely tobe required.The need for garbage collection has diminished in manyprogramming environments because modern computersnot only have large amounts <strong>of</strong> memory, most operatingsystems also implement virtual memory, which allows adisk or other storage device to be treated as an extension <strong>of</strong>main memory.Note: the term heap is also used to describe a particulartype <strong>of</strong> binary tree. (See tree.)Further ReadingLafore, Robert. Data Structures & Algorithms in Java. 2nd ed. Indianapolis:Sams, 2002.Preiss, Bruno R. “Heaps <strong>and</strong> Priority Queues.” Available online.URL: http://www.brpreiss.com/books/opus4/html/page352.html. Accessed August 6, 2007.Sebesta, Robert W. Concepts <strong>of</strong> Programming Languages. 8th ed.Boston: Addison-Wesley, 2007.help systemsIn the early days <strong>of</strong> computing, the programmers <strong>of</strong> a systemtended to also be its users <strong>and</strong> were thus intimatelyfamiliar with the program’s operation <strong>and</strong> comm<strong>and</strong> set.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!