edited by
271 views
0 votes
0 votes
Qn 70. Which of the data structure is not suitable for building a cache?

(A) File

(B) Linked List

(C) Arrays

(D) All of the above

(E) None of the above
edited by

1 Answer

0 votes
0 votes

Here are the few helpful links I have come across related to this question:

Link 1

Link 2

Link 3

Link 4

Reading them I have reached to a conclusion that the data structures in the order of  "Array > Doubly Linked list > Singly Linked list > File", is better in terms of suitability towards building a cache,

Ans (a)

Reason:

File structure is not suitable for building a cache. File structure is used for data storage, access and retrieval in the disk. Most popular disk organization techniques like B-Tree, B+ Tree are inefficient for cache implementation since they use pointers for indexing tree nodes and leaf nodes.

Singly Linked lists are inefficient way of building a cache. While doubly linked lists are more efficient compared to singly linked lists.

Linked structures like linked lists or trees are generally not friendly to modern processors, because for large data structures that do not fit in cache, following each link usually requires loading a new cache line. Lists have a lot of pointers. Short lists will fit into cache, but long lists won't. So storing large sets in lists tends to result in a lot of cache misses

Arrays are the most efficient way of implementing a cache. It uses locality of reference (mainly spatial) to fill a cache lines. Therefore, results in lesser number of cache misses.

Kindly correct me if I am wrong,

edited by

Related questions

0 votes
0 votes
2 answers
1
Ritwik asked May 18, 2017
306 views
Qn. 68 Which of the data structure is suitable for implementing a buffer to file?(A) File(B) Linked List(C) Array(D) All of the above(E) None of the above
1 votes
1 votes
1 answer
2
Ritwik asked May 18, 2017
461 views
Q 69. Which data structure is used to implement a request handler in a web server?(A) Stack(B) Queue(C) Arrays(D) All of the above(E) None of the above
1 votes
1 votes
0 answers
3
Gunjack asked Oct 5, 2018
349 views
As a Mechanical Engineering graduate I decided to pursue M.Tech in Computer Science.Can I apply for PSU after completing M.Tech in Computer Science branch?I have heard so...