Deciding whether to get a buffer cache block or inode block

I was reading a book on UNIX internals "The design of the UNIX Operating system." There are two memory structures that are confusing me:
1) Buffer cache
2) Inode cache

My questions are
1) Does a process get both buffer cache and Indoe cache allocated when it opens/creates a file?
2) if no, then when does a process decide that it requires a buffer cache or/and inode cache

pls provide any pointers regarding the information on the above questions.

Cache is not technically needed. It's not like a file handle, where you must have one to do anything. It's just a copy of data held in memory in case you need to read it again, which makes future accesses much faster.

Caches are a kernel thing, not a process thing. The kernel decides what things should be cached, not the process, and the caches reside in the kernel, not the process. Usually, caches are a fairly ephemeral thing. If you need to allocate more memory and the memory's full of cache, piff, the kernel throws some Not Recently Used cache away and gives you the memory.

"buffer" is a vague term. I presume it's talking about file buffers?

Inode caches cache inodes, file buffers cache file contents. To stat() a file you are reading its inode, when you read() from a file you are getting its contents.

1 Like