Hi there,
I just want to hear from you about an idea came to me before starting implementing it..
I just want to use the same algorithms, functions, .. of memory management for secondary storage..
I use bitmap based memory management (the most easy and the less efficient .) Can't I a bitmap for harddisk storage and just use the same function I've already made?
That will be just for beginning, I will, of course, make an efficient file system later.. But I need filing get done these days..
Thanks in advance
Memory management functions for secondary storage..
- mahmoudaladawi
- Posts: 13
- Joined: Wed Jul 21, 2010 8:31 pm
- Location: Egypt.
- Contact:
Memory management functions for secondary storage..
Mahmoud Eladawi
- mahmoudaladawi
- Posts: 13
- Joined: Wed Jul 21, 2010 8:31 pm
- Location: Egypt.
- Contact:
- DavidCooper
- Member
- Posts: 1150
- Joined: Wed Oct 27, 2010 4:53 pm
- Location: Scotland
Re: Memory management functions for secondary storage..
You can do a lot better than that for very little effort. For floppy disk storage I use a bytemap with each byte linking to a sector, so I can save 255 different files to a disk just by giving each file a different byte value and putting the value for a file in all the bytes which map to sectors containing that file's data. You could do the same for a hard disk using two bytes each time instead of one, thereby allowing up to 65535 files to be stored on it without needing complicated code to load and save them. Later on you can write some code to defrag your files and convert the directory to a standard format.
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c
MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming
MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming
- mahmoudaladawi
- Posts: 13
- Joined: Wed Jul 21, 2010 8:31 pm
- Location: Egypt.
- Contact:
Re: Memory management functions for secondary storage..
@DavidCooper: NiceIdea, but won't that consume enormous amount of memory..? even we did that for block consisting of more than a sector.
Thanks.
Thanks.
Mahmoud Eladawi
- DavidCooper
- Member
- Posts: 1150
- Joined: Wed Oct 27, 2010 4:53 pm
- Location: Scotland
Re: Memory management functions for secondary storage..
Process it in chunks. You only need to load as much of the directory necessary to find enough free pairs of 0 bytes to save your file. For loading files back in from disk you could save time by using a simple trick - cut the maximum number of files in half and use the most significant bit to indicate the final sector of a file so that you know that it's all been loaded once you've got that far.
Edit: You could also keep a list of the first sector number for each file so that you can jump straight to the first sector every time, and also store the sector number of the first empty sector somewhere. Later on you can add a filename list too (stored in filenumber order and with fixed-length names), increasing the functionality of the system whenever accessing your files gets sufficiently difficult to motivate you to get round to doing it.
Edit: You could also keep a list of the first sector number for each file so that you can jump straight to the first sector every time, and also store the sector number of the first empty sector somewhere. Later on you can add a filename list too (stored in filenumber order and with fixed-length names), increasing the functionality of the system whenever accessing your files gets sufficiently difficult to motivate you to get round to doing it.
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c
MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming
MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming