Top Banner
Computer Science 101 Introduction to Computer Principles Computers are very powerful, looking through large amounts of data quickly. Computers can literally perform billions of operations per second. However, the individual "operations" that computers can perform are extremely simple and mechanical, nothing like a human thought or insight. A typical operation in the language of computers is adding two numbers together. So although the computers are fast at what they do, the operations that they can do are extremely rigid, simple, and mechanical. The computer lacks anything like real insight. Or put another way, computers are not like the HAL 9000 from the movie 2001: A Space Odyssey: HAL 9000 youtube clip If nothing else, you should not be intimidated by the computer as if it's some sort of brain. The computer is a mechanical tool which can do amazing things, but it requires a human to tell it what to do.
36
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript

Computer Science 101 Introduction to Computer Principles Computers are very powerful, looking through large amounts of data quickly. Computers can literally perform billions of operations per second. However, the individual "operations" that computers can perform are extremely simple and mechanical, nothing like a human thought or insight. A typical operation in the language of computers is adding two numbers together. So although the computers are fast at what they do, the operations that they can do are extremely rigid, simple, and mechanical. The computer lacks anything like real insight. Or put another way, computers are not like the HAL 9000 from the movie 2001: A Space Odyssey: HAL 9000 youtube clip If nothing else, you should not be intimidated by the computer as if it's some sort of brain. The computer is a mechanical tool which can do amazing things, but it requires a human to tell it what to do.

Variables and =

Introduction to Digital Images

Image code

For LoopExpressions

Image puzzles

Grayscale ImagesConverting Color To GrayscaleIf Logic

Bluescreen

Computer Hardware Help Learn more.Discuss Introduction

Bits and Bytes 1

SoftwareComputer LanguagesSource Code and CompilerOne common computer language strategy is based on a "compiler". The computer languages C and its derivative C++ are old and popular computer languages that use this strategy, although they tend to have fewer features than dynamic languages (below). In C++, the programmer writes C++ code which includes high level facilities such as strings and loops (much as we have seen in Javascript). Here is some C++ code to append a "!" at the end of a string. Compiled code generally runs faster than interpreted code. This is because many questions -- how to append to this string, how many bytes do I need here -- are resolved by the compiler at compile time, long before the program runs. The compiler has, in effect, pre-processed the source code, stripping out many questions and complications, leaving the program.exe as lean and direct as it can be to just run. In contrast, the interpreter deals with each line in the moment, so all the deciphering and overhead costs of interpreting each line are paid as it runs. These overhead costs in effect make the interpreted program run more slowly than the equivalent compiled program. Supporting features tends to be easier in dynamic languages compared to compiled languages, which is why dynamic languages tend to have a greater number of programmer-friendly features. "Memory management" is the problem in a program of knowing, over time, when bytes of RAM are needed and when they can be reclaimed and use for something else. Every program must solve this problem. Memory management is an excellent example of a feature different between compiled and dynamic languages -- most modern dynamic languages manage memory automatically. The programmer can focus on the problem to be solved, and the dynamic language will take care of managing the memory. In contrast, in C and C++, the programmer at times must think about memory management at times, and may have to author lines of code to help solve it. (Aside: many crashes in C and C++ programs are due to errors in the programmer's memory management scheme. It is a difficult problem to solve manually.) The memory management in dynamic languages is not free. The CPU must run extra lines to solve the memory management. Dynamic languages, in effect, spend CPU cycles to manage the memory. This fits the general pattern that dynamic languages run with more overhead (i.e. more slowly) than compiled languages, but offer superior programmer-friendly features. Because dynamic languages like Java and Python have more features, a programmer can often write the code to solve a problem more quickly in a dynamic language than they can in C++. The time and attention of programmers is generally quite scarce (translation: programmers are scarce and expensive, which is why you want to be a CS major, or at least a minor!). Therefore, dynamic languages which allow the programmer to produce a correct program more quickly and reliably are pretty attractive, even if the resulting program uses more CPU and more RAM. Aside: Moore's law in effect, keeps making the programmer relatively more expensive compared to the CPU. Overall, different computer languages have different strengths and weaknesses, and best language for a particular problem depends on the situation. As above, dynamic languages like Java and Python can run slower and generally operate with higher overhead than C++ code, so for some problems, writing in C or C++ is the best strategy. Also, Java and Python lack certain "low level access" features which are needed in rare cases. NetworkingEthernet was created by Bob Metcalfe at Xerox PARC in 1975. Here is how the original Ethernet worked, although newer versions are more complex and have higher performance. There is one wire, and all the computers are connected to it -- they share the wire -- this is what makes it "broadband" as they all share the one medium. This is a simple and cheap configuration; the computers just connect to a dumb, shared wire. To add a computer, just connect it to the wire. Each computers on the LAN has a unique address. This is know as its MAC address (Media Access Control). The MAC address is burned in at the factory, thankfully not something you need to set or maintain manually. Only one computer should transmit at a time All computers listen to the wire all the time, picking up packets addressed to them and ignoring packets not for them To send data, the sender divides their message into small "packets" of, say, around 1500 bytes. Every packet begins with the address of the recipient. To send, the sender listens, waiting for a period of silence on the wire. When there's a period of silence, the sender sends their packet on the wire, effectively broadcasting it over the whole wire. Sometimes two senders send at the same time, and so their packets "collide" on the wire and get garbled. The network hardware can usually detect this "collision" and so know to stop transmitting, as those sends are ruined. The senders follow a "wait/re-transmit" protocol to re-send packets -- wait a random amount of time -- one of Metcalfe's breakthrough ideas -- and then try again when the wire is quiet. If the senders each tried to re-send immediately .. the sends would just collide again! By waiting a random amount of time, the two senders coordinate that one goes first, then the other. If we have multiple computers using the network at the same time .. this all makes ethernet a little unpredictable in terms of performance; it's hard to say precisely how long it's going to take to get a packet through. In practice, it works incredibly well, getting great performance with very little networking hardwareInternet - TCP/IP StandardsTable Data

Analog Digital So in essence, digitization translates a sound signal into just a series of numbers: 12000, 12002, 12006, 12007, 12010, 12005, 12006, ... and so on. Playing back the digital sound is just the reverse: a chip takes in the stream of numbers, say representing 44000 samples/second, and constructs an electrical signal that matches those numbers over time. In effect, this reconstructs the original sound signal from the numbersDigital Media

Computer Security-1- Password Attacks-2- Phishing AttacksWhen you go on to wifi and visit a web page and type something in ... the packets for all that are just being broadcast in the room, so anyone nearby can observe the packets, listening in (recall the ethernet-packet-broadcast material from the networking section). For the most part, this is harmless. In some cases, say when you are typing in a credit card number, you want the communication to be encrypted (encoded), so that someone listening in cannot read it. The https scheme above also does encryption, so you will notice that when you go the page to type in a credit card number, the url begins with "https://". On such page, all the packets are encrypted, so someone can listen and see the packets, but they will appear to be random garbage. The eavesdropper cannot unscramble the packets to see what's inside, or forge a packet. So Https blends two security provisions -- (a) verifying that it really is the www.mybank.com or whatever server on the other end and (b) encrypting all the packets of the communication.