[Algorithm] NP/NPC/NP-Hard

我们上课用的ppt 来自 Waterloo U. 作业来自 Berkeley。 非常难,但也很有趣。

既然 ppt 来自滑铁卢大学,那一定带有吹加拿大人的部分,比如这个提出21 个 NPC 问题的 Karp。

关于NP & NPC & NP-Hard 问题。

可以用用一个数轴来解决。

虽然不是很精确,但来说没问题。

现在来讲解一下npc。

在 MIT 的公开课 6.046 上 用了这样一个思维导图。

$(x_{1}\wedge x_{2}\wedge \not x_{3})v(x_{4}\wedge x_{5}\wedge x_{6})$

Open HPC

OpenHPC是一个Linux Foundation合作项目,其任务是集成以HPC为中心的组件,以提供功能全面的参考HPC软件堆栈。

Image
From Twitter(HPC Now!)
Image
openHPC

操作系统:Pintos Project3 详解

前情提要

老样子,代码开源在 http://victoryang00.xyz:5012/victoryang/pintos-team-20 .

这次的实现非常难,如果是课程要拿学分的话,一定要提早开始设计,一个良好的设计思维导图,在实现的时候非常有用,大概需要的是什么时候同步锁,三个 table 之间的关系是什么?在debug的时候一定要围绕着这张思维导图来,这样至少不会全不过。

我画的思维导图。

总之,本次作业要实现的功能是 disk-backed virtual memory. 进入本次的文件可以发现vm 文件夹里什么都没有,那就需要自己创建。我建了这些文件。

需要在 Makefile 里添加:

以及在 makefile.kernel 里面加入你新加的文件。

开始的悲惨境地

一开始 pintos 几乎没有任何对虚存的支持。 有的只是 process 地址和空间分离和userprog 的load。再看一看工具:

1.为了load & save 虚存分页的 swap partition

2.bitmap, 一种有点像两位哈希的数据结构,用于寻找在 swap partition 里面是否有剩余空间。

3. hashtable, 由于实现 page-frame frame-memoryLocation 之间的 O(1) 查找,极大优化性能。(此步可用linked list 代替,只不过查找变成 O(n) )

4.已经实现好的 lock acquire & lock release, 也就是说你不用管 syncronization ,只需要当黑盒api 调用就行。

5.已经全pass 的proj2. (syscall)

6. debug 工具。pintos-gdb,网上有一个更好用的 Docker-for-pintos,不过好像只支持macOS。这次大概的 debug 模式就是,先运行,看报错,如果找不到报错,就一步一步 gdb 来,看看输出某一个输出的时候会先调用什么,确定位置,一般是在 kernel mode 下锁不对的问题。然后确定程序在这个特定的位置应该运行什么,改一下先后顺序。一般调通一个就能过一片。如果你在 debug 用了过多时间,不如重新来一遍思维导图。

P.S. 这些一定要好好看懂。

心态解析&需要做的东西

为 load program binaries 实现 demand-paging,(纯 demand-paging)

为 stack pages 实现 demand-paging, (需要先分配一个frame 给第一个 stack page, 也就是上一个的特例)(写完这个就能拿到除24个testcase以外的所有分数)

stack

和NUS大牛喝咖啡 | a coffee with big giant of NUS

greatness of big giant

I would say that none of a boy in the great university with a decent research background will be a median people. For a people who get NRF in singapore after just getting his Ph.D degree (equivalent to the QianRen Proposal in China), he's just great. Talking a little bit of his CV.

He graduated from IIT Mumbai and still has great research relation with IIT Kunpur. Both of the cities I have been to. I would say most of the people in IIT is super intelligent, but for lack of money, they tend to focus on the theory and mathematical proof. No exception of him and the guy I met in CRVF-2019.

What's his strength? I think he thinks things really fast and directly to the essence. For the SAT-solver part, with the pysuedo-code, he could quickly come up with the useful testcase to test the usability. I think great man should be equipped with insight. He obviously has it. For the EEsolver, a new and fast solver to find negative false bugs in programs. He insists to test the uniformity of the benchmarks. Proof is not just the benchmarks. To find the algorithm inside, we should

ctf全国邀请赛-线下

又是一个躺的比赛,本来就i想着睡觉算了,反正都能那三等奖和那1000块。不过还是花了一点力气,最后第19名。除了清北没来,其他复旦白泽和交大王伊俊组的23333sj都来了,也算打出了一点点小名气。(去年前年因为q7,我们都是第一左右)

行,拿到题目总共一道pwn,三道web。环境开源在http://victoryang00.xyz:5012/victoryang/My_CTF_respo