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)]