[Stanford CS107] 个人笔记 Lecture 1

Lecture 1

What is Unix

a set of standards and tools commonly used in software development.

Command-line

cd
ls
mkdir
emacs
rm
man

C Programming

/*
 * hello.c
 * This program prints a welcome message
 * to the user.
 */
//Import statements
#include <stdio.h> //for printf

//Main function
int main(int argc, char *argv[]) {//Main parameters
    
    bool b = true;
    
    printf("Hello, world!\n");
    
    printf("You are in %s%d", "CS", 161); //Placeholder
    
    return 0;
}

Writing, Debugging and Compiling

emacs

make

gdb

valgrind

B&O Ch.1

1.1 Information Is Bits + Context

newline character

1.2 Translate to Different Forms

to machine-level to executable object program

Compilation system
  • preprocessor
  • compiler
  • assembler
  • linker

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-AewtCwSQ-1581932115654)(C:\Users\thinkpad\AppData\Roaming\Typora\typora-user-images\1579311666264.png)]

1.3 Why should we know compilation system

Optimizing program performance**
Understanding link-time errors
Avoiding security holes

buffer overflow vulnerabilities

1.4 Processors Read and Interpret Instructions Stored in Memory

1.4.1 Hardware Organization of a System

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-DCJGxrDu-1581932115655)(C:\Users\thinkpad\AppData\Roaming\Typora\typora-user-images\1580346667412.png)]

Buses

Transfer fixed-sized chunks of bytes known as words

The number of bytes in a word

4 bytes - 32 bits

8 bytes - 64 bits

I/O Devices

Controller

Adapter - plugs into a slot on the motherboard

motherboard: main printed circuit board

Main Memory

temporary storage device

A collection of dynamic random access memory (DRAM)

Linear array of bytes

Processor

central processing unit (CPU)

Core: PC

word-sized storage device (register)

PC: program counter (a register)

  • Read
  • Interpret
  • Perform
  • Update

Instruction set architecture

register file

arithmetic/logic unit (ALU)

CPU:

  • Load
  • Store
  • Operate
  • Jump

1.5 Caches Matter

A major goal: make copy operations faster

processor-memory gap

To deal with it: cache memories

L1 L2 L3 cache

static random access memory(SRAM)

locality

1.6 Storage Devices Form a Hierarchy

Memory Hierarchy

Cache for the next level

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-GP0C7CSM-1581932115656)(C:\Users\thinkpad\AppData\Roaming\Typora\typora-user-images\1580567851938.png)]

1.7 The Operating System Manages the Hardware

a layer of software interposed between the application program the hardware

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-uRl9wBHi-1581932115656)(C:\Users\thinkpad\AppData\Roaming\Typora\typora-user-images\1580567981063.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-5CaLnO36-1581932115656)(C:\Users\thinkpad\AppData\Roaming\Typora\typora-user-images\1580607895485.png)]

Processes

Operating system’s abstraction for a running program.

Concurrency

Context switching

Threads

The requirement for concurrency in network servers

Virtual Memory (Unix)

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Vxj6b6vK-1581932115657)(C:\Users\thinkpad\AppData\Roaming\Typora\typora-user-images\1580618309172.png)]

Program code and data
Heap
Shared libraries
Stack
Kernel virtual memory
Files

A sequence of bytes.

1.8 Systems Communicate with Other Systems Using Networks

telnet

clients and servers

1.9 Important Themes

Concurrency and Parallelism
Thread-Level Concurrency
Instruction-Level Parallelism
Single-Instruction, Multiple-Data (SIMD) Parallelism
The Importance of Abstractions in Computer Systems

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-GNs4BTZj-1581932115657)(C:\Users\thinkpad\AppData\Roaming\Typora\typora-user-images\1580631056814.png)]

Level Concurrency

Instruction-Level Parallelism
Single-Instruction, Multiple-Data (SIMD) Parallelism
The Importance of Abstractions in Computer Systems

[外链图片转存中…(img-GNs4BTZj-1581932115657)]

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值