What Is Direct Mapping?
This is also a many-to-one mapping relationship, but a main memory block can only be copied to a specific row position in the cache. The line number i of the cache and the block number j of the main memory have the following functional relationship:? i = j mod m (m is the total number of lines in the cache)? The advantage of the direct mapping method is that the hardware is simple and the cost is low. The disadvantage is that each main memory block has only one fixed row position to store, which is prone to conflicts. Therefore, it is suitable for large-capacity cache adoption.