Data: The First Ingredient of a Program

Chapter 2, on top of the basic knowledge provided in Chap.  1 , gets the reader familiar with how “information” is represented by a computer in the form of “data”. The chapter starts by introducing why data is essential and how it relates to the represent

  • PDF / 460,801 Bytes
  • 35 Pages / 439.37 x 666.142 pts Page_size
  • 0 Downloads / 192 Views

DOWNLOAD

REPORT


Data: The First Ingredient of a Program

The Von Neumann architecture has some implications even on high-level programming languages. Below is an overview of these aspects: • The Von Neumann architecture makes a clear distinction between the processing unit, namely the CPU, and the memory. • The content of the memory is highly mixed containing: The orders to the CPU about all the actions: Register ⇔ memory transfer operations; arithmetic, comparison and bitwise operations on the registers; operations effecting the execution flow. Adjunct information needed to carry out some instructions: Addresses for the transfer operations, constants involved in arithmetic or bitwise operations. Raw information to be processed: Integer or floating point values, or sequences of them; address information of such raw data. All these types of information live in the memory. However, still, there is a distinction between them. Anything that is stored in the memory falls into one of these categories, and an error-free machine code, when executed, will consider this distinction: Actions will be treated as actions, adjunct information as adjunct information and raw information as raw information. • Access to the memory is strictly address-wise. If you do not know the address of what you are looking for, you cannot locate it unless you compare every memory content with what you are looking for. In other words: Content-wise addressing is not possible. • All information subject to processing by the Von Neumann architecture must be transformed to a binary representation. Among these implications of the Von Neumann architecture, the main implication is the distinction between ‘actions’ and the ‘information’ because this distinction affects the way we approach any World problem. Here, the term World problem refers to a problem of any subject domain, where a computerized solution is sought. Below are a few examples: • Find all the wheat growing areas in a satellite image. G. Üçoluk, S. Kalkan, Introduction to Programming Concepts with Case Studies in Python, DOI 10.1007/978-3-7091-1343-1_2, © Springer-Verlag Wien 2012

35

36

2 Data: The First Ingredient of a Program

Fig. 2.1 Most of the time, a world problem is solved by a set of algorithms that act on structured data

• Given students’ homework, lab and examination grades, calculate their letter grades. • Change the amplitude of a sound clip for various frequencies. • Predict China’s population for the year 2040, based on the changes in the population growth rate up to date. • Compute the launch date and the trajectory for a space probe so that it will pass by the outermost planets in the closest proximity. • Compute the internal layout of a CPU so that the total wiring distance is minimized. • Find the cheapest flight itinerary from A to B, given departure and return dates. • Simulate a war between two land forces, given (i) the attack and the defense plans, (ii) the inventories and (iii) other attributes of both forces. In such World problems, the first task of the programmer is to ident