720 likes | 1.08k Views
010-143 컴퓨터 원리. Warming Up! Computer Fundamentals Computer History Algorithm and Programming Internet & WWW Curriculum: School of Computer Science and Engineering. B.C. 2600 ~ A.D. 1943. Period of mechanical calculation. 1823, Babbage The automatic calculator
E N D
010-143 컴퓨터 원리 • Warming Up! • Computer Fundamentals • Computer History • Algorithm and Programming • Internet & WWW • Curriculum: School of Computer Science and Engineering
B.C. 2600 ~ A.D. 1943 Period of mechanical calculation 1823, Babbage The automatic calculator (polynomial, Diff. calculation) History of computer B.C. 2600 Origin of calculator Chinese abacus 1642, Pascal The first add-subtract calculator 1673, Leibniz The first calculator Of 4-fundamental arithmetic 1944, Harvard Univ. The first mechanical computer MARK I The Start of the modern Era
EDVAC (1950 , Pennsylvania Univ.) The first commercial computer Completion of modern computer foundation History of computer A.D. 1944~ : period of the electronic computer ENIAC (1946 , Mauchly and Eckert) EDSAC (1949 , Cambridge Univ.) • The first program built-in computer • has its own memory.. The first electronic computer electronic Numerical Integrator and Calculator
History of computer Development of computer –progress of performance, cost,size Smaller! Faster! Cheaper! • The I’st generation computer (1951-1958) • The 2’nd generation computer (1959-1964) • The 3’rd generation computer (1965-1970) • The 4’th generation computer (1971- current computer) • The 5’th generation computer (future computer)
History of computer Development of computer –progress of performance, cost,size • The 1’st generation (1950-1958) • Vacuum tube : very big size and so much heat • storage : magnetic core • Data form : punched card • Binary scale used • Example : UNIVAC1(1951) - the first business application electronic computer Vacuum tube Magnetic core UNIVAC
History of computer Development of computer –progress of performance, cost,size • The 2’nd generation (1959-1964) • transistor : 200-times small than vacuum tube , faster, more reliable • storage : magnetic core, magnetic disk , magnetic tape • Modular design of hardware • OS concept proposed • High-level programming language appeared : FORTRAN , COBOL Magnetic disk transistor Transistor computer TX - 0
History of computer Development of computer –progress of performance, cost,size • The 3’rd generation (1965-1970) • Integrated circuit(IC) : complete electronic circuit on a small chip of silicon • Time sharing technique appeared: many users use the same computer simultaneously • Data communication appeared • Software organization established : 집적회로 IC 집적회로 IBM 360
History of computer Development of computer –progress of performance, cost, size • The 4’th generation (1971-current) • Extension of 3’rd generation technology • Using LSI ,VLSI • Micro processor appeared • Personal computer(PC) spread vastly – computer popularization • Computer network and Internet spread • Virtual memory concept proposed • Database appeared <micro processor>
History of computer Development of computer –progress of performance, cost,size • Example of 4’th generation computer mini computer <1980 early PC> <multimedia computer> <super computer> <current desk-top> <current notebook>
History of computer Development of computer –progress of performance, cost,size • The 5’th generation (onward) • Intelligent computer • Expert system • Natural language
Computer architecture • Input device • Output device Processing device Storage device • Decomposing computer (1/2) Input device Output device
Computer architecture • Decomposing computer (2/2) Processing device Storage device Input device Output device • storage device • processing device Mother board
CPU (Central Processing Unit) : control center of computer • Composition of CPU Arithmetic/logic unit (ALU) - operation/calculation Control unit (CU) - data flow control
History of CPU • integrity higher, clock velocity higher, data unit longer! • classical CPU (1968-1975) : 4bit 4004, 8bit 8008 • 1’st generation CPU : 8086(1978), 8088(1979) • 2’nd generation CPU : i80286(1982) • 3’rd generation CPU : i80386(1985) • 4’th generation CPU : i80486(1989) • 5’th generation CPU : pentium(1992) , pentium MMX(1997) • 6’th generation CPU : pentiumⅡ (1997), celeron (1998 ~), pentium3 (1998 ~), XEON • 7’th generation CPU : pentium 4 (2000~), Itanium IA-64 (200?~)
386 CPU group 486 CPU pentium 286 CPU • History of CPU Pentium 3 Pentium II Itanium IA-64 celeron
Well-Known Computers 1965 1977 1998 2003 IBM System 360/50 DEC VAX 11/780 Apple iMac Pentium4 0.15 MIPS 64 KB $1M $6.6M per MIPS $16M per MB 1 MIPS(reported) 0.5 MIPS(actual) 1 MB $200K $200K to $400 per MIPS $200K per MB 700 MIPS(peak) 427 MIPS(estimated) 32 MB $1229(September 1998) $1.75 to $2.90 per MIPS $38 per MB 12600 MIPS(peak) 4697 MIPS(estimated) 256 MB $1529 $0.12 to $0.33 per MIPS $5.97 per MB
Chip Manufacturing Process Die cost + Testing cost + Packaging cost Chip cost = Final test yield
Processor Technology Trends ■1.54 X per year ▲ 1.35 X per year Source: Hennessy & Patterson Computer Architecture: A Quantitative Approach, 3rd Ed., Morgan Kaufmann, 2002 Processor performance: 1.54x per year
DRAM Technology Trends • year size cycle time • 1980 64 Kbits 250 ns • 1983 256 Kbits 220 ns • 1986 1 Mbits 190 ns • 1989 4 Mbits 165 ns • 1992 16 Mbits 145 ns • 64 Mbits 125 ns • 256 Mbits 100 ns DRAM density: 1.60x per year (4x in three years)
Transistors Per Die Trends Source: www.icknowledge.com
Hard-Disk Technology Trends Disk density: 1.50x - 1.60x per year (4x in three years) Source: IBM HDD Evolution by Ed Grochowski at Almaden
010-143 컴퓨터 원리 • Warming Up! • Computer Fundamentals • Computer History • Algorithm and Programming • Internet & WWW • Curriculum: School of Computer Science and Engineering
알고리즘 • 컴퓨터를 이용한 문제 해결 과정 • 문제 정의와 분석 • 알고리즘 고안 • 프로그램 작성 • 알고리즘: 문제 해결 방법에 대한 단계별 풀이 과정 • 프로그램: 알고리즘을 컴퓨터가 이해할 수 있는 언어로 코딩한 것 코딩 알고리즘 작성
알고리즘의 중요성 100만명을 대상으로 각자가 낸 납세액이 전체 납세액에서 차지하는 비율을 구하는 문제
알고리즘 1 1. 100만 명의 납세액을 입력 받는다. (1초) 2. 100만면중 첫번째 대상자의 납세액을 읽어 온다. (1/100만 초) 3. 100만 명의 납세액 총액을 구한다. 100만 * 1/100만 초+(100만 - 1)*1/100만 초 = 2 - 1/100만 초 4. 2의 값을 총합으로 나누어 납세 비중을 구한다. (1/100만 초) 5.아직 남은 대상자가 있으면 2~4의 과정을 반복한다. 총 소요시간 : 1+ (2 + 1/100만) * 100만 = 약 200만 2초= 555시간
알고리즘 2 1. 100만 명의 납세액을 입력 받는다. (1초) 2. 100만 명의 납세액 총액을 구한다. 100만 * 1/100만 초+(100만 - 1)*1/100만 초=2 - 1/100만 초 3. 100만명중 첫번째 대상자의 납세액을 읽어 온다. (1/100만 초) 4. 3의 값을 2에서 계산한 값으로 나누어 납세 비중을 구한다. (1/100만 초) 5.아직 남은 대상자가 있으면 3~4의 과정을 반복한다. 총 소요시간 : 1+ 2 – 1/100만 + (1/100만+1/100만)* 100만= 약 5초
프로그래밍 언어 • 기계어machine language • 컴퓨터가 직접 이해 가능한 언어 • 0과1의 조합으로 표현 • 사람이 이해하기는 복잡하고 어려움 • 00011010 0001 0010 • 어셈블리어assembly language • 0과1의 조합을 상징적인 코드로 변환하여 인간의 이해도를 향상 • 컴퓨터에서 실행되려면 결국 기계어로 변환되어야 함 • 어셈블러(Assembler)라는 소프트웨어 필요 • ADD 1, 2 • 고급언어high-level programming language • 인간이 이해하기 쉽게 만든 컴퓨터용 언어 • 역시, 기계어로 변환시켜 주는 소프트웨어가 필요 (컴파일러) • 예) FORTRAN, COBOL, PASCAL, BASIC, C, C++, Java...
프로그램 언어의 역사 ** 절차(procedural, 함수 function) 중심적인 사고 객체(object)중심적인 사고 • 구조적 프로그래밍 기법 (1970년 ~~ 1980년대 중반 이전) • 프로시져, 함수 등의 사용으로 70년대 대표적 구조적 프로그래밍기법 • ALGOL계열(PASCAL, C 등) 언어들이 대표적 • 객체지향 프로그래밍 기법 (1980년대 중반 이후) • 객체간의 상호연동을 프로그래밍으로 표현 • Smalltalk(‘83)의 등장으로 비로소 객체지향 프로그래밍 언어시대 개막 • 추상화, 캡슐화, 다형성, 동적 바인딩 등이 대표적 개념 • C++, Java
프로그램 언어의 역사 • C++ • 가장 대중적 언어인 C와 객체지향 패러다임의 만남 • C with classes C++ • 사실상 C++는 순수한 의미에서의 객체지향 언어는 아니다. 그러나 가장 대중적으로 성공한 객체지향 언어임에는 틀림없다. • Java • 선 마이크로시스템사에서 개발한 프로그래밍 언어 • 간단하고 버그가 없는 전자제품 개발이 초기의 목적 • 플랫폼 독립적이면서 분산 네트워크 지원필요 • 1994년 중반부터 웹의 인기 상승으로 브라우저 개발 • 현재는 Netscape과 Explore 모두에서 자바를 지원 • 웹상에서 에니메이션이나 고수준의 상호작용이 가능 • 프로그래밍 언어로서의 자바 • 단순, 객체지향적, 분산처리, 컴퓨터 구조에 중립적 등등
컴파일 (Compile) • 컴파일 • 고급 언어로 작성한 프로그램을 컴퓨터가 이해할 수 있고, 실행 가능한 기계어로 번역하는 과정 • 컴파일러 • 번역을 담당하는 프로그램 • 컴퓨터 기종, 운영 체제, 프로그래밍 언어에 따라 다른 종류의 컴파일러 필요
라이브러리 (Library) 컴파일 과정과 라이브러리 컴파일 작업 (컴파일러,Compiler) 링크 작업 (링커, Linker) 원시 파일 (Source Code) *.cpp 목적 파일 (Object Code) *.obj 실행 프로그램 (Executable Code) *.exe 라이브러리 : 입출력과 같이 프로그래밍에서 공통으로 많이 쓰이는 작업들을 미리 컴파일하여 목적 파일 형태로 만들어 놓은 것들의 집합
프로그램 에러와 디버깅 • 에러 종류 • 문법적 에러 (Grammatical Error) • 프로그램이 언어의 문법에 어긋나는 경우 발생 • 컴파일러가 컴파일 시 에러 정보 출력 • 논리적 에러 (Logical Error) • 프로그래머가 알고리즘을 잘못 만들었을 경우 발생 • 컴파일러가 검사할 수 없음, 실행 시 오동작 • 버그 : 논리적인 에러 • 디버깅 : 버그를 찾아 고치는 과정
소프트웨어 유지 보수 • S/W 유지 보수 비용 : 총 개발비의 80% 이상 • 유지 보수 작업 (Maintenance) • 버그를 지속적으로 수정하는 유지 보수 • 사용자의 요구 사항을 반영하기 위한 유지 보수 • 프로그램 실행 속도 향상, 프로그램 기능 추가, … • 유지 보수를 쉽게 하기 위해 • 프로그램을 쉽게 읽을 수 있는 형태로 작성 • 프로그램에 대한 문서화
C 프로그래밍 언어 • Dennis Richie • UNIX 운영 체제를 설계하면서 개발 • 프로그래머에게 편리한 도구로 설계 • 시스템 프로그래밍 언어로 사용 • 장점 • 실행 속도가 빠르다 • 이식성이 좋다 • 프로그램을 논리적인 작업 단위로 작성하고 이를 계층적으로 배치할 수 있다. • 고급언어의 특성과 저급 수준 언어의 특성을 동시에 가지고 있다.
C 언어 • C 언어에서의 함수 • 단위 작업을 수행하기 위한 명령문의 집합 • 예 • 사용자로부터 입력을 받는다. • 입력에서 오류가 없는지 확인한다. • 계산한다. • 결과를 출력한다. • 위의 명령문들을 따로 묶어 분리하고 거기에 이름을 붙인 것 • 기능 : 입력을 받아 계산을 하고 그 결과를 넘겨준다.
C 언어 여러함수의 모임 int sum(int a, int b) { ….. ….. } double avg(int a, int b) {…. } void main() { ….. sum (2,3); avg(10,20); }
C 언어 • main() • C 프로그램 내에서 반드시 정의되어야 하는 특별한 함수 • 프로그램이 실행될 때 가장 먼저 실행되는 함수 • main() 함수 내에서 다른 함수를 호출하는 식으로 프로그램이 실행된다. #include <stdio.h> main() { printf(“Hello World”); } printf() 함수는 직접 작성할 필요없음 호출하여 사용하기만 하면 됨 (Library)
사칙 연산을 수행하는 C 프로그램 #include <stdio.h> main() { int add, sub, mul, div; add = 4 + 2; sub = 4 - 2; mul = 4 * 2; div = 4 / 2; printf (“%d %d %d %d”, add, sub, mul, div); } <%d의 의미> - %d는 형식 코드로서 이 위치에 변수 값을 출력한다. - 출력하는 변수의 값은 정수임을 의미이다. - 참고 ) 실수를 출력하기 위한 형식 코드는 %f
Basic Constructs of Programming Language • 변수 (Variable) • 배열 (Array) • 연산자 (Operator) • 흐름제어 (Flow control) • 함수호출 (function call) • 조건문 (If .. Then .. Else) • 반복문 (Do..While, Repeat) • 재귀함수호출 (Recursion) • ……….
#include <stdio.h> void main() { int i; int points[5] = { 84, 82, 90, 89, 93}; for ( i = 0; i < 5; ++i ) printf(“%d “, points[i]); printf(“\n”); sorting(points, 5); for ( i = 0; i < 5; ++i ) printf(“%d “, points[i]); } Main 함수 함수 void swap(int pts[], int i, int j ) { int tmp; tmp = pts[i]; pts[i] = pts[j]; pts[j] = tmp; } void sorting(int pts[], int n) { for ( int i = 0; i < n; ++i ) { for ( int j = i; j < n; ++j ) { if( pts[i] > pts[j] ) swap(pts, i, j); } } } C program 예제 인자 배열 함수호출 반복문 함수호출
010-143 컴퓨터 원리 • Warming Up! • Computer Fundamentals • Computer History • Algorithm and Programming • Internet & WWW • Curriculum: School of Computer Science and Engineering
참고slide 인터넷 (Internet)
참고slide 전용선에 의한 통신 A B 전용선 요금 전용선 사용 양
참고slide A B 전용선 C
참고slide B E C A . . . . D F Internet Host 서로 남의 전용선 무료로사용 서로 남의 데이터 무료로 배달
참고slide Internet Host • Internet에 직접 연결되어 있다 • 전용선으로 연결되어 있다 & 항상 가동되고 있다 • “site” 혹은 “server”라고도 부른다 (보통 workstation 급 이상 또는 대형) • 고유한 host 이름을 인터넷상에서 가진다 (예: unitel) • 즉 고유한 주소(IP address)를 가진다 (예: 147.23.3.11) • 전세계 어디에서도 이 host 로 들어올 수 (access) 있다 • TCP/IP라는 인터넷 표준 통신 규약을 채택한다 • Internet Host 사용자에게 user-id를 발급한다
참고slide Internet Domain Name • 인터넷 상에서 한 개의 호스트를 지정 • 예: arts.snu.ac.kr 국가명-- jp fr ... 기관 type -- ac edu com go 기관명-- LAN 기관 내 host 명
참고slide B E C A ? D 내 PC와 Internet Host간의 통신은? 통신 선로가 (1) 기관이 설치한 LAN이면 무료 (2) 가정의 일반 전화선이면 시내 통화료 (3) Data 전용선이면 별정의 요금 ** Internet Host 간 통신료는 전세계 무료