博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
对Postmaster 中 bufmgr.c 的 BgBufferSync.c 中静态变量的学习理解---saved_info_valid
阅读量:6885 次
发布时间:2019-06-27

本文共 2196 字,大约阅读时间需要 7 分钟。

开始

bool                    BgBufferSync(void)                    {                        ……                                        /*                     * Information saved between calls so we can determine the strategy                     * point's advance rate and avoid scanning already-cleaned buffers.                     */                    static           bool       saved_info_valid = false;                    static           int        prev_strategy_buf_id;            static          uint32         prev_strategy_passes;            static          int        next_to_clean;            static     uint32     next_passes;                                                    /* Moving averages of allocation rate and clean-buffer density */                    static     float     smoothed_alloc = 0;            static     float     smoothed_density = 10.0;                                ……                                        /*                     * If we're not running the LRU scan, just stop after doing the stats                     * stuff.  We mark the saved state invalid so that we can recover sanely                     * if LRU scan is turned back on later.                     */                    if (bgwriter_lru_maxpages <= 0)                    {                        saved_info_valid = false;                    return true;                }                                        if (saved_info_valid)                    {                        ……                }                    else                    {                        ……                }                                        /* Update saved info for next time */                    prev_strategy_buf_id = strategy_buf_id;                    prev_strategy_passes = strategy_passes;                    saved_info_valid = true;                                        ……                    /* Return true if OK to hibernate */                    return (bufs_to_lap == 0 && recent_alloc == 0);                }

一开始 :saved_info_valid 是 false的。

运行一次后,就会变成 true。(bgwriter_lru_maxpages <=0 的情形除外)

结束

本文转自健哥的数据花园博客园博客,原文链接:http://www.cnblogs.com/gaojian/archive/2012/11/02/2751316.html,如需转载请自行联系原作者

你可能感兴趣的文章
【模拟】洛谷 P1328 NOIP2014提高组 day1 T1 生活大爆炸版石头剪刀布
查看>>
JavaScript中的forEach
查看>>
【BZOJ】3039: 玉蟾宫 悬线法
查看>>
Clash Detection
查看>>
从CAP理论中分析Eureka与zookeeper的区别
查看>>
20172318 2018-2019-1 《程序设计与数据结构》第2周学习总结
查看>>
文件操作
查看>>
ubuntu忘记root密码解决
查看>>
windows 80端口被占用的解决方法
查看>>
Qt学习五 - 对话框
查看>>
Android 学习 笔记_12. Spinner的简单实使用
查看>>
手册与参考链接
查看>>
做错的题目——this的指向
查看>>
Struts、JSTL标签库的基本使用方法
查看>>
A Tour of Go Numeric Constants
查看>>
android获取硬件信息
查看>>
计算机操作系统的因果
查看>>
C#中int,string,char[],char的转换(待续)
查看>>
wamp环境的安装
查看>>
BZOJ 4025: 二分图
查看>>