Year 1

Week 5 #CPU Architecture#

Welcome!

Last week we stepped into the core of computer. We learnt about how CPU works, functions of CPU, ALU, CU, and registers. We also studied about knowledge associated with CPU. We also learnt to write assembly language last week in order to be familiar with machine instruction cycle. It is a fun week. 

Input, Process, Storage, and Output Concept

Input – process – output is the model used by all computers. A computer receives an input, processes the instructions, and then performs an output. It could be described as putting information in the computer, doing something with the information, and exhibits the results. Storage is where data is kept once the computer is turned off. For example, when toasting a slice of bread by a toaster, input is a slice of bread, process is the procedure to cook the bread, and the output is the final toast. 

Main components of a CPU

CPU is the main part of a computer. The CPU (Central Processing Unit) sends signals to other part of a computer which works just like a human brain. It is the electricity circuitry within a computer that carries out the instructions of a computer program by performing the basic arithmetic, logical, IPO instructions. ALU (Arithmetic Logic Unit) and CU (Control Unit) are two main parts of CPU. There are also registers in a CPU. ALU is the core of CPU. ALU does all arithmetic and local calculations. CU is responsible for giving commands to all other components in a CPU and decoding instructions. Registers are small, fast, and temporary storage of data embedded in a CPU. 

cpu

RAM (Random Access Memory) is the physical hardware inside a computer where temporarily stores the operative system, application programs and data in current use since starting up. There are four types of data stored in RAM which are address, number, letter, and instruction. RAM is a volatile memory which means that it will lose data if power is lost. 

ROM (Read Only Memory) is a type of non-volatile (permanent) memory which contains programming needed to start a computer—essential for booting-up. ROM is read-only, it could not be changed. 

RAM ROM
Temporary storage Permanent storage
Volatile Non-volatile 
Faster  Slower 
Larger capacity  Smaller capacity 
Primary memory  Primary memory 

Cache is a small, high-speed access area memory embedded in a computer to hold frequently used data. It is a SRAM (static Radom Access Memory). There are three levels of cache which are Level 1 (L1), Level 2 (L2), Level 3 (L3). L1 is embedded inside a CPU, while L2 and L3 are embedded between CPU and RAM. However, L2 and L3 have larger capacity but longer time to access compared with L1. Cache Hit means that when CPU looks for data, it successfully finds the data inside cache. Under this circumstance, data will be sent to CPU. If CPU does not find data in cache, it will fetch from RAM, then data will be written to the cache and sends back to CPU. This procedure is called Cache Miss. 

RAM Cache
Primary memory  Primary memory 
Volatile  Volatile 
Slower Faster
Outside CPU L1 inside CPU, L2 & L3 between CPU and RAM

There are different types of registers embedded inside a computer which play important roles. MAR (Memory Address Register) stores addresses that recently be written or read by CPU in main memory. MDR (Memory Data Register) is a two-way register. It stores data fetched from memory and data waiting to be stored in memory. Instruction Register stores instruction fetched from memory that has currently been decoded by CU. Program Counter stores the address of the next instruction. Accumulator holds the immediate result of ALU. 

Here is a picture of an exercise we have done during the class in order to be familiar with the components in CPU and each functions. First it was really difficult to remember because there are many similar terms with totally different functions. After practicing several times, it became easier. 

regi

Summary of the video 

During the class, we also saw a video to have a basic knowledge of computer. Here is the summary of the video. 

CPU (central processing unit) is like the brain of a computer. Clock is a particular wire that turns on and off at a steady rate to help keep everything in sync. CPU fits into motherboard. Motherboard permits all the components in a computer to associate with each other. 

RAM is on the right of the motherboard which stores information temporarily and could be accessed directly. Normally data is accessed in order, even though it can be accessed randomly when needed. When computer starts to run a program, it sends an address to RAM to retrieve that program. CPU turns on enable wire and then RAM sends all data on that address back to CPU. When it stops the first program, it will sends another address to RAM. When CPU needs to save data to RAM, it outputs an address and some data. Then it turns on set wire. RAM will rewrite the data at that address with new data. Data in RAM could be instructions, numbers, letters, and addresses. There are LOAD, ADD, STORE, COMPARE, JUMP IF, JUMP, IN, and OUT instructions. COMPARE instruction can be very useful when used in conjunction with JUMP IF instructions which checks a certain condition is true, which actualize randomly access data from RAM. 

There is control unit inside CPU which receives orders from RAM in the form of an instruction, and it will break it down into commands for other components. One important unit is ALU (arithmetic logic unit) which performs all mathematical operations inside CPU, like addition and subtraction. There are two inputs of ALU. CU receives instruction from RAM and then give commands to ALU about what type of operation to perform. Then ALU will perform the operation and output the result. Flags will tell CU what to do when receive next instruction.

Bus is a group of wires connected multiple components inside a computer. Four registers on the top only store numbers for operations. Instruction register stores the instructions which does not need enable wire. Eventually instruction address will get to RAM but there is an intermediary register called instruction address register. It will tell RAM what the address of next instruction. 

The video gives us a hint of how CPU works and the basic functions of each components in a CPU. This video is simple but easy to understand. I highly recommend computer science beginners to watch this video. 

Primary and secondary memory 

th

Primary memory is the memory that is directly accessed by the CPU to store and retrieve information, like ROM, RAM, Virtual memory, and Cache. Secondary memory is a storage device that is not accessible directly by the CPU and used as a permanent storage device that retains data even after the power is turned off, like DVD/CD, HDDs/ SSDs, Flash. Virtual memory allows a computer to compensate for physical memory shortages by temporarily transferring data from random access memory to disk storage. 

In order to memorize the difference between primary memory and secondary memory, we also did an activity during the class. 

primary

The key to improving computer processing speed is to allow data to flow through the processor as fast as possible. Cache needs less amount of time the processor spends waiting for data in order to reach the goal. If cache hits occur, it will reduce the amount of time to fetch data. The larger cache memory of L2 and L3 are the faster CPU can fetch data because it will minimize cache misses. 

The need for persistent memory

Primary memory is temporary memory and it is volatile which means that data will lose if the power is off. While secondary memory is permanent memory, it is non-volatile. Without persistent memory, there will be constant data loss. Without secondary memory, the computer could only process basic operations which could input data every time when used. As a result, the computer could not operate properly with only primary memory, and persistent memory is needed. 

Little Man Computer (LMC) and programming in Assembly Language

As mentioned in the previous blogpost, assembly language is a low level programming language that consists of instructions that are mnemonic codes for corresponding machine language instructions. Assembler is a program that reads and translates assembly language to machine language. We also practiced to program in assembly language. We also did an interesting activity called Little Man Computer. This is the first time we tried to program in the course, even though the instructions we wrote were really simple. By doing the activity, we also understood how machine instruction cycle works. 

A + B+ C

A+B+C

(A + B) + B + C

(A+B)+B+C.png

Machine Instruction Cycle 

machine instruction cycle

The machine cycle is a 4 process cycle that includes reading and interpreting machine language, executing the code and store the data. The first step is fetch — to retrieve instructions from the memory. The second step is decode — CU translate the retrieved instruction into a series of computer commands. The third step is execute — ALU will execute the instructions. The last step is store — ALU will send and write the results back in the memory. We also drew the block diagram during the class. 

c

Year 1

Boolean Expression, Logic Gate, and Truth Table

Welcome! Time flies, it is the last week of September. We did a lot this week. We have done the first test and the first presentation in this week. We also learnt knowledge about boolean expression, logic gates and truth table, and we did a lot of activities which were interesting. 

Data Representation poster 

Our group was mainly focus on audio and video part of data representation. Mr. Pete, our teacher, told us to combine different knowledge together. After carefully thinking, we chose to use a image of Pac-Man to show knowledge connected with image, like color depth, pixels, resolution (PPI, DPI), vector image, bitmap image. We chose MP3 as an example to show the information associated with audio: sample, sample rate, bit depth, encoding, quantization, quantization error and metadata. We tried hard to think how to combine those knowledge together to give a perfect presentation. We also show lossy vs. lossless compression. Using run-length encoding example not only shows what run-length encoding, but also we showed how to calculate compression rate. The last part of the poster is about video compression: temporal redundancy and spatial redundancy. By doing the poster, I learnt a lot and I am more familiar with information about data representation of audio and video. Even though making poster spend some of time, it is a good way to learn an area of knowledge. 

poster.jpeg

What is “thinking” and how can a computer “think”

First of all, thinking is the action of using one’s mind to produce thoughts in Merriam-Webster dictionary. Thinking is to use a logical thoughts to find logical ways to solve problems. Computers do not have minds. With our basic knowledge, we know that computers are in binary system. It could only think with 0s and 1s which means that a computer turns on and turns off the electricity currents in computers. With logic gates, computers enable to think logically and they could solve problems or execute instructions.  

Boolean Expressions, Logic Gates, and Truth Tables

Boolean expression is an expression that results in a value either TRUE or FALSE. For example, the expression 2 is less than 5 is a Boolean expression because it is TRUE. Logic gate is an idealized or physical device implementing a Boolean function. Truth table is a table showing all possible input values and associated output values.Logic gates have more than one inputs signals and produce a single output signal. There are seven basic logic gates: AND, OR, NOT, NAND, NOR, and XOR. Zero represents FALSE, and one represents TRUE. 

An AND gate accepts two inputs and has one output. Keywords for AND gate is both. For example, if both person sensor AND the alarm switch are on, then the burglar alarm is activated.

and gateAND p

Person sensor Alarm switch  Burglar alarm
0 0 0
0 1 0
1 0 0
1 1 1

An OR gate accepts two inputs. Keyword for OR gate is at least because at least one of the inputs need to be 1. If either front doorbell switch OR back doorbell switch is on, doorbell will ring. 

 

Front doorbell switch Back doorbell switch  Doorbell 
0 0 0
0 1 1
1 0 1
1 1 1

There is one input in a NOT gate. Then it returns the opposites signal as output. Keyword for NOT gate is opposite. If the temperature outside is below 18 degrees, central heat switch is on. If the temperature outside is above 18 degrees, central heat switch is off. 

Above 18 degrees Central heat switch 
0 1
1 0

A NAND gate operates as an AND gate followed by a NOT gate. If both are TRUE, then it is FALSE; otherwise, it is TRUE. If both window and door are locked, the bell will not ring. 

Window  Door Bell ring
0 0 1
0 1 1
1 0 1
1 1 0

A NOR gate accepts two input signals. If both are FALSE, output will be TRUE. Otherwise, the output will be FALSE. If there is no rain and there is no traffic jam, I will go to picnic tomorrow. 

Rain  Traffic jam Go to picnic 
0 0 1
0 1 0
1 0 0
1 1 0

A XOR gate accepts two input signals. If either one input or the other is 1, excluding they are both 1, the output signal is 1. People can choose one or the other but not both. Keywords for XOR are either and excluding. If there is a bridge with a single lane, there are two cars at the opposite side, then we should consider whether there could be a car on bridge or not.

Car A Car B There is a car on the bridge
0 0 0
0 1 1
1 0 1
1 1 0

These are the common logic gates seen in the reality. However, when they occur in an expression, the sequence should be NOT, OR, and then AND. 

note

Converting Logical Statements

First, people should simplify the statement. Second, people could find keywords in the statement, like if, or, not and so on. Third, people could rewrite the statement with logic gates. Then, they could write the boolean expression and draw truth table to find the result. For example, Rose will not eat breakfast, if she gets up late, or she does not buy bread and not cook food yesterday.   

Not eat breakfast = (get up late) OR (NOT buy bread AND NOT cook food yesterday)

Not eat breakfast = (get up late) ⋅(buy bread’ + cook food yesterday’)

Buy bread cook food yesterday  A Get up late Not eat breakfast
0 0 0 0 0
0 0 0 1 1
0 1 0 0 0
0 1 0 1 1
1 0 0 0 0
1 0 0 1 1
1 1 1 0 1
1 1 1 1 1

Here are several assignments we did this week to practice conversions. Actually, NOT, OR, AND are basic logic gates. NOR, XOR, NAND are derived from the basic ones. For example, NAND means NOT AND; NOR means NOT OR. As a result, logic gates could be converted.

This slideshow requires JavaScript.

Transistor and combined gates – circuits

transistor .jpg

Transistors are made up of semiconductor material. There are three terminals in a transistor: source, base, and emitter. With these terminals, transistor could be used to amplify and switch electric signals and electrical power. Emitter emits the charge carriers. It allows electrical signal to flow to the ground which causes no harm. Transistors could be combined to form logic gates which allows computer to do logical “thinking”. Here are some examples of the connection of transistors to from different basic logic gates.

transistortransistorGates could be combined into circuits through using output of one logic gate as the input of another logic gate. Gradually it could form complex circuits to accomplish more difficult task. 

circuitcircuit 2

“Briefly” explain the properties of Boolean algebra to simplify

As mathematical equations, boolean expression could be simplified, too. After simplification, expression become easier, more convenient. There are many properties in boolean expression. Among which, there are three important properties which are demorgan, distributive, and simplification.

Property  Expression 1 Expression 2
Demorgan  (A+B)’ = A’ * B’ A’ * B’ = (A+B)’ 
Distributive  A * (B + C) = A * B + A * C A * B + A * C = A * (B + C)
Simplification  A + A’B = A + B A * (A’ + B) = A * B

Here are several examples.

Demorgan: If I does NOT get up late AND I does NOT waste time, I will go to school on time. It is the same as if I get up late OR I waste time, I will NOT go to school on time. 

Distributive: If I finish my homework AND play the piano, OR I finish my homework AND read books, I will go shopping with my friends. It equals that if I finish my homework, AND either I play the piano OR read books, I will go shopping with my friends. 

Simplification: If temperature is below 10 degrees, AND temperature is not below 10 degrees OR I do not wear proper clothes, I will feel very cold. In another words, if temperature is below 10 degrees AND I do not wear proper clothes, I will feel very cold. 

Screenshots and explanations of the activities and worksheets

These activities are interesting which add more spice to the class. All activities and worksheets are associated with logic gates and truth table. At first I was not familiar with the pattern, so I made an enormous mistake which was that I could not find correct inputs. This resulted that my result was wrong. But after several practice I was more familiar with the pattern and logic gates. I also found that different combination of logic gates could get the same result (Equivalent Circuit).

This slideshow requires JavaScript.

How computers add numbers  (XOR, half adder and full adder)

Computers are in binary system which means that there are only ones and zeros in computers. Half adder and full adder are digital circuit elements used to summarize numbers. Half adder has two inputs and produce two outputs. One of output signals is the result of addition, while the other output signal is carry in higher class. The half adder is a combination circuit of XOR and AND circuits. A full adder has three input signals: two of them represent the binary digit (a and b), the third one is the carry from previous class (Cin). There are two output signals: one is the result of additions, another one is the carryout. Multiplying full adders several time, people could get a circuit. 

a2

Screenshot of your adder created in Logic.ly/demo

This week we did an interesting activity associated with the combination of this part knowledge. This is a website shows logic gates by connecting wires, light bulb and switch. I made mistake when I first did the activity. I misconnected some outputs to some inputs. Maybe I was not familiar with the process and the theory. So I tried several times until I got the right one. However, it was a fun experience by doing the activity. We apply the activity we did for adders in this activity.

This slideshow requires JavaScript.

 

Year 1

Compression, Image, Video, and Audio Representation

Welcome!

It is nearly the end of September. Time flies, three weeks have passed. We learnt a lot during this three weeks. We continued to learning about data representation and prepared poster for the upcoming week. We did a lot of exercises during this week which are relatively interesting. 

Representing Text (ASCII & Unicode)

Computers should not only represent numbers, but also it should represent text. That’s the reason why ASCII appears in people’s life. ASCII is the abbreviation of American Standard Code for Information Interchange.

1280px-ASCII-Table-wide.svg.png

From “https://commons.wikimedia.org/wiki/File:ASCII-Table-wide.svg”

It is a character encoding standard for electronic communication. It was originally seven bits which could totally represent 128 unique characters. Then it changed to 8 bits. It only based on English alphabet, in other words, it could only represent English. But later, people found that ASCII could not be International used because it could not represent other characters. So people invented Unicode which could represent other characters. Unicode is a superset of ASCII. There are 16 bits in Unicode, it could totally represent 65536 unique characters. Both ASCII and Unicode are shown in binary system. These data representation which were incredibly useful in computers. 

Unicode.jpeg

From “http://www.notsimplyyes.com/a2z/inclass_present.htm”

Data Compression 

Data compression enables reduce the space of a piece of data. Data compression is imperative in computing system. It enables people to transmit data much faster and it saves a lot of space for users to store more data. There are two kinds of data compression technique which are lossless and lossy data compression. Lossless means that data is the same as the original information after being compressed then retrieved (PNG, GIF, Run-Length). On the opposite, lossy means that some information will disappear in the process of compaction (JPEG, MP3). Lossy compression saves a lot of space for users. Even if lossy compression loss some information, it is endurable which has a good enough quality. Lossless compression are used in office documents, spreadsheets and e-mails. Compression rate equals to the size of compressed data over the size of the original data. 

lossy-compression-ratios

From”https://optimus.keycdn.com/support/lossy-vs-lossless/#comment-193″

Text Compression 

We learnt three types of methods for text compression: keyword encoding, run-length encoding, and Huffman encoding. Keyword encoding is to replace the frequently appeared words with a signal. 

Keyword Encoding

Run-length encoding is often used when a single value in a data file repeated several times in a long sequence. Run-length encoding is to replace frequently appeared single value with *nx. It begins with a flag — *. “n” means the number of times the single value has appeared consecutively. “x” represents the single value. But it will not be used when the repeated number less or equal than three. Because it will be the same or even more than the original number. 

runlength

Huffman encoding is a specific type of prefix coding used for lossless data compression. Each character’s bit string is different from each other. It is not always optimal among all compression methods. The smaller the compression ratio is the better files have been compressed. 

huffman coding

From “https://mathematica.stackexchange.com/questions/47873/how-to-make-huffman-coding-by-using-tree-representation”

We also did some activities during the class time.

exer 3

Screen Shot 2018-09-26 at 9.35.25 PM

Image representation 

Bitmap and vector images are two ways to represent images in computer system. A bitmap is a type of memory organization or image file format used to store digital images. Bitmaps is a compressed version of images. It is made up of numbers of pixels. Pixels are the little squares indicating different colors. While vector images represent images in mathematical equations. As a result, vector images are more clear than bitmap images. Bitmap is resolution dependent, while vector image is resolution independent.

bitmap and vector

From”http://thread-creative.co.uk/differences-between-vector-and-bitmap-files/”

BitmapVsVectorChart-01

From”https://imagebox.com/industry/bitmap-vs-vector-a-guide-to-looking-your-best/”

Resolution is a measure of spatial printing or video or image scanner dot density. It could be shown in DPI (dots per inch) or PPI (pixel per inch). It mean that the number of individual dots or pixels can be placed in a line with the span of 1 inch. Color depth is the number of bits used to indicate the color of a single pixel in a bitmapped image or video frame buffer, or the number of bits used for each color component of a single pixel. It is represented in 8 bits. All colors are shown by three main color: red, green, blue.

This slideshow requires JavaScript.

Metadata is the data about data which mainly describes the property of data: descriptive metadata, structural metadata, administrative metadata, reference metadata and statistical metadata.

We did exercises of bitmap and compression during the class in order to be more familiar with the conception and how it works. 

bit

Audio Representation 

We all know that there are digital and analog data. However computers could not read analog data. So audio representation needs to be converted from analog data to digital data. Sampling is a process of obtaining audio sampling rate. Sample rate is the number of samples of a sound that are taken per second to represent the event digitally. 23 (sample) / 5.5 (s) = 4.18 Bit depth is the number of bits of information in each sample, and it directly corresponds to the resolution of each sample. As the graph shown below, the bit depth is 3. Bit rate is the number of bits that are conveyed or processed per unit of time. So in the graph below, bit rate is 12 bits per second.

bit rate

From”https://en.wikipedia.org/wiki/Audio_bit_depth”

Codecs is a device or computer program for encoding or decoding a digital data steam or signal. Encoding is a process to convert information into particular form. For example, the process of converting from Pulse Code Modulation to MP3 is encoding. Quantization is the process of mapping input values from a large set to output values in a relatively smaller set. It often converts a continuous set into a countable set. It will lose some data but it does not affect a lot. 

quantizatio

From “https://www.tutorialspoint.com/digital_communication/digital_communication_quick_guide.htm”

Video Representation 

There are two types of video representation which are spatial redundancy and temporal redundancy. Spatial redundancy is elements that are duplicated within a structure. It will spatially a frame contains pixels which have similar values to their adjacent neighbors. In a video, the adjacent pixels in a region have similar values and have minimal difference among them. So here there is a lot of spatial information which is redundant. Temporal redundancy is that pixels in a video frames have the same values in the same location. For example, in a video, if the background is the same for several seconds, the computer will automatically use the same pixels for the background. 

In conclusion, it is a enjoyable week. We learnt a lot of things in data representation, especially in audio representation, text representation and video representation. I am satisfied that I learnt a lot during this week. I am looking forward for the next week because we are going to do the first presentation of this semester — a poster for the whole unit. See you next week!

Thank you ! 

Year 1

Week 2 in CS SL

Welcome!
Time flies. It is already the second week of grade 11. This week we learnt about data representation, bit, byte, binary, and hexadecimal, different terms we would need in Computer Science. I improved a lot during this week of study. I learnt deeper of bit, byte, binary than what we had learnt the first semester. I also knew another frequency used base which was hexadecimal. We did more calculations this week compared with other weeks before. 

Positional Notation

positional notation.png

Positional notation is associated with the base of a number. It is a way to represent number or encode numbers. The base of a number determines the number of different digit symbols, and the values of digit positions. Even though a number is seemed to be the same, their bases are different, then the actual numbers are different. Each digit has its own place value, the number is equal to the sum of each digits multiply its place value. For example, 352 in base 10 positional notation = 3 × 10^2 + 5 × 10 + 2 × 10 ^ 0 = 352 in base 10. 352 in base 6 positional notation = 3 × 6^2 + 5 × 6 + 2 × 6^0 =  140.

Bit, Byte, Binary, Decimal, and Hexadecimal 

binary, octal....png

These are frequently used terms in Computer Science. Bit and Byte are unit used in computer science. Bit equals to binary digit. Bit is a basic unit of information used in computing and digital communications. A binary digit only represents a value by either 1 or 0. One byte equals to 8 bits. In one byte, there are eight digits which are represented by either 1 or 0. One byte could represent 2^8= 256 numbers. The number of bits in a word determines the word length of the computer, but it is usually a multiply of 8. Bytes are often used to show storage capabilities. 

Binary, decimal, and hexadecimal refers to different bases. Binary is base 2, 2 digits: 0,1. Decimal is base 10, 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. So we could conclude that the largest number of a base is just smaller than the base number. For example, in base 8, the largest number is 7. Hexadecimal is base 16, 16 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E. When base is greater than 10, people will use letters in alphabetical sequence to represent numbers that greater and equal than 10. 

Converting to and from different number base system

Because there are different number base system, it is imperative for people to learn about how to convert to and from different number base system. So our teacher taught us about the knowledge and we practiced a lot this week which resulted that we had a week involving lots of calculations. 

When we converting other number base system to decimal, people will use positional notation. We just add all products of number of each digits and place values. The sum of is the number in base 10. An example is shown below. 

Octal: 274   Decimal: 2 × 8^2 + 7 × 8 + 4 × 8^0 = 188

When converting to different number base system, is to convert it into decimal system, and then convert it to other number base system. 

  1. First step is to divide decimal number by new base number. Then let the remainder be the first number on the left in the new base. Next step is to replace the original decimal number with the new quotient. People repeat the steps until quotient is zero. division.png
  2. After converting to decimal place, we can list numbers from right to the left: from the base to the power of 0 to the number just greater than the number we want to convert. Then write down the number of it people need from left to the right. Then the numbers will make up the new number. Screen Shot 2018-09-19 at 9.58.20 PM.png

Binary: 10101011 —convert to octal 

Binary to decimal     10101011= 2^7 + 2^5 + 2^3 + 2 + 2^0 = 171 

The divider is 8.

512 64 8 1
0 2 5 3
2 × 64 = 128  171-128 = 43

5 × 8 = 40

43-40 = 3

Result: 10101011 in binary = 253 in octal 

When converting binary to 2-bases: binary to octal, binary to hexadecimal, people could make groups from right, convert each group. If people convert from binary to octal, they will make groups of three. If people convert from binary to hexadecimal, they will make groups of four. The reason people can do that is that in binary system, 4 bits could represent 16 numbers and the largest number is 15, 3 bits could represent 8 numbers and the largest number is 7. Using this method is much quickly to calculate compared with the first method.

Convert 10101011 in binary to octal 

10                                 101                               011

10 = 2 (decimal)    101 = 5 (decimal)      011 = 3 (decimal )

Arithmetic in Binary 

There are only 2 numbers in binary system which are 0 and 1. Whenever the number is greater than one (1 + 1 = 10), it will be with a carry value. When subtracting, borrow numbers from the digit before the one calculated. Examples are shown below in order to be more clear.

2.jpeg

1.jpeg

Here are two strategies for arithmetic in binary system. 

Analog Vs. Digital

Analog and digital data are used to transmit information. All electronic signals degrade as they move downwards. But an analog signal continually fluctuates upwards and downwards. Because computers could not deal with analog information well, they digitize the analog information which is to break data into pieces and then represent each piece separately. 

digital and analogdigital analof

Analog  Digital
Representation  Continuous range of values to represent the information discrete or discontinuous values to represent information: each bit represent two distinct amplitudes (high or low)
Way  Physical way: electric pulses of varying amplitude  Binary format (zero and one)
Computers  Can’t do well with analog data Do pretty well with digital data 
Technology  Records waveforms as they are  Samples analog waveforms into a limited set of numbers and records them

Number representation 

Two’s Complement

Binary representation is the one used in computers. Each bit can be either 1 or 0. Two bits could represent two things. Three bits could represent eight things. So n bits could represent n ^ 2 things. However computers store data in fixed sized, so zero will replace the digit without 1s. Its storage usually are represented in bytes. Two’s complement is used in number representation. Positive numbers are represented as usual, except the most significant digit (the digit at the very left). Zero represents positive number. For example, 00001011 means + 11. On the other hand, negative numbers change all 1s to 0s, all 0s to 1s. Then the new number adds one due to the fact that there is zero in the set. As a result, the very left digit of all negative numbers is 1, which means negative sign. This rule is applicable in two’s complement. This rule explains the reason why one byte could only represent from -127 to 127. 

th.jpeg

Show -11 in binary system 

11=00001011 in base 2

      11110100 + 1 = 11110101 → 11110101 represents -11

Binary Fraction Screen Shot 2018-09-19 at 9.34.45 PM.png

In binary fraction, there are 2 bytes in binary fraction. A radix separate first eight bits and the left eight bits. First eight bits represent the same value as binary system. However eight bits after the radix represents reciprocal of corresponding number (a b c d . 1/d 1/ c 1 / b 1 / a). By this way, people could represent decimal numbers. 

th

Q & AQ & A.png

5. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F ,G, H 

6. a. 354 b.  GHF9  c. 1

We dug deeper in computer this week. We learnt some fun things this week. I found the connection between mathematics and computer science, especially binary system. Binary system plays an imperative role in computer science. I am looking forward to the lessons of next week!

Year 1

THE BIG PICTURE

Week 1

Welcome!

This week is the first week of IB year. I choose IB Computer Science SL. This week we looked at the big picture of computer, the history of computer, and digital divide. We watched TED talks during this week. Through reading Chapter 1 of Computer Science Illuminated, we learnt about history of computing hardware and software. We did a lot of activities: command terms and digital divide debate.

How to look at a computing system

First, we reviewed the terms of computing system and we learnt about concept of Inside-Process-Outside System. There are hardware and software in a computing system. We also reviewed the different layers of computing system.  We also focused on the history of both software and hardware in computing system. These are essentials in computing system.

Hardwares & Softwares

First, we looked at computer system. There are hardwares and softwares in computer system. Hardwares are physical elements like keyboards, CPU and so on. Softwares are instructions that given to computers. Screen Shot 2018-09-10 at 7.22.30 PM

From “http://www.dreamstime.com/stock-photography-software-concept-image29136792”

th

From “http://comofuncionaque.com/que-es-un-hardware/”

Layers of Computing System

A computer receives an input, processes the information, and performs an output.Screen Shot 2018-09-10 at 9.17.50 PM

There are six layers in the computing system: information, hardware, programming, operating systems, applications, and communications (from inside to outside). Data are details and facts that sometimes could mean nothing. While information is derived from data which could be comprehended by people. Information layer presents in binary digits. It is the way how people show information in the computer. Hardware layer is just the hardwares of a computer system, like CPU and memory. Programming layer gives instructions used to solve problems to the computer in computer languages. Operating layer helps to interact with computer system, and manage how hardwares, programs and data interact. It uses the resources efficiently. Application layer is applications that have specific functions or tasks. Communication layer is that computers are connected together to World Wide Web to solve problems.

History of Computing hardware

Early History: Many people believe that Stonehenge is an early form of calendar and astrological calculator. Gottfried Wilhelm von Leibniz built the first device that could do all four whole-number operations, but it was not very reliable. Jacquard’s loom was first used important input: the punched card. Ada Augusta is seemed to be the first programmer. Colossus built by Thomas Flowers is considered to be the first electronic digital computer.

Screen Shot 2018-09-10 at 9.18.49 PM

From “http://www.zdnet.com/article/night-lighting-for-stonehenge/”

  • First Generation (1951-1959): Vacuum tubes were utilized to store information in the first generation of computing hardware, however it was not very reliable and it generated a large amount of heat which needed air condition to cool down. 072-450_HR_0The primary memory device was a magnetic drum whose data was recorded through read or write head. By the end of the first generation, magnetic tape drives had been developed. Storage device external to the computer memory was auxiliary storage devices.
  • Second Generation (1959-1965): Transistor ushered in the second generation of computing hardware. It was the main part of vacuum tube. It was smaller, more reliable, faster, more durable, cheaper compared with the first generation. The advent of immediate-access memory was in the second generation. Magnetic cores are used to store memory, and it could combine into a memory unit.
  • Third Generation (1965-1971):Transistors and other components for the computer were assembled by hand on printed circuit boards, in the second generation. In the third generation, it was featured by integrated circuits: solid pieces of silicon that contained transistor, other components, and their connection. Transistors are used for memory construction as well. Each transistor presents a bit of information. The terminal which is an input or output device with a keyboard and screen was created in this generation.2N3904_A-111.jpgFrom “http://store.synthrotek.com/2N3904-Transistor_p_445.html”
  • Fourth Generation (1971-): Large-scale integration was introduces in the fourth generation. In late 1970s, personal computer was used among people. In the mid-1980s, larger, more powerful machines were made which were referred to workstations. Machine languages were introduced in this generation, and now computing hardwares are still developing. Paralleling computing which relies on a set of interconnected central processing units appeared in the later 1980s. SIMD (single-instruction, multiple- data- stream), MIMD (multiple-instruction, multiple-data-stream)are used to increased the speed of execution.

Knowing about the knowledge about history of computing hardware, I get more familiar with different terms that often occur in computer science.

History of Software

  • First Generation (1951-1959): The first programs were written in machine language in binary. The first artificial programming languages were developed in this time which is called assembly languages. It used mnemonic codes to represent each machine-language instruction. Translators are created which is to translate programs written in assembly languages into machine code. Programmers are divided into application programmers and system programmers.

Screen Shot 2018-09-10 at 9.19.37 PM

  • Second Generation (1959-1965): High-level languages are created which permit programmers to write instructions which are more like English statements. FORTRAN and COBOL are still using today. High-level languages have its translating programs which can translate high-level languages to machine codes.

Screen Shot 2018-09-10 at 9.20.51 PM

  • Third Generation (1965-1971): Operating system occurred in this generation. It is to determine which programs were run at which time. There are three types of translators: assembler (translating assembly languages to machine codes), complier (translating high-level languages to object code all at once), and interpreter (analyzing and executing a line of high-level languages program one line at a time). A computer system-a combination of hardware, software, and the data managed by them- had emerged.

Screen Shot 2018-09-10 at 9.21.31 PM

  • Fourth Generation (1971-1989) : Better programming techniques called structured programming appeared. C++ which is a structured language allowing the user access to low-level statements was created in this generation. Application softwares, like spreadsheets, word processors, and database management system, are available at neighborhood stores. 
  • Fifth Generation (1990-Present): The rise of Microsoft, object-oriented design and programming, and the World Wide Web are three notable events in the fifth generation. Java, a computing language, occurs in this generation which began to rival C++ in the fourth generation. Geneva created HTML for formatting documents.

Through the generations of softwares, computer users changed from professional computing people to all people in the world even who did not know much about computers. I feel that computer develop as a relatively rapid pace compared with other area of knowledge.

Computing as a Tool & Computing as a discipline

Computing as a tool is referred to professional people who use computers as a tool. However, computing as a discipline is referred to people who study Computer Science seem it as subject. People do not use computers only as a tool. There are four necessary skills in computing as a discipline: algorithmic thinking, representation, programming and design.

General Computational Thinking

There are steps in computational thinking: decomposition, pattern recognition, abstraction and algorithm. Decomposition is to decompose information into pieces. For example, when people digest, they need to decompose food into small pieces which are more convenient for people to digest or get nutrients from the food. Pattern recognition is to recognize each patterns after decomposition. Abstract is to remove complicated details and only leave necessary information in order to accomplish goals. For example, when people go to take food after buying take-away food online, it is really complicated to the task. But people could simplify it into several simple steps: open the door, take the food, and close the door. Algorithm is to accomplish a task step by step.  For example, when people boil eggs, there are several steps needed to be accomplished in order to finish the tasks.  Computational thinking could be used in daily lives like when people meet a difficulty, like to make school locker more user-friendly, they could use computational thinking to solve the problem more efficiently.

xNG-Blog-topic-banner-What-is-Computational-Thinking.jpg.pagespeed.ic.8k7m14hM5H.jpg

From “https://www.nextgurukul.in/KnowledgeWorld/computer-masti/what-is-computational-thinking/”

Embedded System

Embedded System is a programmed controlling and operating system with specific function embedded in a larger mechanical or electrical system. It is embedded as part of a complete device which includes harware and mechanical parts. It control many devices in today.

th.jpeg

http://tlists.com/top-7-real-life-examples-embedded-systems/

Command Terms

It are often used in IB examinations. It is quite similar compared with other command terms in other subjects. We often take a quiz online in the quizlet. It is interesting to play the game online. Not only can we learn meanings of these command terms, but also we can play games. Screen Shot 2018-09-03 at 8.43.16 PM

Digital Divide

Digital Divide refers to the disparity between Information Age haves and have nots. Digital is a concern in the fast-paced contemporary society. Approximately 70% family are digital included, while there are still 30% family in the world do not have an access to the Internet. As a result, there is a gap between these families. E-rate and One Laptop Per Child program are established in order to narrow the gap. OLPC set out to create a low-cost computer like about 200 dollars. We also watched a TED Talk about digital divide. We learn that OLPC is not feasible due to the fact that no countries in the world have so much money to run the OLPC program. There is another program which is called RIA. It is build a station for children to learn and get trained at the station which runs well. He said they considered four factors: infrastructure, connection, content and train. People could bring education through computers. Watching TED talk show how critical thinking is applied in computer science due to the fact that it indicates the drawbacks of OLPC, the one mentioned in the book. 

Even though I do not have much money or power to do some activities like what video has talked, I could try my best to narrowing the gap. I could recommend some books or useful materials for them. I could be a volunteer in activities like teaching children how to use computers or teaching some basic computer knowledge. I could also send some funny but useful books to them to let them more familiar with different high-technologies nowadays. 

 

Screen Shot 2018-09-08 at 1.55.33 PM

As a result, we learnt a lot during the first week of grade 11. We dug more deeper in the history of computer system. We know what digital divide is and how people can deal with the issue. We also learn about command terms that are often used in IB exams. These command terms are similar to other subjects’, but there are a little differences due to different subject. By reading book, I get more information of history of computer system. I think I need to review this week knowledge frequently in case that I would forget it.

Thank you !

 

2018 Project Week

Project Week Day 1

WechatIMG28This week is project week. We are Group 11 and we focus on stress management. Everyone in our group needs to find one proposed guiding question. This is the question that I have found which is ” what are the signs and symptoms of stress overload?”

Guided Question Proposal Form

Student Names: Eva, Chloe, Matthew Broad Topic: Stress Management
Proposed Guiding Question:

What are the signs and symptoms of stress overload?

How does this question relate to your broader topic?

The guiding question’s focus on effects of stress is evidently related to the broader topic of Stress Management.

List two courses that you have studied/are studying in PreIB which relate to this Guiding Question and explain how.

Course 1:

Psychology- There is a natural connection between stress and psychology.

Course 2:

Biology- The symptoms and signs of overloaded stress appear through human bodies. There is a natural association between human body and biology.

How can answering this question contribute to and/or encourage you and others to engage in a healthier lifestyle?

Answering the question helps people to get knowledge of signs and symptoms of stress overload. People could know when they are stress overload. Stress overload could cause some diseases. People can relieve the stress at the appropriate time which can avoid some diseases. Then people can have a healthier lifestyle.

List (at least) four sources you will use to access information on the area you have chosen to research.

  1. Stress Symptoms, Signs, and Causes   https://www.helpguide.org/articles/stress/stress-symptoms-signs-and-causes.htm
  2. 5 Symptoms of Stress Overload    https://www.livestrong.com/article/74318-symptoms-stress-overload/
  3. 10 signs of stress overload    https://thebrainlady.com/articles/10-signs-of-stress-overload/
  4. What is stress overload?   http://1st4stress.com/Stress/What-Is-Stress-Overload.html
  5. 60 common warning signs and symptoms of stress   https://sepitajima.com/warning-signs-and-symptoms-of-emotional-overload-and-stress/
Grade 10, Pre-IB Computer Science

# Weight and Height of Adults # Spreadsheet Project Reflection

Welcome!

 

It is the last week of computer science class in this year. We presented our spreadsheet project during this week. Our topic of spreadsheet project is “Weight and Height of Adults”. Our project is to collect adult’s weight and height to calculate their BMI index which can show their health state. According to adults’ BMI index, we will get information about their health state and give different advice to them to be healthier.

Screen Shot 2017-12-24 at 11.15.37 AM.png
Click the picture to see our project.

 

BMI index is an important data to people’s lives. BMI can give a lot of information. A person’s BMI index can show he/she fatness degree and if BMI index is too high, the person has increasing rate of some diseases. If BMI index is too low, he/she needs to do more exercise to be stronger. So BMI index is really significant in people’s lives and we choose this to be our topic.

First we collected data from adults around us to ask them about their weight and height. In order to protect their privacy, we just used number to displace their real name. The input is their heights and weights. We used these data to calculate BMI index. We also used ROUND function to one decimal place.Screen Shot 2017-12-24 at 10.41.28 AMScreen Shot 2017-12-24 at 10.42.20 AM There are five intervals of BMI index which are “<18.5”, “18.5-22.9”, “23-24.9”, “25-29.9”, “>30”. I got the information form Internet. BMI index in different intervals means different fatness degree. After calculating BMI index of each adults, we used simple function like MIN, MAX, AVERAGE to find the minimum, maximum BMI index among the adults. We also find the average among them.

Screen Shot 2017-12-24 at 11.13.49 AMScreen Shot 2017-12-24 at 11.13.55 AM

If BMI index is smaller than 18.5, the person is too thin and need to do exercise to be stronger. If BMI index is between 18.5 and 22.9, the person has a normal weight and should keep on exercising. If BMI index is between 23-24.9, the person is a bit corpulent and should be aware of their diet. If BMI index is between 25-29.9, the person is corpulent and should do more exercise. If BMI index is larger than 30, the person are severely obese and he/she must be aware of their weight and keep a healthy diet and keep exercising.Screen Shot 2017-12-24 at 11.11.22 AM.png We used complex IF function to give them report and suggestion. The output is the report and suggestion to give adults by calculating their BMI index. Screen Shot 2017-12-24 at 10.53.02 AMScreen Shot 2017-12-24 at 10.53.18 AMWe also used CONCATENATE function to combine the report and suggestion. We drew a graph to show the data more clearly. We also write a story to let people to pay more attention on their health state.Screen Shot 2017-12-24 at 10.56.12 AM

Screen Shot 2017-12-24 at 11.15.02 AM.pngFrom the spreadsheet project, I learnt a lot. I also found that BMI index can reflect a lot. Having a good health state is really significant. People should keep a health diet and do exercise. Spreadsheet has many different functions which can be used in different way. I learnt how to use different function in spreadsheet to solve problems in daily lives. Spreadsheet is a general purpose software which has many different functions. Computer science provides convenience to people’s lives in many aspects. There still a lot of information of spreadsheet need us to develop.

Grade 10, Pre-IB Computer Science

Spreadsheet

Welcome!

This week we begin to learn basic knowledge of spreadsheet. And we also took this month’s typing test. Spreadsheet is a general-purpose application software. The program operates on data entered in cells of a table. A spreadsheet consists of a table of cells arranged into rows and columns and referred to by the X and Y locations. Spreadsheet has many functions. People can enter and store data in the spread sheet. People can create, edit, sort, analyze, summarize, and format data as well as graph it by using spreadsheet software.

u=227492533,3392652622&fm=27&gp=0.jpgu=3241780053,1711742799&fm=27&gp=0.jpg

Screen Shot 2017-12-09 at 8.31.53 PM.png

Screen Shot 2017-12-12 at 9.50.43 PM.pngFunction

RANDBETWEEN(bottom; top) Randbetween means to return an integer random number between a specific range, between the bottom number and top number. For example, there is a lottery, everyone gets a number in a specific range and the sponsor using this way to decide who wins the prize.

SUM(number 1; number 2…) Sum is to sum the contents cell. I have learnt two ways to sum numbers. First way is to just enter “=” and all the numbers connected with plus sign. The other way is to enter “=” and click the active cell that the number you want to add. Then people will see the name of the active cell appearing. People should connect these names with plus sign. For example, when a person want to know expense of the trip. The person can use this way to calculate.Screen Shot 2017-12-12 at 9.44.50 PM

AVERAGE(number 1; number 2…) Average is to return the average of the arguments, ignoring text. For example, when teacher wants to know the average score of a test, she can enter all the score and use this way to calculate.Screen Shot 2017-12-12 at 9.45.00 PM

MAX(number 1; number 2…) Max is to return the maximum of a list of arguments, ignoring text entries. For example, a boss want to know who get the maximum salary and he can use this way to check it.Screen Shot 2017-12-12 at 9.45.11 PM.png

MIN(number 1; number 2…) Min is to return the minimum of a list of arguments, ignoring text entries. When a teacher want to know which student do not acquire knowledge well by testing, she can find the lowest score by using this function of spreadsheet.Screen Shot 2017-12-12 at 9.55.43 PM

ROUND(number; places) Round is to round a number to a certain precision. For example, “=ROUND(24.639528, 3)” means to round 24.639528 to three decimal places. So it will change to 24.640. For example, a company calculate the sales commission of employees. Numbers will not all be an integer when calculating the sales commission. So the company can use ROUND function to make the calculations to a precision level beyond two decimal places.

ROUNDDOWN(number; places) Rounddown is to round a number down, toward zero, to a certain precision. Bank can use this function. For example, people save money in the bank and they will get different interest according to time of deposits. If people save money in the bank for 10 months and 20 days, the bank will only calculate 10 months interests. They will ROUNDDOWN the number. Screen Shot 2017-12-02 at 4.43.58 PM.png

Screen Shot 2017-12-12 at 9.55.50 PMScreen Shot 2017-12-12 at 9.56.31 PMScreen Shot 2017-12-12 at 9.56.49 PMROUNDUP(number; places) Roundup is to round a number up, away from zero, to a certain precision. When a factory buy ingredients of a substance, they will roundup the amount of ingredients they need. Screen Shot 2017-12-02 at 5.15.59 PM.png

Screen Shot 2017-12-12 at 9.56.01 PM

Screen Shot 2017-12-12 at 9.56.38 PM

Screen Shot 2017-12-12 at 9.56.58 PMABS(number) ABS is to return the absolute value of a number. When a factory the same kinds of products, there must be considerably small differences between acceptable products and products they make. The factory could use ABS function to find which products they make accord to the acceptable products.

COUNT Counts the numbers in the list of arguments, ignoring text entries. When a salesman want to count how many kinds of goods they sell a day, he can use this function. COUNTBLANK Returns the number of empty cells. People will use this function when they check the to-do-list, they want to find how many things they have not done (cells show things that have done will have some words or signs). COUNTIF Counts the number of cells in a range that meet a specified condition. When a teacher want to check how many students have reached a certain level, she can use this function.Screen Shot 2017-12-12 at 9.45.21 PM.png

IF Returns one of two values, depending on a test condition. This function can be used when a teacher want to give students a comment according to their score.Screen Shot 2017-12-09 at 8.04.32 PM.png

CONCATENATE Combines several text strings into one string. It will be used when people want to combine their birth year with their birthday into one cell.

Screen Shot 2017-12-09 at 8.25.28 PMScreen Shot 2017-12-09 at 8.25.09 PM

IFERROR Returns one of the two values, depending on a first value. It will be used when people want to check their results. AND Returns TRUE if all the arguments are considered TRUE, and FALSE otherwise.

Screen Shot 2017-12-09 at 8.36.15 PM.png

OR Returns TRUE if any of the arguments are considered TRUE, and FALSE otherwise. A company use this function to select employees that agree with the conditions they set for a promotion. LOOKUP LOOKUP (lookupvalue; searchtable; resulttable) Returns a value from a single-cell-wide table, in a position found by lookup in another table. A teacher want to find which student get full mark in an exam and he can use “LOOKUP” function. Screen Shot 2017-12-09 at 9.02.18 PMScreen Shot 2017-12-09 at 9.02.39 PM

 

 

Grade 10

#Software#

Welcome

This is the ninth week of Computer Science class. We no longer study pseudocode and flow chart. We begin to study another layer: software. We learn the definition of application software and system software, different types of application software and system software.

Hierarchy of Software

There are two kinds of software that are system software and application software. System software are categorized  into four parts which are operating system, library programs, utility programs and programming language translators. Assembler, complier and interpreter are involved in programming language translators. Application software consists of general-purpose application software, special-purpose application software and bespoke application software.

software-types-2.jpg

System software

System software is a type of computer program that is designed to run a computer’s hardware and application softwares. It involves operating system software, utility programs, library programs and translator software. Operating system software is system software that manages computer hardware and software resources and provides common services for computer programs. It manages all the other programs in a computer, for example, Windows, Mac OS and Linux.types-of-operating-system-13-638          A library program is also a sequence of instructions that a computer can interpret and execute. For example, Oracle software use library program called RAC.sunoracle Utilities are programs that have a very special task to do with the computer. It is designed to help analyze, configure, optimize or maintain a computer. For example, anti-virus program and disk checker.pu.png

Translator software involves assembler, compiler and interpreter. Assembler is a program that translates machine language to machine code. Complier and interpreter translate a higher level of language. Complier acts all instructions at once. When people find mistakes, it is too late to correct it. Interpreter translates a part and passes. Then it reads second and translates it. People can see problems right a way. We also learn it by watching video.

Compiler-Converts-C-Program-into-Binary-Language.png
Complier

Application software

Application software employs the capabilities of a computer directly and thoroughly to a task that the user wishes to perform. People can perform specific tasks by application software. The categories of application software are general purpose application software, special application software and bespoke application software. General purpose application software is a kind of software that have many different tasks, such as data processors, desktop publishing software, databases and statistics applications. This kind of software is easily available and cheap.  Crystal reports is a kind of data processors software.Crystal-Reports

Special purpose application software refers to those softwares built to perform specific tasks, such as system in washing machine, system to control traffic light. traffic-lights-sign.jpg

CMSBespoke application software is tailor-made software for a specific purpose. It is an exact satisfy with the client’s requirements,. This kind of software is built for particular purpose. Content Management system, Business Process Automation system are examples of bespoke application software.

 

 

Presentation

This week we also have a presentation to do. Stephanie and I are responsible for graphic processing software. This is our presentation below.

 

Screen Shot 2017-11-27 at 9.21.40 PM.png
Click on the picture you will see our presentation

 

Grade 10, Pre-IB Computer Science

COMPUTER SCIENCE #POSTER#

WechatIMG6

This is the poster that our group has made. The topic is “how to order food”. It is a general solution. We have drawn both flow chart and pseudocode on the poster. It is an abstract step. First, input is “I’m hungry”. I decide to eat something and I will download an app. Open the app and input the location. If I want to eat Chinese food, I will decide what type of food to eat. If not, I will eat foreign food then decide what type of food to eat. After these steps, I will search the type of food and select a restaurant. If there is something that I want to eat, I will place the order. If not, then I should loop to the step of selecting restaurant. After I place a order, I will input my telephone number in the app. I will decide whether to use WeChat to pay or use Alipay to pay for the food. Then I will wait for the food, pick up the food and eat it. If I am full, then output“ I have enough food”. If I am not full, I will loop back to open an app and start the process again until I am full. I will output“ I have enough food”. Finally it goes to the end.