Screens Environment is a multi-platform component based middleware research project designed to connect technologies together and provide better user experiences for the future of computing http://sourceforge.net/projects/screensos/
Saturday, August 21, 2004
Memory Component
Good News... the API's have been locked (not modifyable untill the demo is released) and the first component has been coded. I am now working on the code of the second component.
The second component is the Memory component. The memory component takes the stream that the first component (Storage) supports and breaks it into blocks. Each block is a memory allocation which is created in the stream so it keeps throughout application launches and soft resets. The header of each memory allocation is stored at the end of the storage stream.
Header = StoreSize - 1 - (Index * HeaderSize)
The '-1' is to get the last 'address' of the stream which is always '-1' because the address is zero-based. The number of header entries is stored in the first 4 bytes of the stream. The data of each header is stored between after the 4 bytes and the last header entry.
The memory component works in an 'add-only' design. This means that if you remove a memory allocation the header data pointer is NULLed to specify that the entry is empty. No moving of allocations is done and new allocations are always allocated after the last allocation (if the last allocation was NULLed then the new allocation is written after the last 'valid' data). This allows for no moving at all of allocations in normal use. When does the system realign itself and gain all free space? When data is written and it will overrite a header entry (the data has reached the header part of the stream). All headers are compacted first and then it checks if it fits. If not it realigns all allocations. This might look like a large proccess but a few things remove the problems of this:
1. Data is only ever moved once in the realign. This is because everything is aligned from start to end.
2. Most realigning is done at the end of the stream since many of the allocations dont change thier location.
3. The Screens Environment automaticly aligns what it can when the device is turned off (mantience mode). This happens very quickly and even if you turn on your device in the middle, it stops aligning.
This might sound a CPU kill but if implemented correctly the user might never actually see a single align message if the user turns his device off many times a day and the stream is big enough. The system notifies the user if the stream needs to be made bigger.
If any of you have questions... post in the comments and I'll 'edit' the post to answer your questions. Hopefully I should finish coding the component quick so I can work on the object component (the hardest component of all).
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment