Lecture 1: About Computers Mathematics, Statistics and Computer Science The University of New England Trimester 2 2015 Lecture 1: About Computers Reading: Begin with Chapter 1 Explore the comp131 unit website Check the first assignment requirements Collect materials for the first assignment Why Program? Computers are tools that can be programmed to perform many functions, such as: spreadsheets databases word processing games Computers are versatile because they can be programmed. Computer Programmers implement programs that perform these functions. Why Program? continued Aspects of a computer program that must be designed: The logical flow of the instructions The mathematical procedures The layout of the programming statements based on T. Gaddis Starting Out with Java: From Control Structures through Data Structures: 2nd edition 1
The appearance of the screens The way information is presented to the user The program s user friendliness Manuals, help systems, and/or other forms of written documentation. Why Program? continued Programs must be analytically correct as well. Programs rarely work the first time they are programmed. Programmers must perform the following on a continual basis: analyse, experiment, correct, and redesign. Programming languages have strict rules, known as syntax, that must be carefully followed. Computer Organization Computer is a machine that can receive, store, manipulate, and output data Computers have two kinds of components: Hardware consists of its physical devices: CPU, memory, bus, storage devices,... Software consists of the programs it has: operating system, applications, utilities,... Wirth s law: Software gets slower faster than hardware gets faster. Computer hardware components are the physical pieces of the computer. The major hardware components of a computer are: The central processing unit (CPU) Main memory Secondary storage devices Input and Output devices Trimester 2 2015 2 The University of New England
The components of a computer are connected through a subsystem called a bus that transfers data between them Central Processing Unit The University of New England 3 Trimester 2 2015
the CPU consists of 2 parts 1. the control unit and the 2. arithmetic and logic unit Central Processing Unit: The CPU performs the fetch, decode, execute cycle in order to process program information. this cycle forms what is known as the machine cycle. Trimester 2 2015 4 The University of New England
1. Fetch - Retrieve an instruction from the memory (RAM). 2. Decode - Tranlate the retrieved instruction into a series of computer commands. 3. Execute - Execute the computer commands. 4. Store - Save and write the results back in memory (RAM). These steps are then repeated over and over again. Programs are normally stored in secondary memory. To run a program, the program is first copied from secondary storage to RAM. From RAM the CPU fetches an instruction from the program, then decodes the instruction, then... The programs that run on a computer are referred to as software Main Memory: Commonly known as random-access memory (RAM) RAM contains: currently running programs data used by those programs RAM is volatile, which means that when the computer is turned off, the contents of RAM are erased. RAM is divided into units called bytes Bits and Bytes A byte consists of eight bits (switches) that may be either on or off. Each switch is called a binary digit, or bit (b) The bits form a pattern that represents a character or a number. The University of New England 5 Trimester 2 2015
8 bits is called a byte (B) 2 10 = 1 024 bytes is called a kilobyte (1KB) 2 20 = 1 048 576 bytes is called a megabyte (1MB) 2 30 = 1 073 741 824 bytes is called a gigabyte (1GB) 2 40 = 1 099 511 627 776 bytes is called a terabyte (1TB) 2 50 =? Stored Program Concept Bytes correspond to numbered (i.e., physical) locations (cells) Number serves as address Memory cells can contain program instructions or data (stored program concept) Cell s binary pattern interpreted differently depending on type of item stored (e.g., character, number, etc.) Main Memory: Main memory can be visualized as a column or row of cells. Secondary Storage Devices: Secondary storage devices are capable of storing information for longer periods of time (non-volatile). Trimester 2 2015 6 The University of New England
Common Secondary Storage devices: Hard drive Floppy drive CD ROM DVD RAM drive Compact Flash card Memory Sticks Input Devices Input is any data the computer collects from the outside world. That data comes from devices known as input devices. Common input devices: Keyboard Mouse Scanner Digital camera Output Devices: Output is any data the computer sends to the outside world. That data is displayed on devices known as output devices. Common output devices: Monitors Printers Some devices such as disk drives perform input and output and are called I/O devices (input/output). Computer Systems: Software Early Operating Systems Early computers could only perform one job/task at a time batch processing Operating Systems were created to make using the computer easier As computers improved it became evident that batch processing was not sufficient. The University of New England 7 Trimester 2 2015
multiprogramming many tasks/jobs could share the resources of the computer. timesharing where more than one user can access and use one computer at the same time. The computer presents to each user the illusion that they have all the computer to themselves. Operating Systems A couple of definitions: 1. An operating system can be defined as a Virtual Machine and a resource manager 2. An operating system is the collection of software that directs a computer s operations, controlling and scheduling the execution of other programs, and managing storage, input/output, and communication resources. Abbreviation: OS An operating system has two functions: Control the system resources. Provide the user with a means of interaction with the computer. Operating systems can be either single tasking or multi-tasking. Computer Systems: Software Operating Systems A single tasking operating system is capable of running only one program at a time. DOS A multitasking operating system is capable of running multiple programs at once. Windows Unix/Linux Mac OS X Computer Systems: Software Operating Systems Operating systems can also be categorized as single user or multi-user. A single user operating system allows only one user to operate the computer at a time. for example a personal computer (PC) Multi-user systems allow several users to run programs and operate the computer at once. for example turing (the computer system we will be using for comp131) is a example of a Multi-user system Trimester 2 2015 8 The University of New England
Personal, Distributed and Client/Server Computing Computers became affordable In the early 1980 s IBM introduced the IBM personal computer. these computers were initial stand-alone these computers were not powerful enough for time-sharing these computers could be linked together in computer networks e.g., LAN local area networks Distributive computing computing is distributed over networks. Computer systems composed of large numbers of computers connected via a high speed network. One definition of a distributed system is: A distributed system is a collection of independent computers that appears to its users as a single coherent system. Today s personal computers: are powerful provide individual users with enormous capabilities allow information to be shared - file servers provide common data store to clients in a client/server network architecture a computer is called a server if it is dedicated to managing resources such as files, so that other computers, called clients, can access those resources through the server. for example, when we browse through the World Wide Web, our web browser is the client, and it makes requests for resources via a URL address (e.g., http://www.une.edu.au) from a server located at that address. The Internet and the World Wide Web The Internet - a global network of computers - is accessed by hundreds of millions of people. The World Wide Web (WWW) is a service of the Internet. It consists of a world-wide collection of electronic documents. Each document can contain text, graphics, audio, video and also hyper links to other documents. It allows computer users to have almost instant access to information. Why Use Linux in COMP131? although there are numerous operating systems Windows The University of New England 9 Trimester 2 2015
Unix/Linux Mac OS X Why use Linux? UNIX is a mainframe OS that was developed at Bell Labs in the early 1970 s. Linux is essentially UNIX for PCs (open-source, freeware). Unlike proprietry software Windows or Mac, you are able to download the source code for Linux It is a robust, powerful OS that allows extensive customisation Many Computer Science environments are Linux based. Many of the other Computer Science units at UNE require familiarity with Linux. Linux in the lab On campus students who use the computer labs located in the Mathematics, Statistics and Computer Science building will be introduced to Linux Fedora Gnome Environment: graphical environment for UNIX All comp131/comp530 students (especially off-campus students) who have a reasonably fast connection to the Internet are strongly encouraged to install and configure NX-Client on their personal computers. For NX-Client installation/configuration instructions, goto the following URL: NX-Client The nx-client program will present a graphical environment with the same look and feel as the graphical environment used by on-campus students in our computer labs here at UNE. Logging into nx-client connects to the nx-server (located on turing). Essentially, after logging into turing through nx-client, creating, editing, storing and running program are actually being done on turing. This type of client is refered to as a thin-client - the server (turing in this case) does most of the work The first computer lab is now accessible - it provides practical exercises in moving around the Linux filesystem at UNE practice in creating and copying files. an introduction to the Emacs text editor note emacs the only editor available on turing Other text editors that are available on turing are (e.g., bluefish, gvim, vim, kate, kwrite). Trimester 2 2015 10 The University of New England
step-by-step instruction on how to compile and run your first JAVA program practice using the submit program the submit program will be used by you throughout the semester to electronicallysubmit all your assignments. Further Readings Click here for a more detailed explanation of the following: machine cycle virtual machine Client/Server Things to Do Reading: Chapter 1 of the text Tutorial: Start to work on Tutorial 1 Next Lecture: About Java The University of New England 11 Trimester 2 2015