|
In the iteration functions of the Cache (cacheGetFirst, etc.) should we iterate also over cells with no elements (empty sets)? |
Yes.
|
Are we required to use all three ADT given in the static library (set, list and map)? |
No, it is not necessary that you use them all, but make sure that the data structure you choose to use in every place is the most suitable one. That doesn't mean that an implementation that uses only some of the ADTs is incorrect. You can ask yourself questions like the one asked in the first question in the dry part to find the best match.
|
In cacheFreeElement what should we return in case element's key is out of range? |
CACHE_ITEM_DOES_NOT_EXIST.
|
In all relevant memcache functions, what should be the return value in case the username(s) passed as argument(s) is NULL? |
You should return USER_NOT_FOUND or ILLEGAL_USERNAME (according to the function).
|
What should be the return value of memCacheFree in case the pointer passed points to NULL? |
MEMCACHE_BLOCK_NOT_ALLOCATED.
|
Are memcache allocations of size 0 possible? |
No. In such case memCacheAllocate should return NULL.
|
What is the difference between cache b that stores the "addresses" of the blocks, and cache a that stores the "blocks themselves"? |
It's up to your implementation. One option is that cache 'a' contains pointers to blocks, while in cache 'b' pointers to addresses of blocks (pointers to pointers to blocks) are stored. There is another option where cache 'b' contains just pointers to blocks, but in this kind of implementations it might be harder and unintuitive to manipulate cache 'b' (especially when trying to move a specific block from cache b to cache a).
|
What you mean by the "key" of an element in the cache? |
The key of every element in the cache can be computed by the compute_key function passed to cacheCreate. The key of an element is the index (between 0 and size-1) of the set where the element should be in the container array. For example, all elements with key=0 can be found in the first set (index 0) in the cache.
|
How should the system behave in case a user tries to add or remove himself from the group of users he himself trusts? |
The relevant functions should return MEMCACHE_SUCCESS in these cases, but of course it would be meaningless. No matter what permission mode a block is in (U G or A), its owner must be able to free it.
|
Under the MakeFile section in the PDF, it can be understood that my_set_test.c must be in the tests folder. Is this the situation? |
No. my_set_test.c should be found in the my_set folder, and the MakeFile should assume it's there.
|
What does mapGet returns? the element itself or a copy of it? |
The element itself.
|
In which order should the iteration functions of memcache iterate over the blocks? |
The iteration functions should pass over the blocks in the order they appear in each of the caches. This means for example, that the iteration over free blocks should begin with all blocks with size 0, then pass over all blocks with size 1, etc. In the case of allocated blocks, the order will be defined by the modulo 2^16. The order between blocks with the same key (blocks which are stored in the same set in the cache) does not matter.
|
What happens to the iterator when user remove or inserts blocks to memcache? |
The iterator in this case is undefined - meaning users cannot assume anything about its state, and about the return value of the iteration functions (except getFirst of course).
|
When testing the submission folder, will you add test_utilities.h anywhere? |
Yes, we will add it to the tests folder. It's your responsibility to have it anywhere else in your submission folder.
|
Can we store copies of the blocks in the cache? |
No. The blocks themselves must be stored in both caches.
|
In the memcache ADT, what should be the return value in case the function fails and there are two or more possible results? |
Return the first result following the order they appear in the PDF.
|
Where should the execution files generated by the makefile (all *_test files) be? |
In the main submission directory.
|
|