Data Structure for Module Storage
Posted: Sun Aug 25, 2013 3:15 pm
I'm identifying modules like this:
<type> <class> <subclass> <bus> <vendorID> <deviceID>
The reason for this format is that when a bus driver, such as PCI or USB, finds a new device, it needs to look up this device driver in my OS's "module registry" based on it's vendor ID and device ID.
I need to find an efficient way to store the loaded modules in memory. When a new volume is connected to the VFS, the VFS has to search through the list of FS drivers that have been loaded. The same thing is done when a file is executed, the kernel has to figure out what executable format to use. I need to be able to find lists of modules that have a specific type, class, subclass, bus, vendorID, or deviceID. What do you think is the fastest data structure I can use for this purpose? What is the most memory efficient? It seems very slow to have a list of modules and search through them. It also seems memory inefficient to have dynamic lists or linked lists preallocated for every level of the hierarchy (as in having arrays of lists of pointers to all modules of each type, class, subclass, etc.)
<type> <class> <subclass> <bus> <vendorID> <deviceID>
The reason for this format is that when a bus driver, such as PCI or USB, finds a new device, it needs to look up this device driver in my OS's "module registry" based on it's vendor ID and device ID.
I need to find an efficient way to store the loaded modules in memory. When a new volume is connected to the VFS, the VFS has to search through the list of FS drivers that have been loaded. The same thing is done when a file is executed, the kernel has to figure out what executable format to use. I need to be able to find lists of modules that have a specific type, class, subclass, bus, vendorID, or deviceID. What do you think is the fastest data structure I can use for this purpose? What is the most memory efficient? It seems very slow to have a list of modules and search through them. It also seems memory inefficient to have dynamic lists or linked lists preallocated for every level of the hierarchy (as in having arrays of lists of pointers to all modules of each type, class, subclass, etc.)