본문 바로가기
Computer Technology 기록부/코딩기록부 : C, C++

Introduction of C - Why we should learn C

by Amins 2022. 2. 28.

Why we have to learn C?

1. We can learn computer memory architecture by learning and using C.
2. Almost every computer science languages are based on C. So studying C will help to encourage your other language ability.

Basic architecture of Computer

 


CPU(Central processing unit)

 


Memory(RAM)

All data will be lost when we turn off our PC - For speed

Graphics Card

GPU - main computer in graphics card

Effective for parallel processing(Generally used in Deep learning)


Secondary storage

PC doesn't lose the data when it Turned off, but it's slow.

HDD > SSD (Speed compare) 


Operation process

All OS's are saved in secondary storage.

To use OS in CPU, OS load from secondary storage to RAM (CPU only can access data in RAM directly)


What OS(Operating System) do?

Sort of OS

 

The purpose of OS : How to handle hardware?(Connect between software and hardware)

Cordinating computer resourse, offer easy interface for user to manage it easy.


Why computer use Binary numerical system?

: Computer use transistor -> Because the one transistor can block the electricity(which means 0), or made them pass by.(which means 1).

Basic architecture of contemporary PC

System bus connect CPU and memory.

Bus? : transport data.


Architecture of memory(RAM)

Storage of data

 

 

Differences of Sequential and Random accues

Sequential access is slow(Old fassion)

 

But Random access can access everywhere so it's fast.

 

 

Cell in arcithecture

 

  • Control bus : command -> send or receive data!
  • Address bus : Tell location of data(What pointers do in C)
  • Data bus : Send data from memory to CPU (or vice versa)

How does the program start?

Must load program in secondary storage to RAM first.


Sort of computer Language

  • Assembly language : LOAD(Mnemonic), [10](address)

CPU only can recognize machine code. Have to translate high level programming language to machine code.(Auto)


Components of CPU

  • ALU : For actual calculation
  • Control Unit : control CPU work
  • Registers : Work stations. - There are many types of register. Can store some data(temporary). But quite different with memory.

How does a CPU work?

When CPU use data in RAM, it uses the address to search data.

 

Address of A = 10

Address of B = 11

 

explanation of assembly code

  • LOAD [10] : load data located in address 10
  • ADD [11] : add data located in address 11 and previous one
  • STORE [12] : store value of result in address 12

 

What does the Control unit do?

1. Tell CPU that where is start point. (some place in memory) : Need start point in program counter to start program.

 

 

2. Put start address in program counter to memoey address register.

 

3. Using the address in the memory address register, get data from memory and put it into the memory data register

4. Bring instruction(assembly code) from memory data register to current instruction register

5. Program counter get +1 (The program counter should always indicate the next address containing the next instruction.)

6. Current instruction register send instruction to Control unit to DECODE.

 

7. Control Unit decode the insruction, and put address in memory address register to conduct instruction

8. Load data in memory by refering the address in memory address register

 

9. Put value to accumulater register

 

10. Then, instruction 'LOAD 10' is done. Move to next instuction(102- ADD 11). Same process.

Before put next value to accumulater again, put value in accumulater to ALU

 

11. Put value to memory data register(4) by checking memory address register, and move to accumulater.

Lastly, put value in accumulater in ALU.

12. Put result value in ALU to accumulater again 

13. Value move to momory data register.

14. Data(value) store in memory. (using memory address in memory address register)


Data vs Information

We need to refine data to information to make it useful.


Bit Byte


Traits of C language

Effective language for hardware managing

Powerful and flexible

Programmer - oriented language

Easy to embedded to other system

Complicate to learn


7 steps for software development

1. Set a goal - why I develop this program

2. Design program

3. Write code

4. Compile

5. Run program

6. Debugging(Most important)

7. Maintain and improve program


Integrated Development Environment(IDE)

Visual studio code, Jupiter etc.

 

compiler : Translate code into machine language for computers to understand


본 내용은 따라배우는 C(a.k.a 따배시) 1~17강을 보고 정리한 내용입니다.

 

링크

https://www.youtube.com/watch?v=P9JB-4hw0KY&list=PLNfg4W25Tapyl6ahul_8VS_8Tx3_egcTI&index=18 

'Computer Technology 기록부 > 코딩기록부 : C, C++' 카테고리의 다른 글

Basic of C programming  (0) 2022.06.14

댓글