Someone Blog

wiki & blog

Vuepress Blog V2
My blog using vuepress theme hope.
链接名称
链接详细描述
书籍名称
书籍详细描述
文章名称
文章详细描述
伙伴名称
伙伴详细介绍
自定义项目
自定义详细介绍
Blog Update Plan

博客更新计划

该文档主要阐明后续的博客重点更新方向:

主题 进度 备注
《二分》 规划中 二分查找、二分搜索,算法、理论与应用
《DFS、BFS》 编写中 总结DFS、BFS的通用思路,题解举例
《动态规划》 规划中 总结从递归到动态规划、题解

Someone小于 1 分钟Projectsblog
页面配置

more 注释之前的内容被视为文章摘要。


Ms.Hope大约 1 分钟使用指南页面配置使用指南
Idle

Abstract

首先对于 Idle 是什么,我知之甚少,所以采用提出疑惑、回答问题的方式先进行行文,进行入门。

cpuidle_idle_call

cpuidle_idle_call is a function in the Linux kernel that is responsible for putting the CPU into an idle state when there is no work to do. The function is part of the CPU idle subsystem, which is designed to reduce power consumption by putting the CPU into low-power states when it is not in use.

When the cpuidle_idle_call function is called, the CPU idle governor selects the most appropriate idle state based on the current system workload and the capabilities of the CPU. The CPU is then put into the selected idle state, which reduces its power consumption while still allowing it to quickly resume normal operation when needed.

The cpuidle_idle_call function is called by the kernel scheduler when there is no work to do, and it is one of the key components of the Linux kernel's power management system. By efficiently managing CPU power consumption, the kernel can reduce energy usage and extend the battery life of mobile devices.


weigao大约 29 分钟Kernel
Bat Script

Basic

重命名(Move)文件夹

如果想按照日期来重命名文件夹的话,可以使用如下的方式:

for /f %%a in ('powershell -Command "Get-Date -format yyyyMMdd_HHmm_ss"') do set datetime=%%a
move anr\anr anr\anr_%datetime%

Someone大约 2 分钟Toolsscript
Arm In-line Assembly

__asm

Example[1]:

#include <stdio.h>

int add(int i, int j)
{
  int res = 0;
  __asm ("ADD %[result], %[input_i], %[input_j]"
    : [result] "=r" (res)
    : [input_i] "r" (i), [input_j] "r" (j)
  );
  return res;
}

int main(void)
{
  int a = 1;
  int b = 2;
  int c = 0;

  c = add(a,b);

  printf("Result of %d + %d = %d\n", a, b, c);
}

我们仔细研究上述的例子,可以看到,其内嵌了一条 ADD 指令,其语法如下所示:

__asm [volatile] (code); /* Basic inline assembly syntax */

其中的 code 就是我们需要内嵌的汇编代码,其中 [volatile] 是可选的,后续我们再对此进行说明。

如果将 code 展开的话,如下所示:

/* Extended inline assembly syntax */ 
__asm [volatile] (code_template 
       : output_operand_list 
      [: input_operand_list 
      [: clobbered_register_list]] 
  );

我们总共有 3 个 ”:“, 每一个后面都有不同的含义,下面对其进行具体说明。(注意 [] 符号包含住表示的是这个参数是可选的)


Someone大约 3 分钟Arm
Art GC - Part 1

本篇文章首先对 JAVA Art 中的 GC 进行一个全局性的概览,后续如果要研究技术细节等,再另起新的文章进行重点研究。

提示

本篇主要研究 ConcurrentCopying GC 的技术细节。

Forwarding Ptr

在 art 虚拟机中,FW Ptr 是一个很重要的概念,通常在 "mark and sweep" phase 中使用。

整个过程的描述大致为,gc collector 扫描存活对象和其引用的对象,确定这些对象应该继续存活还是被回收,在 mark phase 完成以后,gc collector 开始 "sweep" phase, 在这个 phase 中,会回收那些堆中没有被 "mark" 的对象(这些对象不会再被使用了);


Someone大约 8 分钟JAVAjvmGC
ART Create

Abstract

Art 的创建过程是一个很复杂的命题,所以我们单独开设一章来对这个过程进行学习。

@todo 增加全局的流程图。

Art Create

JNI_CreateJavaVM

当我们选择了 ART 运行时,Zygote 进程在启动过程中,会调用 libart.so 里面的函数 JNI_CreateVM创建一个 art 虚拟机,这个函数的实现如下:

// art/runtime/jni/java_vm_ext.cc
// JNI Invocation interface.

extern "C" jint JNI_CreateJavaVM(JavaVM** p_vm, JNIEnv** p_env, void* vm_args) {
  ScopedTrace trace(__FUNCTION__);
  const JavaVMInitArgs* args = static_cast<JavaVMInitArgs*>(vm_args);
  if (JavaVMExt::IsBadJniVersion(args->version)) {
    LOG(ERROR) << "Bad JNI version passed to CreateJavaVM: " << args->version;
    return JNI_EVERSION;
  }
  RuntimeOptions options;
  for (int i = 0; i < args->nOptions; ++i) {
    JavaVMOption* option = &args->options[i];
    options.push_back(std::make_pair(std::string(option->optionString), option->extraInfo));
  }
  bool ignore_unrecognized = args->ignoreUnrecognized;
  if (!Runtime::Create(options, ignore_unrecognized)) {
    return JNI_ERR;
  }

  // Initialize native loader. This step makes sure we have
  // everything set up before we start using JNI.
  android::InitializeNativeLoader();

  Runtime* runtime = Runtime::Current();
  bool started = runtime->Start();
  if (!started) {
    delete Thread::Current()->GetJniEnv();
    delete runtime->GetJavaVM();
    LOG(WARNING) << "CreateJavaVM failed";
    return JNI_ERR;
  }

  *p_env = Thread::Current()->GetJniEnv();
  *p_vm = runtime->GetJavaVM();
  return JNI_OK;
}

Someone大约 2 分钟JAVAjvmjava
2
3
4
5
...
15