自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 收藏
  • 关注

原创 hyper threading, multi-threading, cpu core

引言在这篇文章中我会主要介绍CPU相关的一些重要概念和技术。如果你想更好地了解操作系统,那就从本文开始吧。中央处理器(Central processing unit)在我们了解其它概念之前,我们应该首先了解一下什么是CPU,它是做什么的,它的主要组件以及相应的作用都是什么?简单点说,CPU其实就是计算机内部的一个电子电路。根据一些具体的指令它可以执行基本的运算,逻辑,控制和IO操作等。CPU的主要组件包括:算术逻辑单元(ALU is short for ‘arithmetic logic unit

2022-02-09 11:48:59 1319

原创 浅谈Promise in javascript

最近在上UBC CPSC 310. 在做project的时候遇到了许多promise的困难,记录此片作为我对promise的研究。所谓Promise,简单说就是一个容器,里面保存着某个未来才会结束的事件(通常是一个异步asynchronous操作)的结果。从语法上说,Promise 是一个对象,从它可以获取异步操作的消息。import * as fs from "fs-extra";fs.readFile('./hegel.txt', (err, text) => { console.lo

2021-10-06 22:59:29 211

原创 rpi4 运行u-boot.bin

rpi4 运行u-boot.bin1.先用ttl转usb的模块将树莓派与电脑连接起来2. 将Ubuntu 64 arm 版本烧入SD卡然后将拷完的sd卡插入树莓派。3.

2021-07-05 13:22:50 402

原创 memory management

今天来讲一讲memory management in C在ubc cpsc213的课程中介绍了三种ways:1. dangling pointer2. memory leak3. reference counting首先在介绍这三种方法之前,先来讲一讲dynamic malloc in Ceg. int a = malloc(sizeof(int);*malloc return 的是一个pointer也就是一个address,它会在heap上面随机创建一个4个bytes大小的memory,标

2021-05-20 22:55:23 161

原创 pointer

pass by pointervoid fn ( int * copy) { copy = new int; *copy = 10;}int main() { int *x; fn(x); cout << *x; // Whats the output?}实际他的原理是这样的int* x创建了一个pointer,然后把x pass到fn这个function

2021-01-22 21:44:04 110

原创 OOD-iterator Design

for example:for (Toy t: inventory) {}**每个foreach loop实际上是在运行以下代码**Iterator<Toy> ti = inventory.iterator();while (ti.hasNext()) { Toy t = ti.next();}(重点)但是,在每个for each loop里面,我们都不可以modifie the List or Set.比如,这个method里面,这是一个非常好的反面例子..

2020-11-30 22:45:59 89

原创 OOD-Observer Pattern

1.Make classes for abstract Subject (not necessarily abstract), and abstract Observer (typically abstract or interface). Observer通常是abstract 或者 interface。2.Put the abstract update() method into the abstract/interface Observer.3.Give the Subject a list o.

2020-11-23 20:34:01 70

原创 Object Oriented Design-coupling and cohesion

Firstly and most importantly, Designs that exhibit low coupling and high cohesion are preferred.What is coupling?Figure 1b provides an alternate design involving the same modules. In this case, module A depends upon module B which in turn depends on mod

2020-11-15 20:28:12 192

原创 Java OOD object oriented design-Composite Pattern

Composite Pattern-The pattern consists of three classes: the Composite (the node that can have children), the Leaf (no children), and the Component, which is a superclass extended by both the Composite and Leaf.-The Composite has a collection of Componen

2020-11-15 20:11:20 127

原创 Java-Liskov Substitution Principle

Liskov Substitution PrincipleIt formally states that-the preconditions of a subclass’s behaviour (methods) cannot be strengthened, meaning (among other things) that a sub-method cannot accept a narrower range of inputs than the original method.-The post

2020-11-09 19:23:29 180

原创 subclass and extends

Java looks in the declared (apparent) type of an object to see what methods are available to that object (it doesn’t matter how the object is instantiated).Java只会看apparent type, 去寻找里面的有效的methods而不是在actual type里面寻找。Example:public class Plane() { void ta

2020-10-04 13:48:42 95

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除