---
# System prepended metadata

title: 計算機程式Note(台大OCW)

---

計算機程式Note(台大OCW)
===

* Hardware
    * Central Processing Unit(CPU)
      > Processing: 處理器
      
    * Arithmetic and Logic Unit (ALU)
      > Arithmetic: 算數
      > Logic: 邏輯
      
    * Main Memory

        * Random Access Memory (RAM)
          > 與早期磁帶做區隔，磁帶不能Random Access 
          
        * 單位:

            * bit (b) : o跟1
            * Byte (B) : 8 bit
            * K : 2^10^
            * M : 2^20^
            * G : 2^30^
            * T : 2^40^
            
        * bit rate : 
        
            * 10^3^ bps = 1 Kbps
            * 10^6^ bps = 1 Mbps
            * 10^9^ bps = 1 Gbps
            
        * Volatile
        
    * Secondary Storage Unit
      > E.X. 硬碟、USB...
      
    * Input Unit
      > E.X. 滑鼠、鍵盤...
    
    * Network Interface

* Software
    
    * System Software
      > E.X. Opearting System
      
    * Application Software
      > E.X. PPT, Word
       
    * Programming Language
    
        * Machine Language
        
        * Assembly Language
        
        * High-Level Language

* Six Phares : 

  ![](https://i.imgur.com/ogRYucf.png)

* A skeleton Outline of a Simple C++ Program

```cpp=
// ->註解
#include <iostream>
int main (){ // main -> Function name
             
   return 0; // Statement -> ;結尾
   
} 
// {} -> Program goes here
```
* First Program in C++ : Printing a Line of Text

``` cpp=
// Fig. 2.1: fig02_01.cpp
// Text-printing program.
#include <iostream> // allows program to output data to the screen
  
// function main begins program execution
int main()
{ 
   std::cout << "Welcome to C++!\n"; // display message
  
   return 0; // indicate that program ended successfully
} // end function main
```

190226 Linux note
===

* POSIX
    * https://www.gnu.org/software/libc/manual/html_node/POSIX.html#POSIX

* OOM : 記憶體用完
* $ man mount
* $ man 

* 隨堂測驗Q1 
    * 沒有答案
    * 如何證明沒有答案？
    * 群論
* 隨堂測驗Q2
    * Timing attack (wiki)
    * SDR attack radio

* compcert
* compcert linux kernel
* [形式化驗證](https://hackmd.io/s/H1xxp3pF0)
* [軟體缺失的危害](https://hackmd.io/s/B1eo44C1-)