Note : Unlike (chunk) , (chunk) will not end the reading process by resetting the internal reading state of the stream. This can cause unexpected results if () is called during a read (. from within a stream._read() implementation on a custom stream). Following the call to () with an immediate ('') will reset the reading state appropriately, however it is best to simply avoid calling () while in the process of performing a read.
In this cache organization, each location in main memory can go in only one entry in the cache. Therefore, a direct-mapped cache can also be called a "one-way set associative" cache. It does not have a replacement policy as such, since there is no choice of which cache entry's contents to evict. This means that if two locations map to the same entry, they may continually knock each other out. Although simpler, a direct-mapped cache needs to be much larger than an associative one to give comparable performance, and it is more unpredictable. Let x be block number in cache, y be block number of memory, and n be number of blocks in cache, then mapping is done with the help of the equation x = y mod n .