-
항해 99 5기 TIL_22항해 99 2022. 2. 1. 01:01
▶ Today I Learned
<CS 스터디>
[컴퓨터의 구조]
가장 흔한 구조: 폰 노이만 구조, 하버드 구조
https://velog.io/@ckstn0777/%EC%BB%B4%ED%93%A8%ED%84%B0-%EA%B5%AC%EC%A1%B0
cf) 컴퓨터 상에서 버스(bus)란?
- 데이터를 통신할 수 있게 해주는 시스템
https://richong.tistory.com/92
1) 메모리
조작할 비트들의 저장소, 메모리의 기본단위는 1바이트(= 8비트)
2) I/O
Input/Output의 약자, 컴퓨터 및 주변장치에 대하여 데이터를 전송하는 프로그램, 운영 혹은 장치를 일컫는 말. 대개의 경우 입력에 함께 출력이 발생하게 되지만 키보드와 마우스처럼 입력을 위한 기기, 프린터처럼 출력에만 사용되는 기기도 있다. 프로세서와 메모리, 확장 슬롯, 마더보드에서 일어나는 데이터 전송도 I/O라고 일컬어짐.
참조: https://www.sony.co.kr/electronics/support/articles/S500082145
추후 더 자세히 배울 때 좀 더 조사해볼 예정이다.
3) CPU
Central Processing Unit, 중앙 처리 장치,
반도체 회로 크기가 줄어들면서 CPU 칩을 만드는 비용도 낮아졌다. 반도체 칩은 실리콘 웨이퍼 라는 기판 위에 만들어지는데
모든 요소가 작으면 한 웨이퍼로 더 많은 칩을 생산할 수 있기 때문이다.
CPU를 빠르게 만들고 여러 CPU를 프로세서에 활용하니 성능은 더 좋아졌다.
하지만 이로 인해 전력 장벽이라는 문제가 생긴다.
회로크기는 감소 but 기계 속도 향상 -> 시간당 전력 소모 증가 에서 단위 면적당 열 발생이 증가한다.
자꾸 열이 올라가다보니 회로를 이루는 물질의 녹는점 이상으로 온도가 올라갔다.
이를 해결하기 위해 Power = CapacityLoad x Voltage**2 x Frequency 라는 공식에 따라
전압을 낮추고 다른 요소들을 더욱 향상 시키면서 전력 소모는 줄이고 성능은 유지해왔다.
그러나 전압이 계속 낮아짐에 따라 전류가 밖으로 새어나가버리는 전력장벽이라는 현상이 발생했다.
이에 대해 새롭게 찾아낸 해결책이 바로 멀티코어 프로세서이다.
상세 설명은 하단 링크를 참조하면 쉽다.
https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=lighting12&logNo=221234933684
요즘 통용되는 CPU는 멀티코어 프로세서라고 볼 수 있다.
CPU내부에는 ALU와 실행 장치, 레지스터가 있다.
ALU(Arithmetic Logic Unit): 산술 논리 장치, 산술연산과 논리연산을 처리하는 디지털 회로
실행 장치: ALU에서 지정한 연산을 수행해주는 장치, Control Unit이라 불리는 부분에 해당
https://sites.pitt.edu/~kmram/CoE0147/lectures/datapath3.pdf
레지스터: CPU 내부에서 처리할 명령어의 결과나 주소 등을 일시적으로 기억하는 임시 기억 장소
<홈페이지 구현>
어제의 문제를 다음과 같이 해결했다.
어제의 문제 부분 코드
/* 게시글 목록 메인페이지에 넘겨주기 api */ router.get ("/showPostings", async (req,res) => { console.log(1) const postings = await postings.find() // DB에서 찾아 조회 // 당연히 이 역시도 비동기 처리를 해주어야 한다. console.log(postings) res.json ({ postings }); });
해결한 코드
/* 게시글 목록 메인페이지에 넘겨주기 api */ router.get ("/showPostings", async (req,res) => { console.log(1) const showPostings = await postings.find() console.log(showPostings) res.json ({ postings: showPostings }); });
이처럼 postings에서 찾은 결과 값을 상수에 대입할 때 그 상수의 이름을 showPostings로 아예 명확히 구분지어버렸다.
정확한 이유는 알 수 없지만 상수와 DB 스키마의 이름을 똑같이 postings로 처리해버려서 프로그램은 이를 지역적으로 똑같은 것으로
인식해버렸다 보다. 그 덕에 전역으로 설정된 아래의 DB 스키마 구문이 인식되지 못했었는데 이제 해결되었다.
const postings = require("../schemas/postings");
문제 해결 ;)
[Axios Delete]
보통 다른 Axios의 메서드들은 다음과 같이 두번째 인자( { } 부분) 에 보낼 데이터를 넣을 수 있다.
axios.put("/api/updatePostings", { new_title, new_author, new_text, id })
하지만 Delete는 그럴 수 없다.
이럴 때 활용할 수 있는 방법은 보통 url에 파라미터로 넣는 것이지만 보낼 데이터가 많을 경우 복잡해질 수 있다.
그럴 때 활용할 수 있는 방법을 아래의 링크에서 찾았다.
해당 링크처럼 두번째 인자에 {}를 넣고 그 안에 data{key:value}를 넣으니 금방 해결되었다.
여기서 의문점은 파라미터로 넘기는 방법도 해보았는데 제대로 실행되지 않았다는 것이다.
왜일까?? 우선은 구현때문에 넘어가긴 했지만 조만간 다시 알아보아야 겠다.
▶ 느낀 점
드디어 전 주차의 기본 기능을 모두 구현했다.
이제 남은 건 빠르게 강의를 듣고 필요한 구글링을 해서 로그인과 댓글 기능을 추가하는 것이다.
물론 로그인 상태 인증검사를 해야하기에 신경쓸 부분이 많지만 우선은 필요한 코드를 찾아 이해하고
조립해보아야 겠다. 강의에서도 유용한 소스를 얻어 적용해볼 예정이다.
오늘 하루도 고생많았다..!
내일도 화이팅 ;)
▶ 공부 시 참고 링크들
https://gusdnd852.tistory.com/142
https://cozy-dandelion.tistory.com/7
https://minaminaworld.tistory.com/11
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTime
https://www.zerocho.com/category/MongoDB/post/59a1870210b942001853e250
'항해 99' 카테고리의 다른 글
항해 99 5기 TIL_24 (0) 2022.02.03 항해 99 5기 TIL_23 (0) 2022.02.02 항해 99 5기 WIL_3 (0) 2022.01.30 항해 99 5기 TIL_21 (0) 2022.01.30 항해 99 5기 TIL_20 (0) 2022.01.30