530 likes | 667 Views
Computer Science Overview Chapter One-Data Storage. JainShing Wu. Data. What is data? Values of qualitative or quantitative variables, belonging to a set of items What is data in computer? 0 or 1 (binary digit => Bit). Data. Boolean True or False Ex: Earth is flat. ( x ) => False
E N D
Computer Science OverviewChapter One-Data Storage JainShing Wu
Data • What is data? • Values of qualitative or quantitative variables, belonging to a set of items • What is data in computer? • 0or 1 (binary digit => Bit)
Data • Boolean • True or False • Ex: Earth is flat. (x) => False Taiwan is surrounding by the sea. (O)=>True
Boolean Operation • AND OR NOT XOR
AND Operation • Designed to reflect the truth or falseness of two statements 0AND 0 0 0AND 1 0 1AND 0 0 1AND 1 1 Statement : 我會愛妳到海枯石爛 => ? False Statement 1 :我會愛妳 => True Statement 2 : 海枯 AND 石爛 => False False True
OR Operation • Designed to reflect the truth or falseness of two statements 0OR 0 0 0OR 1 1 1OR 0 1 1OR 1 1 Statement : 我會愛妳到海枯石爛 => ? True Statement 1 :我會愛妳 => True Statement 2 : 海枯 OR 石爛 => True False True
XOR Operation • Designed to reflect the truth or falseness of two statements 0XOR 0 0 0XOR 1 1 1XOR 0 1 1XOR 1 0 Statement : 我會愛妳到海枯石爛 => ? False Statement 1 :我會愛妳 => True Statement 2 : 海枯 XOR 石爛 => True False True
NOT Operation • Designed to reflect the truth or falseness of one statement NOT 1 0 NOT 0 1 Original : I will love you forever! => True Not => : I will not love you forever! => False
Flip-Flop • Circuit • Has two stable states • Used to store state information • Demonstrates how devices can be constructed from gates • Provides an example of abstraction and the usage of abstract tools
Very Large-Scale Integration (VLSI) • Contains millions of electrical components • These components are constructed on a chip • Create miniature devices containing millions of flip-flops
Representation of Bit Patterns • Text • American Standard Code for Information Interchange (ASCII) code • 1 Character (4 bits)
Representation of Bit Patterns • Number • Integer (2 bytes) • Binary (二進位→bin)→0,1 • Octal(八進位→oct)→0,1,2,3,4,5,6,7 • Decimal(十進位→dec)→0,1,2,3,4,5,6,7,8,9 • Hexadecimal(十六進位→hex) →0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F • Floating number • Float • Double
Representation of Bit Patterns • Image • Sound • Video
Text • EX: Kaohsiung =>4B 61 6F 68 73 69 75 6E 67=>0100 1011 0110 0001 0110 1111 0110 1000 0111 0011 0110 1001 0111 0101 0110 1110 0110 0111
Text • Lowercase letter in ASCII code is greater than Uppercase letter in ASCII code • Ex: a=> 61, A=> 41, space=> 20, • LF=> 0A, CR=> 0D
Text • Problem of 中文 presentation • Too many Chinese characters • 倚天中文輸入 (Big5) • Free for campus • Using two bytes for one Chinese characters • Using high bits in first byte (129-255) and low bits in second byte • EX: “中”=> A4A4
Problem of Chinese Characters • Problem of Mr. 許蓋功 • All of them has 5C in second byte • “\” used in programming language as escape character • \n 換行 (0A) • \r 歸位 (0D) • \r tab
Unicode • Consistent • Encoding • Representation • Handling of text expressed in most of the world's writing systems • UTF-8 UTF-16 UTF-32
Numbers in Computer • Binary system • Presentation • Calculation • Problem • Signed VS unsigned
Binary System • Integer (2 Bytes) • 0~65535 (unsigned) • (0000~FFFF) • -32768~32767 (signed) • The highest bit as sign bit • 0: positive, 1: negative
Binary System 12345 • EX: 1 1 0 0 0 0 0 0 0 0 1 1 1 0 0 1 192 385 48 771 86 12 24 0 3 1 6 3086 1543 6172 2 6172 2 3086 2 2 2 2 2 2 2 2 2 2 2 771 48 192 96 385 24 3 1 12 6 1543 2 12345 6172 3086 12 48 3 0 6 96 384 24 192 770 1542 12344 0 0 1 1 0 0 0 0 0 0 1 1 1 1
Negative Number Representation • 1’ complement • 2’ complement
1’ Complement • The negative number is the complement of positive number • The highest bit represent the number is positive (0) or negative (1) • EX: 12345( 0011 0000 0011 1011)-12345( 1100 1111 1100 0100) • Range • Positive (0~32767 -> 0000~7FFF) • Negative (-1~-32768 -> FFFF~8000)
Problem of 1’s complement • Zero • Positive zero and negative zero 0000 0000 0000 0000 => positive zero 1111 1111 1111 1111 => negative zero
2’ Complement • To solve the zero problem of 1’s complement • The result of 1’s complement + 1 • EX: 12345 (0011 0000 0011 1001) -12345 (1100 1111 1100 0110) 1’ complement -12345 (1100 1111 1100 0111) 2’ complement
Floating Number in Computer • IEEE 754 • (-1)S * c * bq • S: signed bit (正負號)c: significand (內容值)b: base (底)q: exponent (次方)
Floating Number Sign bit => 0
Floating Number • Single precision • 32 bits • Double precision • 64 bits
Image • Records the colors of the picture • Each dot of the picture called “pixel” • Each pixel contains the Red, Green , Blue (RGB) information
Image • Types • Raw data • Bitmap (BMP) • Compressed data • JPEG, GIF, PCX, PNG,TIFF, …
Sound file • Records the digital sound wave • Use computer to simulate the sound of the real musical instruments • Hatsune Miku plan • Using computer to simulate human singing song behaviors
Video File • Comprises a series of orthogonal bitmap digital images displayed in rapid succession at a constant rate • Frame per second (FPS) • Large amount of data
Data Storage • Memory • Mass storage • Storage on internet
Memory • A storage of related data • Types of computer memory • Read only memory (ROM) • Random accessed memory (RAM)
Read Only Memory (ROM) • Stored some necessary data • Ex : Initial program (BIOS) • Types of ROM • mask ROM • Programmable read-only memory (PROM) • Erased programmable read-only memory (EPROM) • Electrically Erasable Programmable Read-Only Memory (EEPROM)
Random accessed memory (RAM) • Dynamic random accessed memory (DRAM) • Double data rate synchronous dynamic random-access memory (DDR SDRAM) • Non-volatile random-access memory • Flash drive
Mass Storage • Store the necessary data • Types • Tape • Floppy disk • Hard disk • CDROM • Flash drive • Storage on internet
Floppy Drive Arm motor Read-write head
Floppy Disk • 1: High capacity disk • 2: Hub that engages with the drive motor • 3: Shutter • 4: Plastic housing • 5: Polyester sheet • 6: Magnetic coated plastic disk • 7: one sector of data on the disk • 8: Write protector
Hard Disk • Track • Cylinder • Sector • Head
Storage on Internet • Storage on mainframe • Storage on cloud
Storage on Mainframe • Mainframe provides large storage space to store data • Backup by mainframe manager • Fixed
Storage on Cloud • Store data on the cloud structure • Backup by the cloud manager • Data is separated into many blocks and may be stored in different places
Problem • Large amount of data => requires more storage space • Data compression
Data Compression • Reducing the storage space • Using short data to represent original one • EX: WWWWWWWWWWBBBBBWWWWWWWWWWWWWWWWWWW=>W10B5W19