Watchdog

linux 内核watchdog机制 Watchdog,是内核用于检测系统CPU是否锁死的机制。一旦检测到系统CPU出现锁死的情况,watchdog会主动触发系统复位。常见的CPU锁死的情况分为soft-lockup与hard-lockup,分别对应的是线程在CPU上一直得不到调度与中断在系统中得不到响应。 Soft-lockup Soft-lockup的检测原理,是内核会在每个CPU上注册一个watchdog线程,这个线程会由内核的... 阅读详情

一、简介

      软件狗。类似硬件狗,硬件狗是被动等“喂”,系统主要线程主动调用硬件接口,告诉系统本线程是正常的。但android 这种framework层中的软件狗本身是一个线程,会主动询问系统关键线程和服务是否正常。android抛弃硬件狗,大概是因为采用硬件狗的方式会使每个系统线程臃肿、复杂,且不能询问“死”的系统资源;采用软件狗的方式不仅能监视活着的线程,还能监视死的系统资源,并且将监视功能集中到一个线程上,使系统模块化更明晰,可扩展性更高。

二、原理

     1、watchdog线程会循环隔断时间询问系统线程和服务,如果某次询问发现关键线程或者是关键服务一段时间内没有应答,则会杀死SystemServer,进而诱发Zygote自杀,Zygote死亡的信号传递给init进程后,init进程会杀死所有Zygote的子进程并重启Zygote。这样手机就经历了软重启。
     2、watchdog通过给线程发送消息,如果消息被处理,则认为线程没有异常。
     3、watchdog通过获取服务的锁,如果能正确获得资源锁,则认为服务没有异常。

三、代码分析

package com.android.server;

//继承自线程,重写了run方法
public class Watchdog extends Thread {
    static final String TAG = "Watchdog";
    static final boolean localLOGV = false || false;

    // Set this to true to use debug default values.
    static final boolean DB = false;

    // Set this to true to have the watchdog record kernel thread stacks when it fires
    //是否列出kernel堆栈
    static final boolean RECORD_KERNEL_THREADS = true;
    //默认线程响应时间
    static final long DEFAULT_TIMEOUT = DB ? 10*1000 : 60*1000;
    //watchlog询问的间隔时间
    static final long CHECK_INTERVAL = DEFAULT_TIMEOUT / 2;

    // These are temporally ordered: larger values as lateness increases
    //测试结果
    static final int COMPLETED = 0;//说明系统运行良好
    static final int WAITING = 1;//说明系统有线程正在响应
    static final int WAITED_HALF = 2;//说明系统有线程响应时间超过预定等待时间的一半
    static final int OVERDUE = 3;//说明系统有线程响应超时,报错,重启

    // Which native processes to dump into dropbox's stack traces
    // 如果系统重启,则列出以下进程的堆栈
    public static final String[] NATIVE_STACKS_OF_INTEREST = new String[] {
        "/system/bin/mediaserver",
        "/system/bin/sdcard",
        "/system/bin/surfaceflinger"
    };
    //此类是单例模式
    static Watchdog sWatchdog;

    /* This handler will be used to post message back onto the main thread */
    //最重要的数据结构,HandlerChecker继承自Runnable,重写了run方法,run方法同时检测线程和服务是否正常
    final ArrayList mHandlerCheckers = new ArrayList();
    //将系统服务挂载到这个Runnable中,使用这个线程去监测服务是否正常。
    final HandlerChecker mMonitorChecker;
    //没有使用
    ContentResolver mResolver;

    ActivityManagerService mActivity;
    //电话应用特殊对待
    int mPhonePid;
    //请求用户是否重启systemserver所需要的对话框
    IActivityController mController;
    //是否允许重启systemserver
    boolean mAllowRestart = true;

    SimpleDateFormat mTraceDateFormat = new SimpleDateFormat("dd_MMM_HH_mm_ss.SSS");

    /**
     * Used for checking status of handle threads and scheduling monitor callbacks.
     */
    //包装被监视的线程
    public final class HandlerChecker implements Runnable {
        //线程句柄
        private final Handler mHandler;
        //线程名称
        private final String mName;
        //等待响应的时间
        private final long mWaitMax;
        //注册服务的数组,服务必须继承Monitor 接口,重写monitor()方法.
        private final ArrayList mMonitors = new ArrayList();

        private boolean mCompleted;
        private Monitor mCurrentMonitor;
        private long mStartTime;

        HandlerChecker(Handler handler, String name, long waitMaxMillis) {
            mHandler = handler;
            mName = name;
            mWaitMax = waitMaxMillis;
            mCompleted = true;
        }
        //注册系统服务
        public void addMonitor(Monitor monitor) {
            mMonitors.add(monitor);
        }

        //检查线程是否正常
        public void scheduleCheckLocked() {
            if (mMonitors.size() == 0 && mHandler.getLooper().isIdling()) {
                // If the target looper is or just recently was idling, then
                // there is no reason to enqueue our checker on it since that
                // is as good as it not being deadlocked.  This avoid having
                // to do a context switch to check the thread.  Note that we
                // only do this if mCheckReboot is false and we have no
                // monitors, since those would need to be executed at this point.
                mCompleted = true;
                return;
            }

            if (!mCompleted) {
                // we already have a check in flight, so no need
                return;
            }

            mCompleted = false;
            mCurrentMonitor = null;
            mStartTime = SystemClock.uptimeMillis();
            //使用线程的句柄给线程发送消息
            mHandler.postAtFrontOfQueue(this);
        }

        public boolean isOverdueLocked() {
            return (!mCompleted) && (SystemClock.uptimeMillis() > mStartTime + mWaitMax);
        }

        //给线程发送消息后的结果分析
        public int getCompletionStateLocked() {
            if (mCompleted) {
                return COMPLETED;
            } else {
                long latency = SystemClock.uptimeMillis() - mStartTime;
                if (latency < mWaitMax/2) {
                    return WAITING;
                } else if (latency < mWaitMax) {
                    return WAITED_HALF;
                }
            }
            return OVERDUE;
        }

        public Thread getThread() {
            return mHandler.getLooper().getThread();
        }

        public String getName() {
            return mName;
        }

        public String describeBlockedStateLocked() {
            if (mCurrentMonitor == null) {
                return "Blocked in handler on " + mName + " (" + getThread().getName() + ")";
            } else {
                return "Blocked in monitor " + mCurrentMonitor.getClass().getName()
                        + " on " + mName + " (" + getThread().getName() + ")";
            }
        }

        //给线程发送消息后,如果线程处理该消息,则会进入此方法
        @Override
        public void run() {
            //遍历挂载的服务
            final int size = mMonitors.size();
            for (int i = 0 ; i < size ; i++) {
                synchronized (Watchdog.this) {
                    mCurrentMonitor = mMonitors.get(i);
                }
                //调用服务重载的函数,里面一般是获取一下资源锁
                mCurrentMonitor.monitor();
            }

            synchronized (Watchdog.this) {
                mCompleted = true;
                mCurrentMonitor = null;
            }
        }
    }

    final class RebootRequestReceiver extends BroadcastReceiver {
        @Override
        public void onReceive(Context c, Intent intent) {
            if (intent.getIntExtra("nowait", 0) != 0) {
                rebootSystem("Received ACTION_REBOOT broadcast");
                return;
            }
            Slog.w(TAG, "Unsupported ACTION_REBOOT broadcast: " + intent);
        }
    }
    //需要被监视的服务,必须继承此接口
    public interface Monitor {
        void monitor();
    }
    //单例模式
    public static Watchdog getInstance() {
        if (sWatchdog == null) {
            sWatchdog = new Watchdog();
        }

        return sWatchdog;
    }

    private Watchdog() {
        super("watchdog");
        // Initialize handler checkers for each common thread we want to check.  Note
        // that we are not currently checking the background thread, since it can
        // potentially hold longer running operations with no guarantees about the timeliness
        // of operations there.

        // The shared foreground thread is the main checker.  It is where we
        // will also dispatch monitor checks and do other work.
        //此线程主要用于监视服务
        mMonitorChecker = new HandlerChecker(FgThread.getHandler(),
                "foreground thread", DEFAULT_TIMEOUT);
        mHandlerCheckers.add(mMonitorChecker);
        // Add checker for main thread.  We only do a quick check since there
        // can be UI running on the thread.
        //默认注册的线程
        mHandlerCheckers.add(new HandlerChecker(new Handler(Looper.getMainLooper()),
                "main thread", DEFAULT_TIMEOUT));
        // Add checker for shared UI thread.
        mHandlerCheckers.add(new HandlerChecker(UiThread.getHandler(),
                "ui thread", DEFAULT_TIMEOUT));
        // And also check IO thread.
        mHandlerCheckers.add(new HandlerChecker(IoThread.getHandler(),
                "i/o thread", DEFAULT_TIMEOUT));
        // And the display thread.
        mHandlerCheckers.add(new HandlerChecker(DisplayThread.getHandler(),
                "display thread", DEFAULT_TIMEOUT));
    }

    public void init(Context context, ActivityManagerService activity) {
        mResolver = context.getContentResolver();
        mActivity = activity;

        context.registerReceiver(new RebootRequestReceiver(),
                new IntentFilter(Intent.ACTION_REBOOT),
                android.Manifest.permission.REBOOT, null);
    }

    public void processStarted(String name, int pid) {
        synchronized (this) {
            if ("com.android.phone".equals(name)) {
                mPhonePid = pid;
            }
        }
    }

    public void setActivityController(IActivityController controller) {
        synchronized (this) {
            mController = controller;
        }
    }

    public void setAllowRestart(boolean allowRestart) {
        synchronized (this) {
            mAllowRestart = allowRestart;
        }
    }

    //注册服务
    public void addMonitor(Monitor monitor) {
        synchronized (this) {
            if (isAlive()) {
                throw new RuntimeException("Monitors can't be added once the Watchdog is running");
            }
            mMonitorChecker.addMonitor(monitor);
        }
    }

    public void addThread(Handler thread) {
        addThread(thread, DEFAULT_TIMEOUT);
    }
    //注册线程
    public void addThread(Handler thread, long timeoutMillis) {
        synchronized (this) {
            if (isAlive()) {
                throw new RuntimeException("Threads can't be added once the Watchdog is running");
            }
            final String name = thread.getLooper().getThread().getName();
            mHandlerCheckers.add(new HandlerChecker(thread, name, timeoutMillis));
        }
    }

    /**
     * Perform a full reboot of the system.
     */
    void rebootSystem(String reason) {
        Slog.i(TAG, "Rebooting system because: " + reason);
        IPowerManager pms = (IPowerManager)ServiceManager.getService(Context.POWER_SERVICE);
        try {
            pms.reboot(false, reason, false);
        } catch (RemoteException ex) {
        }
    }

    //遍历所有线程的响应结果
    private int evaluateCheckerCompletionLocked() {
        int state = COMPLETED;
        for (int i=0; i getBlockedCheckersLocked() {
        ArrayList checkers = new ArrayList();
        for (int i=0; i checkers) {
        StringBuilder builder = new StringBuilder(128);
        for (int i=0; i 0) {
                builder.append(", ");
            }
            builder.append(checkers.get(i).describeBlockedStateLocked());
        }
        return builder.toString();
    }

    //watchdog线程的run方法
    @Override
    public void run() {
        boolean waitedHalf = false;
        while (true) {
            final ArrayList blockedCheckers;
            final String subject;
            final boolean allowRestart;
            int debuggerWasConnected = 0;
            synchronized (this) {
                long timeout = CHECK_INTERVAL;
                // Make sure we (re)spin the checkers that have become idle within
                // this wait-and-check interval
                //给所有线程发送消息
                for (int i=0; i 0) {
                    debuggerWasConnected--;
                }

                // NOTE: We use uptimeMillis() here because we do not want to increment the time we
                // wait while asleep. If the device is asleep then the thing that we are waiting
                // to timeout on is asleep as well and won't have a chance to run, causing a false
                // positive on when to kill things.
                //睡眠一段时间
                long start = SystemClock.uptimeMillis();
                while (timeout > 0) {
                    if (Debug.isDebuggerConnected()) {
                        debuggerWasConnected = 2;
                    }
                    try {
                        wait(timeout);
                    } catch (InterruptedException e) {
                        Log.wtf(TAG, e);
                    }
                    if (Debug.isDebuggerConnected()) {
                        debuggerWasConnected = 2;
                    }
                    timeout = CHECK_INTERVAL - (SystemClock.uptimeMillis() - start);
                }

                //获取线程响应消息的结果
                final int waitState = evaluateCheckerCompletionLocked();
                if (waitState == COMPLETED) {//正常
                    // The monitors have returned; reset
                    waitedHalf = false;
                    continue;
                } else if (waitState == WAITING) {//正在响应
                    // still waiting but within their configured intervals; back off and recheck
                    continue;
                } else if (waitState == WAITED_HALF) {//响应略有延时,打印系统服务的堆栈,然后继续监测一下
                    if (!waitedHalf) {
                        // We've waited half the deadlock-detection interval.  Pull a stack
                        // trace and wait another half.
                        ArrayList pids = new ArrayList();
                        pids.add(Process.myPid());
                        ActivityManagerService.dumpStackTraces(true, pids, null, null,
                                NATIVE_STACKS_OF_INTEREST);
                        waitedHalf = true;
                    }
                    continue;
                }

                // something is overdue!
                //有线程有问题
                blockedCheckers = getBlockedCheckersLocked();
                subject = describeCheckersLocked(blockedCheckers);
                allowRestart = mAllowRestart;
            }

            // If we got here, that means that the system is most likely hung.
            // First collect stack traces from all threads of the system process.
            // Then kill this process so that the system will restart.
            EventLog.writeEvent(EventLogTags.WATCHDOG, subject);

            ArrayList pids = new ArrayList();
            pids.add(Process.myPid());
            if (mPhonePid > 0) pids.add(mPhonePid);
            // Pass !waitedHalf so that just in case we somehow wind up here without having
            // dumped the halfway stacks, we properly re-initialize the trace file.
            // 打印系统服务的堆栈
            final File stack = ActivityManagerService.dumpStackTraces(
                    !waitedHalf, pids, null, null, NATIVE_STACKS_OF_INTEREST);

            // Give some extra time to make sure the stack traces get written.
            // The system's been hanging for a minute, another second or two won't hurt much.
            SystemClock.sleep(2000);

            // Pull our own kernel thread stacks as well if we're configured for that
            // 打印kernel的堆栈
            if (RECORD_KERNEL_THREADS) {
                dumpKernelStackTraces();
            }

            // Trigger the kernel to dump all blocked threads to the kernel log
            try {
                FileWriter sysrq_trigger = new FileWriter("/proc/sysrq-trigger");
                sysrq_trigger.write("w");
                sysrq_trigger.close();
            } catch (IOException e) {
                Slog.e(TAG, "Failed to write to /proc/sysrq-trigger");
                Slog.e(TAG, e.getMessage());
            }

            String tracesPath = SystemProperties.get("dalvik.vm.stack-trace-file", null);
            String traceFileNameAmendment = "_SystemServer_WDT" + mTraceDateFormat.format(new Date());

            if (tracesPath != null && tracesPath.length() != 0) {
                File traceRenameFile = new File(tracesPath);
                String newTracesPath;
                int lpos = tracesPath.lastIndexOf (".");
                if (-1 != lpos)
                    newTracesPath = tracesPath.substring (0, lpos) + traceFileNameAmendment + tracesPath.substring (lpos);
                else
                    newTracesPath = tracesPath + traceFileNameAmendment;
                traceRenameFile.renameTo(new File(newTracesPath));
                tracesPath = newTracesPath;
            }

            final File newFd = new File(tracesPath);

            // Try to add the error to the dropbox, but assuming that the ActivityManager
            // itself may be deadlocked.  (which has happened, causing this statement to
            // deadlock and the watchdog as a whole to be ineffective)
            Thread dropboxThread = new Thread("watchdogWriteToDropbox") {
                    public void run() {
                        mActivity.addErrorToDropBox(
                                "watchdog", null, "system_server", null, null,
                                subject, null, newFd, null);
                    }
                };
            dropboxThread.start();
            try {
                dropboxThread.join(2000);  // wait up to 2 seconds for it to return.
            } catch (InterruptedException ignored) {}

            // At times, when user space watchdog traces don't give an indication on
            // which component held a lock, because of which other threads are blocked,
            // (thereby causing Watchdog), crash the device to analyze RAM dumps
            boolean crashOnWatchdog = SystemProperties
                                        .getBoolean("persist.sys.crashOnWatchdog", false);
            if (crashOnWatchdog) {
                // wait until the above blocked threads be dumped into kernel log
                SystemClock.sleep(3000);

                // now try to crash the target
                try {
                    FileWriter sysrq_trigger = new FileWriter("/proc/sysrq-trigger");
                    sysrq_trigger.write("c");
                    sysrq_trigger.close();
                } catch (IOException e) {
                    Slog.e(TAG, "Failed to write 'c' to /proc/sysrq-trigger");
                    Slog.e(TAG, e.getMessage());
                }
            }

            //弹出对话框,让用户确认是否等待
            IActivityController controller;
            synchronized (this) {
                controller = mController;
            }
            if (controller != null) {
                Slog.i(TAG, "Reporting stuck state to activity controller");
                try {
                    Binder.setDumpDisabled("Service dumps disabled due to hung system process.");
                    // 1 = keep waiting, -1 = kill system
                    int res = controller.systemNotResponding(subject);
                    if (res >= 0) {
                        Slog.i(TAG, "Activity controller requested to coninue to wait");
                        waitedHalf = false;
                        continue;
                    }
                } catch (RemoteException e) {
                }
            }

            // Only kill the process if the debugger is not attached.
            if (Debug.isDebuggerConnected()) {
                debuggerWasConnected = 2;
            }
            if (debuggerWasConnected >= 2) {
                Slog.w(TAG, "Debugger connected: Watchdog is *not* killing the system process");
            } else if (debuggerWasConnected > 0) {
                Slog.w(TAG, "Debugger was connected: Watchdog is *not* killing the system process");
            } else if (!allowRestart) {
                Slog.w(TAG, "Restart not allowed: Watchdog is *not* killing the system process");
            } else {
                Slog.w(TAG, "*** WATCHDOG KILLING SYSTEM PROCESS: " + subject);
                for (int i=0; i
linux watchdog 子系统 介绍 linux 下的 watchdog 子系统,包括了关键数据结构介绍,关键流程包括初始化、设备注册、设备文件函数、喂狗、pretimeout等流程的介绍。介绍了 softdog 的初始化、喂狗和超时机制。 阅读详情

相关推荐

网卡驱动设备watchdog-dev_watchdog

文章目录初始化开启watchdog超时处理dev_watchdog发送时间trans_start 更新usbnet驱动 网络设备watchdog用于监控网卡驱动发送数据是否异常,如果异常就报错,并调用网卡驱动提供的超时处理函数。 基本原理:网卡设备初始化时,初始化watchdog定时器,用户空间打开网卡设备时,同时开启watchdog定时器,每次watchdog定时器超时,就检查网卡设备的发送队列发送数据是否超时,如果超时报错并调用网卡驱动提供的超时处理函数。 然后重启watchdog定时器超时。 linu

osnet的博客 2758

watchdog分析(高通平台)

看门狗是一个定时器,它存在的主要目的是防止CPU跑飞导致的无法恢复的问题。它的原理是,设定一个定时时间,然后启动定时器,CPU定时去重设看门狗定时器,当定时器到期后,会直接输出信号给CPU,这个信号可以是一个CPU上的中断引脚,也可以直接输出给CPU的RST引脚。 当看门狗定时器输出的信号给到CPU的中断时,CPU一般需要以最高优先级去处理该中断,在中断处理程序中执行恢复或者重启操作;当看门狗定时...

程序猿Ricky的日常干货 1万+

uboot - 驱动开发 - dw watchdog

【代码】uboot - 驱动开发 - dw watchdog。

qazw9600的专栏 2486

有关watchdog的个人学习

android watchdog log分析

qq_43416724的博客 2290

OTP/EEPROM 读取与处理

Camera OTP/EEPROM 读取与处理 文章目录Camera OTP/EEPROM 读取与处理1. OTP概念1.1 基本概念1.2 OTP存储类型1.3 OTP烧录信息类型1.4 OTP 作用2. 配置准备2.1 基本认识2.2 OTP/EEPROM配置3. OTP/EEPROM datasheet理解 以及 读取方式3.1 data sheet 内容3.2 一般OTP/EEPROM(e...

Understand-image 1万+

时序分析28 - 时序预测 格兰杰因果关系(中) python实践1

时序分析28 - 时序预测 - 格兰杰因果关系(中) Python 实践 1 上一篇文章我们介绍了格兰杰因果关系的基本概念、背景以及相关统计检验法。本篇文章我们使用Python编程实践一下。 实践1:股票价格数据之间的格兰杰因果关系 问题:苹果公司今天的股价是否可以用来预测明天的特斯拉的股价? 数据:来自雅虎财经 import matplotlib.pyplot as plt import seaborn as sns import numpy as np import pandas as pd 读入数据

weixin_43171270的博客 8838

android Watchdog 看门狗

基于:http://blog.csdn.net/jianguo_liao19840726/article/details/16800913 SystemServer.java中的class ServerThread extends Thread 中的run方法 Slog.i(TAG, "Init Watchdog"); Watchdog.getInstance(

沈纵情 2024

STM32实战篇:使用USART发送/接收数据

在发送字符时也可以直接使用其对应的ASCLL码,例如: USART_SendData(USART1, 0x61);

qq_74114817的博客 601

什么是Watchdog?最全解释!直接贴代码!

一.什么是Watchdog? Watchdog,又称watchdog timer,是计算机可靠性(dependability)领域中一个极为简单同时非常有效的检测(detection)工具。其基本思想是针对被监视的目标设置一个计数器和一个阈值,watchdog会自己增加计数值,并等待被监视的目标周期性地重置计数值。一旦目标发生错误,没来得及重置计数值,watchdog会检测到计数值溢出,并采取恢复措施(通常情况下是重启)。总结一下就是计数——溢出——触发。 Watchdog的工作方式是事件触发的,它可以

HGJ515的博客 3万+

【电路设计】带阻滤波器实战:从理论到Twin-T陷波电路实现

本文详细介绍了带阻滤波器的原理与Twin-T陷波电路的实战应用,从基础概念到工程实现全面解析。通过具体案例展示如何设计高Q值滤波器,解决电源噪声等实际问题,并分享PCB布局和元件选型的实用技巧,助力工程师提升电路设计能力。

gg901的博客 1030

Halcon形状模板匹配实战:inspect_shape_model参数优化指南

本文深入解析Halcon形状模板匹配中inspect_shape_model参数的优化技巧,涵盖NumLevels和Contrast参数的实战应用。通过具体案例展示如何平衡匹配速度与精度,帮助开发者高效调试形状模型,提升工业视觉检测的准确性和效率。

weixin_30342209的博客 622

Watchdog是什么?为什么要在系统初始化时候关闭什么是 watchdog?

watchdog 一般是一个硬件模块,其作用是,在嵌入式操作系统中,很多应用情况是系统长期运行且无人看守,所以难免或者怕万一出现系统死机,那就杯具了,这时,watchdog 就会自动帮你重启系统。那么其是如何实现此功能的呢?那么就要简单解释一下其实现原理了。

叫好与叫座虽然不是对立面,但想在同一个作品中达到双重效果很难。 6332

Open3D (C++) 点云边界提取【2025最新版】

Compute the boundary points of a point cloud.The implementation is inspired by the PCL implementation. Reference:https://pointclouds.org/documentation/classpcl_1_1_boundary_estimation.html

点云侠的博客 876

Linux Watchdog 机制

前言 Watchdog 是 Linux 系统一个很重要的机制,其目的是监测系统运行的情况,一旦出现锁死,死机的情况,能及时重启机器(取决于设置策略),并收集crash dump. watchdog,顾名思义,看门狗。这就说明,有一个被watch的对象,和一个watch它的程序。 无论是内核watchdog,还是userland watchdog,其基本思路都是: 1. 假定某一个对象的...

ericstarmars的博客 6万+

更新|芒果YOLOv8改进182:注意力机制MLLA:即插即用|融合 Mamba 设计精髓的线性注意力视觉Transformer

芒果YOLOv8改进:即插即用,最新注意力机制MLLA:融合 Mamba 设计精髓的线性注意力视觉Transformer

包括YOLOv5、YOLOv7、YOLOv8等模型改进 870

【RT-DETR涨点改进】全网独家创新、细节涨点改进篇 | AAAI 2025 | 将 CEM 颜色增强模块引入RT-DETR ,目标检测不再惧怕雾天和低光检测、小目标检测、遥感目标检测高效涨点

本文提出了一种新型结构引导去雾网络(SGDN),通过双色引导桥(BGB)和色彩增强模块(CEM)有效解决雾霾图像去雾问题。BGB利用YCbCr空间的纹理特征引导RGB特征恢复,CEM通过聚合YCbCr通道信息增强RGB色彩感知。实验证明该方法在真实雾霾数据集上优于现有技术,能同时保持色彩准确性和纹理清晰度。文章还提供了完整的代码实现和模型配置指南,包括三种改进版RT-DETR网络结构(rtdetr-l/r18/r50-CEM.yaml),为图像去雾和目标检测任务提供了实用解决方案。

Ai缝合怪、助力小伙伴高效发论文 357

linux下的watchdog

1.1 Linux下watchdog的工作原理 Watchdog在实现上可以是硬件电路也可以是软件定时器,能够在系统出现故障时自动重新启动系统。在Linux 内核下, watchdog的基本工作原理是:当watchdog启动后(即/dev/watchdog 设备被打开后),如果在某一设定的时间间隔内/dev/watchdog没有被执行写操作, 硬件watchdog电路或软件定时器就会重新启...

ALIX的博客 3041

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

Linux下Watchdog

周 婷 (moting9@gmail.com ), 软件工程师, IBM 中国系统技术实验室 2007 年 10 月 29 日 Linux 在不同领域如电信、终端便携设备等得到广泛应用,不同领域的应用对 Linux系统也提出相应的需求。Carrier Grade Linux 是 OSDL(Open Source Development Lab)发布的电信级 Linux 的标准,在系统可用性这部分...

kunkliu的博客 1328

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

Linux内核中的Watchdog

linux /dev/watchdog softlockup hardlockup 看门狗 kvm watchdog i6300esb

weixin_44376670的博客 6560

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

hung 之 watchdog 框架

本文的 watchdog框架是指 linux内核为硬件看门狗实现的通用的喂狗机制。

专注于系统快稳省领域 1664

BIOS 中watchdog 功能实现

实际上系统下会有一个wdat_wdt驱动会对应起来,驱动会查找是否存在WDAT Table,如果存在,驱动则会加载,可看驱动源码(以Linux内核为参考,Windows可没有源码提供)。执行 ./watchdog-test -e -t 10 -p 20 使能watchdog,timeout时间是10秒,每20秒喂一次狗,这种情况下,狗就会饿死了。但是要完全理解wdt的工作方式,还需要看一些资料。驱动也加载了, 如果系统驱动正常执行,会创建设备/dev/watchdog /dev/watchdog0。

weixin_73018128的博客 1060

外置watchdog uboot喂狗

watchdog分为 cpu内置watchdog,外置硬件watchdog,软件实现watchdog。 cpu内置watchdog可以在uboot启动时关闭,这样uboot就不会受watchdog影响。 外置硬件watchdong需要以下处理,基本思路就是打开watchdog宏,定义在uboot中多次调用的hw_watchdog_reset函数。 1、u-boot-2016/common/Makefile 添加一句obj-$(CONFIG_HW_WATCHDOG) += watchdog.o ..

huzk4409的专栏 1467

watchdog(看门狗)

Linux 在不同领域如电信、终端便携设备等得到广泛应用,不同领域的应用对 Linux系统也提出相应的需求。Carrier Grade Linux 是 OSDL(Open Source Development Lab)发布的电信级 Linux 的标准,在系统可用性这部分指出 Linux 必须支持 watchdog 机制。Linux 内核从 1.3.51 版本开使提供硬件、软件 watchdog 驱

流氓D的专栏 1万+

MTK——Android watchdog with Hang Detect

framework层包含带有Hang Detect code的Android watchdog,其run方法中通过ExceptionLog类的WDTMatterJava方法调用到native层,ExceptionLog的java实现在frameworks/base/core/java/com/mediatek/aee/ExceptionLog.java中。2)nativenative层是ExceptionLog的jni实现,code在。

qq_53884337的博客 2043

watchdog 使用方法

#include <signal.h> #include <time.h> #include <sys/time.h> #include <linux/watchdog.h> #define WATCHDOG_IOCTL_BASE 'W' #define WDIOC_SETTIMEOUT _IOWR(WATCHDOG_IOCTL_B...

aaron_111的博客 1922
上一篇: opengl 摘要
下一篇: android Binder 学习
pppaass
博客等级 码龄18年 122粉丝 89原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值