rv6 icon indicating copy to clipboard operation
rv6 copied to clipboard

uses pthreads over spinlocks and also little revise of structures used in the code

Open kqiq opened this issue 2 years ago • 0 comments

little overview of what i changed and explanation of used structured within the code :

  • uses pthreads mutexes instead of spinlocks to synchronize access to the buffer cache and individual buffers. also removes the sleeplock functionality and replaces it with simple mutexes for simplicity. bget function returns NULL if no buffer is available rather than panicking. bread function returns NULL if the read from the disk fails or if no buffer is available. bwrite function returns a boolean indicating whether the write to the disk was successful. brelse function no longer takes a spinlock on the buffer cache before releasing the buffer lock.

  • buf structure gonna represents a buffer in the buffer cache. It stores the device and block number of the block that the buffer holds, a flag indicating whether the buffer's data is valid anda reference count indicating how many users have a reference to the buffer

  • buf_cache structure represents the buffer cache stores an array of buf structures act as a linked list of buffers sorted by how recently they were used.

  • buf_cache_init function initializes the buffer cache by initializing the mutex and creating the linked list of buffers.

hope to help ..

kqiq avatar Jan 09 '23 22:01 kqiq