Hash Tables of Buffers


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Hash Tables of Buffers
# 1  
Old 06-09-2012
Question Hash Tables of Buffers

Hello,

I want to know how hash tables for buffers were implemented in Unix and now, in linux how they are implemented ?

I am aware of what hashing is..also quite familiar with Unix/Linux.

Special case is how device numbers comes into picture..I am curious !

If possible consider some example like there are 1000 buffers that can stay in buffer pool..
Please do not divert by proving it is of O(1). I know that. I am asking implementation thing!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Dynamically parse BibTeX and create hash of hash

Hello gurus, Iam trying to parse following BibTex file (bibliography.bib): @book{Lee2000a, abstract = {Abstract goes here}, author = {Lee, Wenke and Stolfo, Salvatore J}, title = {{Data mining approaches for intrusion detection}}, year = {2000} } @article{Forrest1996, abstract =... (0 Replies)
Discussion started by: wakatana
0 Replies

2. Shell Programming and Scripting

Compare values of hashes of hash for n number of hash in perl without sorting.

Hi, I have an hashes of hash, where hash is dynamic, it can be n number of hash. i need to compare data_count values of all . my %result ( $abc => { 'data_count' => '10', 'ID' => 'ABC122', } $def => { 'data_count' => '20', 'ID' => 'defASe', ... (1 Reply)
Discussion started by: asak
1 Replies

3. Programming

Hash tables concepts

How hash tables are used to quickly locate a data record? (4 Replies)
Discussion started by: rupeshkp728
4 Replies

4. Shell Programming and Scripting

Perl Hash:Can not keep hash data in the same order that it was inserted

Can Someone explain me why even using Tie::IxHash I can not get the output data in the same order that it was inserted? See code below. #!/usr/bin/perl use warnings; use Tie::IxHash; use strict; tie (my %programs, "Tie::IxHash"); while (my $line = <DATA>) { chomp $line; my(... (1 Reply)
Discussion started by: jgfcoimbra
1 Replies

5. Shell Programming and Scripting

Print Entire hash list (hash of hashes)

I have a script with dynamic hash of hashes , and I want to print the entire hash (with all other hashes). Itried to do it recursively by checking if the current key is a hash and if yes call the current function again with refference to the sub hash. Most of the printing seems to be OK but in... (1 Reply)
Discussion started by: Alalush
1 Replies

6. Programming

Compression algorithm( usage of Hash tables)

Hi All, i was browsing thru' the opensource glib(deflate/inflate) algorithms.. which i am supposed to implement. I came across Dictionary usage (Hash tables), LZ77 algorithm and Huffman coding in that.. i couldn't follow on the Hash table implementation in that. Anybody there to give some... (5 Replies)
Discussion started by: rvan
5 Replies

7. Shell Programming and Scripting

Converting tables of row data into columns of tables

I am trying to transpose tables listed in the format into format. Any help would be greatly appreciated. Input: test_data_1 1 2 90% 4 3 91% 5 4 90% 6 5 90% 9 6 90% test_data_2 3 5 92% 5 4 92% 7 3 93% 9 2 92% 1 1 92% ... Output:... (7 Replies)
Discussion started by: justthisguy
7 Replies

8. Programming

hash tables, pthread_key_create

I want to store a bunch of pthread_t types in a hash table, but since pthread_t is not an integer value, I cannot hash it. I was hoping to store a unique nonzero as key 0 for each thread with thread-specific data ala pthread_key_create/pthread_setspecific, but but as it turns out only the first... (2 Replies)
Discussion started by: Corona688
2 Replies

9. UNIX for Dummies Questions & Answers

Passing Hash Tables to Subroutines

Hi: How do I pass a hash table down to a subroutine along with some other variables? For example, I have say a subroutine play_with_hash: sub play_with_hash { my( $var1, $var2, %my_hash ) = @_; #do stuff with %my_hash ........... } Then I want to call the subroutine... (1 Reply)
Discussion started by: mirzabhai
1 Replies

10. UNIX for Dummies Questions & Answers

Returning Hash Tables in Perl

Hi: Does anybody know how to return hash tables created in a function? I have something like so: %a_hash_table = build_a_hash_table(); sub build_a_hash_table { my(%hash_table); #some code to build hash table: "%hash_table" for e.g return %hash_table; } ----> This... (1 Reply)
Discussion started by: mirzabhai
1 Replies
Login or Register to Ask a Question
HASH(3) 						     Linux Programmer's Manual							   HASH(3)

NAME
hash - hash database access method SYNOPSIS
#include <sys/types.h> #include <db.h> DESCRIPTION
The routine dbopen(3) is the library interface to database files. One of the supported file formats is hash files. The general descrip- tion of the database access methods is in dbopen(3), this manual page describes only the hash specific information. The hash data structure is an extensible, dynamic hashing scheme. The access method specific data structure provided to dbopen(3) is defined in the <db.h> include file as follows: typedef struct { unsigned int bsize; unsigned int ffactor; unsigned int nelem; unsigned int cachesize; uint32_t (*hash)(const void *, size_t); int lorder; } HASHINFO; The elements of this structure are as follows: bsize defines the hash table bucket size, and is, by default, 256 bytes. It may be preferable to increase the page size for disk-resi- dent tables and tables with large data items. ffactor indicates a desired density within the hash table. It is an approximation of the number of keys allowed to accumulate in any one bucket, determining when the hash table grows or shrinks. The default value is 8. nelem is an estimate of the final size of the hash table. If not set or set too low, hash tables will expand gracefully as keys are entered, although a slight performance degradation may be noticed. The default value is 1. cachesize is the suggested maximum size, in bytes, of the memory cache. This value is only advisory, and the access method will allocate more memory rather than fail. hash is a user-defined hash function. Since no hash function performs equally well on all possible data, the user may find that the built-in hash function does poorly on a particular data set. A user-specified hash functions must take two arguments (a pointer to a byte string and a length) and return a 32-bit quantity to be used as the hash value. lorder is the byte order for integers in the stored database metadata. The number should represent the order as an integer; for exam- ple, big endian order would be the number 4,321. If lorder is 0 (no order is specified) the current host order is used. If the file already exists, the specified value is ignored and the value specified when the tree was created is used. If the file already exists (and the O_TRUNC flag is not specified), the values specified for bsize, ffactor, lorder, and nelem are ignored and the values specified when the tree was created are used. If a hash function is specified, hash_open will attempt to determine if the hash function specified is the same as the one with which the database was created, and will fail if it is not. Backward compatible interfaces to the routines described in dbm(3), and ndbm(3) are provided, however these interfaces are not compatible with previous file formats. ERRORS
The hash access method routines may fail and set errno for any of the errors specified for the library routine dbopen(3). BUGS
Only big and little endian byte order are supported. SEE ALSO
btree(3), dbopen(3), mpool(3), recno(3) Dynamic Hash Tables, Per-Ake Larson, Communications of the ACM, April 1988. A New Hash Package for UNIX, Margo Seltzer, USENIX Proceedings, Winter 1991. COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. 4.4 Berkeley Distribution 1994-08-18 HASH(3)