CS
-
[자료구조]Stack, Queue 구현CS/Data Structure 2022. 7. 26. 00:10
가장 기본적인 자료구조인 스택과 큐를 python 코드를 이용해 구현해보겠습니다. Stack 후입선출 특성의 자료구조(Last In First Out) 1. 배열을 이용한 구현 스택을 위한 배열 선언(최대 크기 설정) / index = 0 index가 선언한 배열의 크기 이상이면 stack 꽉 찬 상태 / index = 0 이면 비어있는 상태 push() : index 자리에 값 추가, index+=1 pop() : index에 위치한 값 리턴, index-=1 모든 연산의 시간 복잡도 : O(1) class arrayStack: def __init__(self): self.array = [] #maxSize 설정. self.top = -1 def isEmpty(self): if self.top==-1:..
-
[OS]경쟁 상태란?CS/OS 2022. 7. 25. 22:00
0. 들어가기 전에 경쟁 상태 : 여러 프로세스가 공유 자원에 접근할 수 있는 상태 임계 구역 : 경쟁 상태가 발생할 수 있는 코드 영역 동기화 : 임계 구역을 보호하고 이를 통해 경쟁 상태를 방지하는 것 1. 경쟁 상태란? 여러 개의 프로세스가 동일한 자료에 접근하여 조작할 때, 그 실행 결과가 접근이 발생한 특정 순서에 의존하는 상황. 경쟁 상태로부터 보호하기 위해 한 순간에 하나의 프로세스만이 변수를 조작하도록 보장해야 한다. 이를 위해 동기화가 필요하다. 2. 경쟁 상태 발생 케이스 프로세스는 자신의 데이터로 일을 수행한다. 기본적으로 프로세스간에는 메모리를 공유하지 않기 때문에 운영체제를 사용해서 일을 수행하는 경우 경쟁 상태가 발생하게 된다. 2.1 프로세스 A가 커널 모드 수행 중 conte..
-
[Network]패킷 교환과 회선 교환이란?CS/Network 2022. 7. 25. 09:05
0. 들어가기 전에 종단 시스템에서 다른 종단 시스템으로 데이터를 보내려고 한다. 송신 종단 시스템은 데이터를 세그먼트로 나눈다. 세그먼트에 헤더를 붙여 패킷을 구성한다. 패킷이 네트워크를 통해 목적지 종단 시스템에 도착하고 다시 조립된다. 패킷 교환기(스위치)는 링크에 도착하는 패킷을 받아 전달한다. 패킷 스위치의 종류에는 라우터와 링크 계층 스위치가 있다. 종단 시스템과 패킷 스위치는 다양한 프로토콜을 수행하는데 TCP, IP는 인터넷에서 가장 중요한 프로토콜이다. 소켓 인터페이스는 인터넷에 접속된 종단 시스템들은 한 종단 시스템에서 수행되는 프로그램이 다른 종단 시스템에서 수행되는 목적지 프로그램에게 데이터를 전달하는 규칙이다. 1. 패킷 교환 송신 종단 시스템에서 목적지 종단 시스템으로 메세지를 ..
-
[운영체제]Operating System Concepts - 공룡책 개념 정리(3)/ProcessCS/OS 2022. 7. 24. 20:59
1. Process Concept 초기의 컴퓨터는 작업(job)을 실행하는 시스템이었다. 이어서 사용자 프로그램(user program) 혹은 태스크(task)를 실행하는 시분할 시스템(time-sharing)이 뒤를 이었다. 1.1 Process 비공식적으로 프로세스란 실행 중인 프로그램이다. 프로세스의 현재 활동 상태는 프로그램 카운터 값과 프로세서 레지스터의 내용으로 표현한다. 프로세스의 메모리 배치는 일반적으로 여러 섹션으로 구분된다. Text section - 실행 코드 (excutable code) Data section - 전역 변수 (global variables) Heap section - 프로그램 실행 중에 동적으로 할당되는 메모리( memory that is dynamically al..
-
[Network]웹 브라우저의 주소창에 URL을 입력하면 일어나는 일CS/Network 2022. 7. 24. 20:55
브라우저가 URL을 분석한다. (HTTPS 여부, 도메인 주소, PORT 번호, 파일의 경로 등) DNS에서 IP 주소를 가져온다. 브라우저의 캐시에는 DNS 기록들이 저장되어 있다. 가장 먼저 이곳을 확인한다. OS 캐시, router 캐시, ISP 캐시 순서대로 최대한 빠르게 DNS 기록을 찾는다. 캐시 서버에 DNS 기록이 없다면 로컬 DNS 서버에서 URL 주소에 해당하는 IP 주소를 요청한다 로컬 DNS 서버에 없다면 로컬 DNS 서버가 IP 주소를 찾기 위해 루트 DNS 서버, 도메인 DNS 서버, 등 하위 DNS 서버로 차례대로 요청한다. IP 주소를 이용해 라우터에서 포워딩을 한다. 라우터의 라우팅 프로세서가 만든 라우팅 테이블을 이용한다. ARP 프로토콜을 통해 논리적인 주소인 IP 주소..
-
[Network]DNS의 동작 구조CS/Network 2022. 7. 24. 20:54
0. DNS의 동작 www.frog.blog.com을 검색한다. 대부분의 로컬 DNS 서버에 매핑이 존재한다. 만약 없다면, 루트 DNS 서버에 질문을 하고 답변이 로컬 DNS 서버에 전달된다. 하위 DNS 서버로 재귀적으로 질문과 답변을 얻으며 최종적으로 하나의 A 레코드(IP 주소)를 받는다. 이 때, DNS 캐싱을 통해 지연 성능을 향상시킬 수 있다. 1. DNS 동작 원리 중앙 집중 데이터베이스는 확장성이 없다. 무수히 많은 도메인을 매핑하기 위해 분산 계층 데이터베이스를 사용한다. 계층으로 구성된 크게 3가지 유형의 DNS 서버가 있다. 만약 DNS 클라이언트가 호스트 네임 www.amazon.com에 접속하려고 한다면 클라이언트가 루트 서버 중 하나에 접속한다. 루트 서버는 최상위 레벨 도메인..
-
[운영체제]Operating System Concepts - 공룡책 개념 정리(2) / Operating System StructuresCS/OS 2022. 7. 15. 12:35
가독성이 떨어지는 것 같아 이번 글부터는 번역이 잘 안되는 부분만 참고하기 위해 영어로 작성하겠습니다. 1. Operating-System Services An operating system provides an environment for the execution of programs. User interface 대부분의 운영체제는 UI를 갖고 있다. 인터페이스는 I/O를 지시하고 메뉴에서 선택하고 텍스트를 입력하는 등의 역할을 하는 시스템이다. 인터페이스는 다양한 형태를 가질 수 있으며 일반적으로 GUI가 사용된다. 키보드와 마우스, 터치스크린을 통해 컴퓨터에 명령을 내린다. 또 다른 인터페이스에는 command-line interface(CLI)가 있다. 사용자가 텍스트를 통해 명령을 내리는 방법이..
-
[운영체제]Operating System Concepts - 공룡책 개념 정리(1)/OverviewCS/OS 2022. 7. 15. 12:29
0. A stored-program computer stored program computer - 폰 노이만이 개발한 memory에 progrmas 저장하는 형태의 컴퓨터 program - set of instructions 1. Operating System is a software that manages a computer’s hardware. provides a basis for application progrmas acts as an intermediary(중개인) between the computer user and the computer hardware 2. What Operating Systems Do coputer system can be devided roughly into four co..