HELLO! I AM VKS!
About ME 😝
I am a student from the 2023 cohort at Wuhan University, majoring in Software Engineering..
I am currently dedicated to building a solid foundation in computer science, such as data structures, operating systems, computer networks, and so on.
While I still have a considerable journey ahead before truly delving into the realm of computer science, I am committed to diligently advancing step by step.
Now 📆
Planning to enhance my knowledge of Python and Java during the summer break.
...
CPU性能类比理解
背景
Vcats 家有很多只小猫(CPU)。
为了衡量每只小猫的吃饭能力(性能),Vcats 买了一堆小鱼干用来测试。
假设每次测试时,Vcats 会为小猫提供一定数量的小鱼干。
每条小鱼干由一个或多个原子构成,这些原子相当于不可分割的基本指令。
小猫每口吃一个原子,及小猫每吃一条鱼干需要一口或多口,与原子数相同。
通过这个类比,我们可以形象地理解 CPU 的一些关键性能概念。
概念类比映射关系
CPU Time ↔️ 小猫吃完所有小鱼干的总用时(吃饭总时间),即 CPU 完成任务所需的总时间。
CPU Clock Cycle ↔️ 小猫吃了多少口(吃鱼的口数),即 CPU 执行多少个时钟周期来完成任务。
CPU Cycle Time ↔️ 小猫每吃一口需要的时间(每口所需的时间),即每个时钟周期的长度。
CPU Clock Rate ↔️ 小猫每秒能吃多少口(每口的频率),即 CPU 每秒执行多少个时钟周期,通常以 GHz 为单位。
Instruction Count ↔️ 每次测试时 Vcats 提供的小鱼干数量(鱼干数量),即 CPU 需要执行的指令数量。
CPI ↔️ 小猫平 ...
More RISC-V,RISC-V Functions
Review of Last Lecture
RISC Design Principles
Smaller is faster: 32 registers, fewer instructions
Keep it simple: rigid syntax
RISC-V Registers: s0-s11, t0-t6, x0
No data types, just ** **, operations determine how they are interpreted
Memory is byte-addressed
no types → no automatic pointer arithmetic
RISC-V Instructions
Arithmetic: add, sub, addi, mult, div
Data Transfer: lw, sw, lb, sb, lbu
Branching: beq, bne, bge, blt, jal, j, jalr, jr;
Bitwise: and, or, xor, andi, ori, xori
Shift ...
Introduction to Machine Language——RISC-V
BackgroundAssembly(Also known as:Assembly Language,ASM)
A low-level programming language where the program instructions match a particular architecture’s operations
Splits a program into many small instructions that each do one single part of the process
C program
1a = (b + c) - (d + e);
Assembly program
123add t1, s3, s4add t2, s1, s2sub s0, t2, t1
There are many assembly languages
A low-level programming language where the program instructions match a particular architecture’s operations ...
Floating Point
Floating PointNumber Representation Revisited
Given 32 bits (a word), what can we represent so far?
Signed and Unsigned Integers
4 Characters (ASCII)
Instructions & Addresses
How do we encode the following: —— Floating Point
Real numbers (e.g. 3.14159)
Very large numbers (e.g. 6.02×1023)
Very small numbers (e.g. 6.626×10-34)–Special numbers (e.g. ∞, NaN)
Reasoning about FractionsBig Idea: Why can’t we represent fractions? Because our bits all represent nonnegative powers of 2.
Represent ...
C-Memory Management and Usage
C Memory Layout
Stack:
grow downward
contains local variables and function frame information
Heap:
grow upward
you can request space via malloc(),realloc or calloc and use the space with pointers typically
it can be dynamically resized
Static Data:
does not grow or shrink, as this should be the same throughout the life tim of the program
holds global and static variables
Code:
does not change (though it technologically can)
this is where the program is loaded to and where the program ...
C Arrays,Strings,More Pointers
Structure definition:
Creates a variable type struct foo,then declare the variable of that type
12345struct foo { /* fields */};struct foo name1;struct foo *name2;
Joint struct definition and typedef
Don’t need to name struct in this case
typedef is a keyword that’s used to give a type or used to define the type of a new name.
1234typedef struct foo { /* fields */} bar;bar name;
C OperatorOperator Precedence
Precedence
Operator
Description
Associativity
1
++ --
S ...
C-Introduction,Pointers
Overview
Prerequisites
Official prerequisites: “Some” C experience is required before CS61C
C++ or JAVA okay
Introduction
C is not a “very high level” language, nor a “big” one, and is not specialized to any particular area of application. But its absence of restrictions and its generality make it more convenient and effective for many tasks than supposedly more powerful languages. –Kernighan and Ritchie
With C we can write programs that allow us to exploit underlying features of the arch ...
Number Representation
Number BasesAlready learned in CSAPP
Signed RepresentationsSigned Intergers
n bits => $2^n$ things– half positive, half negative?
Sign and Magnitude
“first” bit gives sign, rest treated as unsigned(magnitude)
below is an example
$000_2 = +0_{10}$
$001_2 = +1_{10}$
$010_2 = +2_{10}$
$011_2 = +3_{10}$
$100_2 = -0_{10}$
$101_2 = -1_{10}$
$110_2 = -2_{10}$
$111_2 = -3_{10}$
Zero$(0……0)_2$ and $(1……0)_2$ = $\pm0$
Most pos number$(01……1)2 ...
基础爬虫学习
说明
学习参考视频【Python+爬虫】爆肝两个月!拜托三连了!这绝对是全B站最用心(没有之一)的Python+爬虫公开课程,从入门到(不)入狱 !_哔哩哔哩_bilibili
笔记并不涵盖此系列视频中的python教学部分和html介绍部分,主要学习了Requests和BeautifulSoup库的简单使用方式(用代码和实际案例学习基本设计思路已经基本用法)
并未对相关代码做过多说明,可以结合上方链接中的视频进行实操和理解
概览可刑的注意事项
爬虫玩的好,牢饭吃的早,越学越有判头
红线
爬取公民隐私数据
爬取受著作权保护的内容
爬取国家事务、国防建设、尖端科学技术领域的计算机系统
……
温和善良虫的特点
请求数量和频率不能过高,否则就无异于DDoS攻击
DDoS攻击就是给服务器发送海量高频请求,让网站资源被耗尽,无法服务其他正常用户
如果网站做了明显的反爬限制(如登录,验证码等)不要强行突破
查看网站的robots.txt文件,了解可爬取的网站路径范围,该文件会指明哪些网站可爬,哪些不可爬,有些还会专门列出针对搜索引擎爬虫的许可范围
步骤及需学技术1. 获取网页内容 ...