Professional Documents
Culture Documents
1
Introduction to Computers and Programming Language
2006 Pearson Education, Inc. All rights reserved.
OBJECTIVES
In this chapter you will learn: Basic hardware and software concepts. The different types of programming languages. Which programming languages are most widely used. A typical C++ program development environment. The history of the industry-standard object-oriented system modeling language, the UML. The history of the Internet and the World Wide Web. To test-drive C++ applications in most popular C++ environmentsGNU C++ running on Linux
1.1 Introduction
Software
Instructions to command computer to perform actions and make decisions
Worldwide
International Organization for Standardization (ISO)
Computer programs
Sets of instructions that control computers processing of data Written by people called computer programmers
Hardware
Various devices comprising computer
Keyboard, screen, mouse, disks, memory, CD-ROM, processing units, etc.
Output unit
Shipping section Places information processed by computer on output devices Screen, printer, networks, etc. Information can also be used to control other devices
10
11
12
13
14
A process is an executing program. It has its code, data, a certain set of resources allowed to it, and one or more flows of execution through the code. The OS manages the allocation of resources to these processes, and also provides system calls to manage these processes. Examples Scheduling processing within the cpu
Multi Tasking (jumping between processing jobs) Handles input and outputs
15
Memory must be shared between the OS and an application program. The OS must manage the allocation of memory to processes and control the memory management hardware that determines which memory locations a process may access.
Examples
Managing Cache memory Managing RAM Managing Virtual Memory
16
Information is sent through a computers input and output devices. Processes access these devices using the system call interface. The OS tries to manage said devices in a manner that makes them efficiently shared among all processes requiring them. A system call is a programming interface to the services provided by the OS, typically written in C/C++. Examples
Makes sure that the correct drivers are installed so that the computer can communicate with all the input and output devices connected to the machine/computer
17
18
19
20
1.7 Machine Languages, Assembly Languages and High-Level Languages Three types of computer languages
Machine language
Only language computer directly understands Natural language of computer Defined by hardware design Generally consist of strings of numbers Ultimately 0s and 1s Instruct computers to perform elementary operations Cumbersome for humans Example +1300042774 +1400593419 +1200274027
2006 Pearson Education, Inc. All rights reserved.
21
1.7 Machine Languages, Assembly Languages and High-Level Languages (Cont.) Three types of computer languages (Cont.)
Assembly language
English-like abbreviations representing elementary computer operations Clearer to humans Incomprehensible to computers Convert to machine language by translator programs (assemblers) Example load basepay add overpay store grosspay
22
23
24
25
26
Then used for creating Web pages with dynamic content Now also used for:
Develop large-scale enterprise applications Enhance World Wide Web server functionality Provide applications for consumer devices (cell phones, etc.)
27
Preprocess
Perform certain manipulations before compilation
Compile
Compiler translates C++ programs into machine languages
Link
Link object code with missing functions and data
Load
Transfer executable image to memory
Execute
Execute the program one instruction at a time
2006 Pearson Education, Inc. All rights reserved.
28
29
cout
Standard output stream Normally outputs to computer screen
cerr
Standard error stream Displays error messages
30
Portability
C and C++ programs can run on many different computers
31