logo
publist
写文章

简介

该用户还未填写简介

擅长的技术栈

可提供的服务

暂无可提供的服务

普通 C 函数、任务主动切换与任务被动切换的对比

在操作系统(OS)的语境下,Context Switch 特指“线程/任务/进程级别”的上下文切换。广义上的统一:它们本质上都在做“现场保护”如果跳出操作系统的框架,站在 CPU 硬件核心(Core) 的冷酷视角来看,这三种情况在底层逻辑上确实是同一种哲学的延伸:无论是函数调用(防寄存器冲突)、主动切换(防任务丢失)还是中断抢占(防突发打断),它们的核心动作全都是:“由于物理寄存器数量有限,为了去

#嵌入式硬件
Leetcode-22: Generate Parentheses

原题为:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[“((()))”,“(()())”,“(())()”,...

C++的二维vector和C的二维数组学习

C++的二维vector和C的二维数组学习参考了http://blog.csdn.net/zhuqinglu/article/details/1805050可通过下列代码直接创建m*n的二维vectorvector<vector <int> > ivec(m ,vector<int>(n)); //m*n的二维vector动态创建m*n的二维ve...

文章图片
Lintcode1046: Prime Number of Set Bits in Binary Reresenation

LintCode-LogoHomeAlgorithmsAICATnewVIPLanguageavatarroufooBack1046. Prime Number of Set Bits in Binary RepresentationDescriptionGiven two integers L and R, find the count of numbers in the ...

Leetcode-18: 4Sum

这题跟3Sum差不多。代码如下:#include &lt;iostream&gt;#include &lt;vector&gt;#include &lt;algorithm&gt;#include &lt;set&gt;using namespace std;vector&lt;vector&lt;int&gt

Leetcode-125: Valid Palindrome

解法1:直接用循环,两个指针。注意:1)有可能多个非数字字母符号连在一起,所以while里面还必须用while。2)while里面还必须判断i#include &lt;iostream&gt;#include &lt;string&gt;using namespace std;bool isPalindrome(string s) {int i=0, j=s.s..

Leetcode-16: 3Sum Closest

这题跟3Sum差不多,解法也差不多。我用了一个struct Record来保存那3个数,如果结果只需要输出sum,那Record也可以不用。#include &lt;iostream&gt;#include &lt;algorithm&gt;#include &lt;climits&gt;#include &lt;vector&gt;

到底了