deer-develop / study

2 stars 0 forks source link

4장 소프트웨어와 하드웨어의 경계 #21

Open swimmingone opened 4 months ago

swimmingone commented 4 months ago

“the more purely imaginative they are, the more necessary it is to be plain”

창의적인 걸 할 때는 반드시 이해하기 쉽게 만들어야 된다. (공감)

“Machine language is the most profound interface in the computer enterprise—the fine line where hardware meets software”

“just as we say that the machine language is designed to control a particular hardware platform, we can say that the hardware platform is designed to execute instructions written in a particular machine language”

Machine language 가 프로그램(추상)과 실리콘(구체) 를 연결한다.

“Located inside the processor’s chip, the registers serve as a high-speed local memory, allowing the processor to manipulate data and instructions without having to venture outside the chip”

여기서 레지스터의 역할에 대한 설명을 보니까 캐시 메모리가 뭔가 비슷한 역할을 한다고 들은 기억이 난다. 맞나? 캐시는 아예 다른건가?

“Why not use symbolic instructions for writing programs, and then use another program—a translator—for translating the symbolic instructions into executable binary code?”

수동 스위치와 0,1로 프로그램을 작성하던 시절을 벗어나게 해준 혁신적인 발상이다!

“ the syntax of an assembly language is tightly related to the low-level details of the target hardware: the available ALU operations, number and type of registers, memory size, and so on”

우리에게 익숙한 고수준 언어들과 달리 machine language 는 하드웨어와 결합도가 높다. universal machine language 는 존재할 수 없겠구나.

“we see that symbolic references are not just a matter of cosmetics—they are used to liberate the code from unnecessary physical attachments to the host memory”

physical address vs symbolic reference.

symbolic 이 이해하기 쉽고 디버깅도 용이하지만 그게 다가 아니다. 핵심은 불필요한 의존성을 끊음으로써 프로그램을 메모리의 임의의 장소에 재배치할 수 있게 만드는 것.

myeongjae-kim commented 4 months ago

영인: CPU 부품 만들고 이제 컴퓨터 만들거다 하는데.. 이 컴퓨터 부품이 어떻게 우리가 작성한 코드를 실행할 수 있지? 에 대한 의문이 있었다. 이 장에서 그 의문을 해소한 것 같다.

컴퓨터는 진짜 0과1로 한다. 말만 들었던건데 실체를 보니까 재밌었다.

어셈블리어도 0101을 단어로 바꿔놓은 것.

앞에서 만들었던 하드웨어 세부사항은 추상화하자고 했다. reigster는 프로세서 칩 내부에 있어서 값을 조작할 때 쓴다고, 프로세서 내부의 메모리같은 역할을 한다고 나와있는데, 캐시메모리가 그런 역할을 하는게 아닌가? register가 캐시와 같은건지.

명재: register는 CPU가 계산할 때 사용할 수 있는 메모리. CPU는 계산하기 위해 register만 쓸 수 있다. memory에 있는 값을 reigster에 불러오고 그 이후에 연산을 함. 캐시메모리는 그냥 메모리라고 생각하면 된다. CPU가 계산할 때 직접 쓸 수는 없지만 일반 memory보다 속도가 훨씬 빠름. 하지만 memory다.

영인: 코드를 작성하는 코드를 만들자는 생각이 재밌었다. 이렇게 점점 쌓여서 우리가 일 할 때 쓰는 언어가 되는구나.

영인: symbolic의 역할 중 하나가 결합을 끊는것. 낮은 결합도는 어셈블리어 수준에서도 중요하다는 걸 알았다.