Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 12th, 2008, 6:22 AM   #1
rgba
Newbie
 
Join Date: Jan 2008
Posts: 11
Rep Power: 0 rgba is on a distinguished road
an efficient way to store/lookup memory addresses?

Hey,

I'm looking for an efficient way to store memory addresses and lookup for an arbitrary memory address must be very fast.

I'm thinking along the lines of a hash table, but the range of possible memory addresses is so big that building a suitable hash table that uses the memory addresses as a key would be impossible.

Basically, I need to be able to locate an arbitrary memory address with minimal lookup time, i.e. a hash table.

Does anyone have any suggestions to this problem?

Thanks
rgba is offline   Reply With Quote
Old Feb 12th, 2008, 7:27 AM   #2
Narue
Professional Programmer
 
Narue's Avatar
 
Join Date: Sep 2005
Posts: 419
Rep Power: 4 Narue is on a distinguished road
Re: an efficient way to store/lookup memory addresses?

>hash table, but the range of possible memory addresses is so big
You're confusing a basic lookup table with a hash table. A hash table is designed so that you don't need to provide slots for the entire range of keys. A hash function takes a key and turns it into a suitable index into the table, so the size of the table is only related to the number of expected keys, not the expected range of keys.

>Does anyone have any suggestions to this problem?
I'd say go with a hash table unless there are other restrictions that you haven't mentioned.
__________________
Even if the voices aren't real, they have some pretty good ideas.
Narue is offline   Reply With Quote
Old Feb 12th, 2008, 7:29 AM   #3
rgba
Newbie
 
Join Date: Jan 2008
Posts: 11
Rep Power: 0 rgba is on a distinguished road
Re: an efficient way to store/lookup memory addresses?

Hey Narue,

Thanks for the reply. Actually, the question I wanted to ask was how to generate a function that finds the correct item in the hash table from the memory address???

Sorry for the confusion!

Thanks
rgba is offline   Reply With Quote
Old Feb 12th, 2008, 10:33 AM   #4
Narue
Professional Programmer
 
Narue's Avatar
 
Join Date: Sep 2005
Posts: 419
Rep Power: 4 Narue is on a distinguished road
Re: an efficient way to store/lookup memory addresses?

The address is your key, right? Just hash it with one of these. You'll need a collision strategy as well, but all in all it's pretty straightforward.
__________________
Even if the voices aren't real, they have some pretty good ideas.
Narue is offline   Reply With Quote
Old Feb 12th, 2008, 9:57 PM   #5
rgba
Newbie
 
Join Date: Jan 2008
Posts: 11
Rep Power: 0 rgba is on a distinguished road
Re: an efficient way to store/lookup memory addresses?

Thanks Narue, will have a look at the links!
rgba is offline   Reply With Quote
Old Feb 12th, 2008, 10:25 PM   #6
rhish.franks
Programmer
 
Join Date: Feb 2008
Location: India
Posts: 58
Rep Power: 1 rhish.franks is on a distinguished road
Re: an efficient way to store/lookup memory addresses?

Quote:
Originally Posted by rgba View Post
Hey Narue,

Thanks for the reply. Actually, the question I wanted to ask was how to generate a function that finds the correct item in the hash table from the memory address???

Sorry for the confusion!

Thanks

Hey the thing is very simple. When you will get a key i.e. address for search, it will go to the hash function. Now hash fn will give you the possible address for that, now next will be dependant on what collision handling tech you have used. i.e. either linear probing or buckets method etc., so when your hash fn returns the virtual address value, it will be passed to other fn which will search for real address by kipping in mind collision detection technic.
rhish.franks is offline   Reply With Quote
Old Feb 13th, 2008, 1:18 AM   #7
rgba
Newbie
 
Join Date: Jan 2008
Posts: 11
Rep Power: 0 rgba is on a distinguished road
Re: an efficient way to store/lookup memory addresses?

Hey rhish.franks,

Yeah, I do understand the concept of the hash function, I'm just not quite sure yet how to create a function based on the memory addresses...
rgba is offline   Reply With Quote
Old Feb 13th, 2008, 1:39 AM   #8
rhish.franks
Programmer
 
Join Date: Feb 2008
Location: India
Posts: 58
Rep Power: 1 rhish.franks is on a distinguished road
Re: an efficient way to store/lookup memory addresses?

Hey Rgba, i would suggest you to create your hash function by considering what is done in main memory management. i.e. in paging and also in demand paging. There total work is done on the basis of memory addresses only. So you can also use like that virtual address. Just consider throughly those methods, am sure you will get something useful from that.
rhish.franks is offline   Reply With Quote
Old Feb 13th, 2008, 1:54 AM   #9
rgba
Newbie
 
Join Date: Jan 2008
Posts: 11
Rep Power: 0 rgba is on a distinguished road
Re: an efficient way to store/lookup memory addresses?

Hey rhish.franks,

Thanks, I will be looking into that when I get some free time...
rgba is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hexadecimal Memory Address Question 357mag C++ 1 Jul 8th, 2007 9:19 PM
STL and memory management rwm C++ 14 Apr 10th, 2007 5:23 AM
Heap vs. Stack memory Eric the Red C++ 11 Oct 24th, 2006 6:18 PM
Virtual Memory question metsfan C 2 Apr 11th, 2006 6:47 PM
Which area of memory does new use? aznluvsmc C++ 11 Nov 5th, 2005 7:37 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:56 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC