Skip to content

Feature: Implementing a CLOCK replacer. #5

@Adarsh-Kmt

Description

@Adarsh-Kmt

We currently use an LRU Replacer in our buffer pool implementation. This issue proposes the addition of a CLOCK Replacer, modelled after the BusTub project's CLOCK replacement policy.

The CLOCK policy offers a lower-overhead, more memory-efficient alternative to LRU while approximating similar eviction behavior. This task is ideal for contributors interested in memory management and replacement policies.

The ClockReplacer struct must implement the following interface:

type FrameID int 

// keeps track of unused occupied frames.
type Replacer interface {

	// victim selects a frame to evict based on the replacement policy.
	victim() FrameID

	// insert adds a frame to the replacer, marking it as a candidate for eviction.
	insert(frameId FrameID)

	// remove eliminates a frame from the replacer, typically when the frame is pinned.
	remove(frameId FrameID)

	// size returns the current number of frames managed by the replacer.
	size() int
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions