📄 clock.java
字号:
/* File Clock.java */package bufmgr;/** * A clock algorithm for buffer pool replacement policy. It picks up the frame * in the buffer pool to be replaced. This is the default replacement policy. */class Clock extends Replacer { /** * Creates a clock object. * * @param javamgr * the buffer manage to be assigned to. */ public Clock(BufMgr javamgr) { super(javamgr); } /** * Picks up the victim frame to be replaced according to the clock * algorithm. Pin the victim so that other process can not pick it as a * victim. * * @return -1 if no frame is available, head of the list otherwise. * @throws BufferPoolExceededException * @throws PagePinnedException */ public int pick_victim() throws BufferPoolExceededException, PagePinnedException { // type your code here // Note: readability of your code will be considered during marking return 0; // replace it by your code } /** * Returns the name of the clock algorithm as a string. * * @return "Clock", the name of the algorithm. */ public final String name() { return "Clock"; } /** Displays information from clock replacement algorithm. */ public void info() { super.info(); System.out.println("Clock hand:\t" + head); System.out.println("\n\n"); }} // end of Clock
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -