CPU Main Memory CPUCentral Processing Unit CPU Intel






































































- Slides: 70
CPU와 주 메모리(Main Memory) CPU(Central Processing Unit) 중앙처리장치 CPU 프로그램 명령어를 실 행시키는 칩 Intel Pentium 4 Sun ultra. SPARC III 사용되는 프로그램과 데이터를 위한 주 저장공간 주 메모리 RAM © 2004 Pearson Addison-Wesley. All rights reserved 6
텍스트 표현 • 각 문자는 수로 표현된다. § 영문자, 숫자, 공백, 구둣점 • 대문자와 소문자는 별개의 문자 Hi, Heather. 72 105 44 32 72 101 97 116 104 101 114 46 © 2004 Pearson Addison-Wesley. All rights reserved 12
비트 순열(Bit Permutations) 1 bit 0 1 2 bits 00 01 10 11 3 bits 000 001 010 011 100 101 110 111 4 bits 0000 1000 0001 1001 0010 1010 0011 1011 0100 1100 0101 1101 0110 1110 0111 1111 한 비트 추가마다 가능한 순열 수가 2배 증가 ! 14
이진수/십진수 • 십진수 § 182 = 1 x 102 + 8 x 101 + 2 x 100 = 1 x 100 + 8 x 10 + 2 x 1 = 182 • 이진수 십진수 § 11012 § 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20 = § 1 x 8 + 1 x 4 + 0 x 2 + 1 x 1 = 13 • 십진수 이진수 § § 182 1 x 128 + 0 x 64 + 1 x 32 + 1 x 16 + 0 x 8 + 1 x 4 + 1 x 2 + 0 x 1 1 x 27 + 0 x 26 + 1 x 25 + 1 x 24 + 0 x 23 + 1 x 22 + 1 x 21 + 0 x 20 101101102 © 2004 Pearson Addison-Wesley. All rights reserved 16
컴퓨터 사양(Specification) • PC의 사양 예 : § § § 2. 8 GHz Pentium 4 Processor 512 MB RAM 80 GB Hard Disk 48 x CD-RW / DVD-ROM Combo Drive 17” Video Display with 1280 x 1024 resolution • 무얼 의미할까요 ? 18
저장 용량 • 모든 메모리 장치는 저장할 수 있는 용량이 있다. • 저장 용량 단위 단위 기호 바이트 수 kilobyte KB 210 = 1024 megabyte MB 220 (over 1 million) gigabyte GB 230 (over 1 billion) terabyte TB 240 (over 1 trillion) 21
CD/DVD • CD(Compact Disc) § CD-ROM은 휴대용 판독 전용 메모리(read-only memory) § CD-Recordable (CD-R) 드라이브 CD에 정보를 한번 기록 가능 § CD-Rewritable (CD-RW) 드라이브 CD에 정보를 삭제/재기록 가능 § CD 드라이브의 속도는 읽고/쓰는 속도 • DVD(Digital Video Disc) § DVD는 CD와 크기는 같지만 저장 용량은 훨씬 크다. § CD 650 MB, DVD 4. 7 GB/9. 4 GB § DVD-R, DVD-RW © 2004 Pearson Addison-Wesley. All rights reserved 24
인터넷(Internet) • 인터넷은 전지구적 WAN § Internet : internetworking § 미 국방성에서 시작 (ARPANET) § Advanced Research Projects Agency (ARPA) 35
웹(World Wide Web) • 웹 문서 작성 언어 § Hyper. Text Markup Language (HTML) • Uniform Resource Locator (URL) § 웹 상의 정보 위치 § http: //www. google. com § http: //cs. sookmyung. ac. kr/~chang § 프로토콜, 도메인, 문서 40
Lincoln. java //**************************** // Java 애플릿케이션의 기본 구조를 보여준다. //**************************** public class Lincoln { //---------------------// 대통령의 말씀을 프린트한다 //---------------------public static void main (String[] args) { System. out. println (“A quote by Abraham Lincoln: "); System. out. println (“Whatever you are, be a good one. "); } // method main } // class Lincoln © 2004 Pearson Addison-Wesley. All rights reserved 44
Java 프로그램 구조 클래스에 대한 주석 // public class My. Program { // 메쏘드에 대한 주석 public static void main (String[] args) { 메쏘드 본체(method body) 메쏘드 머리 (method header) } } 46
예약어(Reserved Words) • 미리 정의된 특별한 식별자 • Java 예약어 abstract boolean break byte case catch char class const continue default do double else enum extends false finally float for goto if implements import instanceof interface long native new null package private protected public return short static strictfp super switch synchronized this throws transient true try void volatile while 49
Lincoln 2. java //********************************** // 적법하기는 하지만 서툴게 편집된 프로그램을 보여준다. //********************************** public class Lincoln 2{public static void main(String[]args){ System. out. println("A quote by Abraham Lincoln: "); System. out. println("Whatever you are, be a good one. "); }} © 2004 Pearson Addison-Wesley. All rights reserved 51
Lincoln 3. java //********************************** // 서툴게 편집된 또 다른 적법한 프로그램을 보여준다. //********************************** public class Lincoln 3 { public static void main ( String [] args ) { System. out. println ( "A quote by Abraham Lincoln: " ) ; System. out. println ( "Whatever you are, be a good one. " ) ; } } © 2004 Pearson Addison-Wesley. All rights reserved 52
Java 번역 Java source code Java compiler Java bytecode Bytecode interpreter Bytecode compiler Machine code 58
개발 환경(Development Environment) • Java 프로그램 개발 환경 § § § Sun Java Development Kit (JDK) Sun Net. Beans IBM Eclipse Borland JBuilder Metro. Werks Code. Warrior Monash Blue. J • 편집, 컴파일, 실행 과정은 유사 © 2004 Pearson Addison-Wesley. All rights reserved 59
객체와 클래스 (개념) 객체 (실체) Bank Account John’s Bank Account Balance: $5, 257 Bill’s Bank Account Balance: $1, 245, 069 한 클래스로부터 여러 객체들 생성 © 2004 Pearson Addison-Wesley. All rights reserved Mary’s Bank Account Balance: $16, 833 68
상속(Inheritance) • 상속을 통해 한 클래스로부터 다른 클래스 유도 가능 • 상속 관계에 따라 클래스 계층구조 형성 Account Charge Account Bank Account Savings Account © 2004 Pearson Addison-Wesley. All rights reserved Checking Account 69