Addressability and Memory

Addressability

Addressability is the way in which the computer identifies different memory locations.

The size (width) of the address bus determines how many memory locations can be addressed. For example , a 1 bit address bus can access 2 memory locations; a 2 bit address bus can access 4 memory locations and a 3 bit address bus can access 8 memory locations and so on.

 

In order to know how much memory we are actually accessing, we must know how many bits can be held in each storage location. This is determined by the width of the data bus. For example, a computer with a 2 bit data bus would store 2 bits in each memory location.

Calculating Addressable Memory

Total addressable memory = ‘the number of storage locations’  x  ‘the size of each storage location’

Example

A computer with a 2 bit data bus (stores 2 bits per memory location) and a 3 bit address bus (accesses 8 memory locations) would have an addressable memory of:

2 x 8 = 16 bits

=> 2 bytes

Memory

Main memory (or primary memory) is held on chips.

Backing storage (or secondary memory) is not part of the computers main memory.

 

Main memory consists of many storage locations which are identified by unique addresses.

Each individual storage location holds one word ( the number of bits that the central processing unit can process in one operation).

There are two types of main memory:

  • RAM – Random Access Memory
  • ROM – Read Only Memory

RAM

RAM memory  holds data and/or application programs from input devices or the backing storage and sometimes holds the OS (operating system).

When the computer is switched off, RAM is completely wiped out.

There are 2 types of RAM:

  • Static RAM (SRAM) – The memory in SRAM will remain as long as power is supplied to the chips i.e as long as the computer is switched on
  • Dynamic RAM (DRAM) – A continuous signal is needed for DRAM to refresh/ re-write it’s contents

SRAM is faster for the computer to access than DRAM. However, RAM is mainly made up of DRAM because it uses simpler circuits and is more economical in terms of power i.e requires less power in order to operate.

ROM

ROM has contents which are written on to it when it is being manufactured and thus cannot be re-written. ROM also holds the bootstrap loader part of the OS which is crucial when starting the computer up. Unlike RAM , ROM keeps all data that it holds even when the computer is switched off.

There are 3 different types of ROM:

  • Programmable ROM (PROM) – This type of ROM has no pre-written data on it and is empty so that the user can program it. However , once written, the data cannot be erased
  • Erasable PROM (EPROM) – This is the same as PROM except it can be removed from the computer, have it’s data erased and have another put in it’s place using UV (Ultra-Violet) light.
  • Electrically EPROM (EEPROM) – The same as EPROM except electricity is used to erase and re-write selected contents

Cache Memory

Cache memory is used because reading/writing to and from memory can decrease the quality of the system’s performance and cache is used as a form of temporary memory. Cache is a small amount of memory built in to the processor and uses SRAM. Cache is physically closer to RAM and stores the next set of instructions to be read. Cache can come in two forms:

  • Write through cache – This is when the contents of the RAM are updated at the same time as the contents of the cache
  • Write back cache – This is when the contents of the RAM are updated only when the contents of the cache are cleared

 

Registers

Registers are another form of temporary memory outside of RAM. Registers are storage locations inside the processor which hold the data being processed (Memory Data Register); addresses of memory locations to be accessed ( Memory Address Register); Instructions being executed (Instruction Register). It should be noted that there are many other registers and that registers are faster to access than RAM and cache memory locations.

Virtual Memory

Part of the hard disk (secondary memory) is set aside to be used as virtual memory.

The disk are is used as a temporary storage location for programs and data and comes in handy when the computer does not have enough RAM to store an entirte program and it’s data. It is slower to acces than data in main memory.

Comparing Different Memory Types

The speed at which data can be accessed depends upon the physical distance between the data and the processor.

In order of fastest access to slowest access :

  1. Registers
  2. Cache memory
  3. RAM
  4. Virtual memory

 

 

Thanks for reading, Lee.

 

 

Bitmapped Graphics

Images on a monitor are displayed using lots of tiny dots that are called pixels

The resolution of an image depicts whether it’s of good quality or not. Images with a high resolution will haver much better quality compared to images with low resolution.

Graphics Packages

Bitmapped graphics are used for painting.

Vector graphics are used for drawing.

Bitmapped Graphics

Bitmapped graphics are saved in a two dimensional array that  use binary numbers to represent the colours. Each pixel in the image is represented by the same number of bits.

If we had an image in which we used four colours so each pixel is represented using two bits e.g. white = 00  red = 01  Blue = 10  Green = 11

 

R.I.P Steve Jobs

Steven Paul Jobs was born on the 24th of February 1955 and passed away recently on the 5th of October 2011. Steve Jobs was Chairman and Chief Executive at Apple Inc. Jobs also co-founded (and was chief executive for a brief period of time) of Pixar Animation Studios who made films such as Toy Story.

Steve Jobs founded Apple along with co-founder Steve Wozniak in the 70s and together had created one of the biggest multinational corporations on the face of the Earth. Wozniak and Jobs aimed to create a computer system that was easy to use and dreamed that one day the computer would be a part of every day life, something that Jobs certainly accomplished in his time with us.

One of the most famous pieces of technology that Steve Jobs brought to society was the Macintosh. The Macintosh was the first commercially successful personal computer to be released and was made widely available to the people on the 24th January 1984. Macintosh’ models  have been in production since 1984 and the latest range of Macs continue to sell well and appeal to the masses thanks to their integrated hardware and unique aesthetic design.

 

More recently, Steve Jobs has been known for his ground-breaking work on the smartphone with the iPhone appearing to dominate the market. The iPhone was first unveiled by Jobs in 2007 and the iPhone 4S ( the 5th generation of iPhone ) is due to be released to the UK on the 14th of October.

Sadly, Steve Jobs passed away due to complications with his Pancreatic Cancer on the 5th of October. He was most definitely one of the finest and brightest entrepreneurs and innovaters of our century and will, without doubt,  go down in history for his advances in technology.

RIP Steve Jobs

 

Modularity, Macros and Scripting

Modularity

Computer programs can be written out as one long piece of code. However, a problem arises if we want to carry out a specific process several times throughout a program. We could copy and paste the code but what if we wanted to change or alter the code?

For example, in the classic 80s game PacMan there are 4 ghosts. Whenever a ghost reaches a wall it changes direction (it’s choice of direction being random). Since each ghost moves in the same manner, it would make sense to develop a block of code that would work for each ghost!

Subroutines

We create what’s known as a subroutine to control the movement of the ghost. We only need to tell the subroutine which ghost we want to be moved. This means that we can use the same subroutine code for each ghost and we only have to alter the name of the ghost that is being moved.

Parameters

Whenever we want to move a ghost we call the subroutine. For example:

move_ghost (“pinky”)

This calls the subroutine move_ghost passing in the parameter (“pinky”)

It is important to notice that the code to call the sub routine move_ghost  passes the parameter “pinky” meaning that the variable of ghost_name will only take the value “pinky”.

The parameters that are passed into subroutines when it is called from another part of the program are called the actual parameters.

In our example, “pinky” would be the actual parameter.

The parameters used in the subroutine definition are called the formal parameters.

In our example, ghost_name is the formal parameter.

Procedures and Functions

In general, there are two types of subroutine, procedures and functions.

Procedures and functions are a series of statements which have been given a name.

There is an important difference between procedures and functions:

  • Procedures: These produce an effect
  • Functions: These produce values

In our PacMan example, the subroutine move_ghost is a procedure because it produces the effect of changing the ghost’s direction.

An example of a function could be :

FUNCTION calc_area (length, breadth)

area = length * breadth

RETURN area

END FUNCTION

This subroutine is a function because it produces a value , the area.

Parameter Passing By Value

A parameter is passed by value if it’s value is not changed by the subroutine.

Parameter Passing By Reference

A parameter is passed by reference if it’s value is changed by the subroutine. Not all languages support parameter passing by reference. Arrays are always passed by reference!

Macros and Scripting

Many everyday applications offer the users macros or scripting languages. Scripts are written in order to perform a specific series of commands. Microsoft Word, Microsoft Excel and FileMaker Pro are all examples of programs that support macros and scripts.

Macros work by the user recording a sequence of keypresses that can be played back as many times as the user requires at a later date. Scripts provide this feature also but the come with instructions in a script or program.

Benefits of Scripts/Macros

  1. Complex commands can be carried out simply by pressing one (or more) keys.
  2. Expert users can set up scripts/macros for amateurs to use
  3. More functionality and flexibility can be gained from an application
  4. The HUI can be customised.

Thanks for reading, Lee.

 

 

 

The Software Development Process: Testing

Testing is the 4th stage in the software development process (SDP).

Testing starts at the analysis and design stages of the SDP in the form of prototypes.

In the latter stages of the SDP it becomes more and more expensive to fix bugs and problems etc. Many errors can be made during the first three stages of the SDP , these being a few of the more common ones:

  • Incorrect interpretation of the specification
  • Incomplete logic
  • Not thought of all special cases
  • Poor error handling
  • Bad time planning

There are also common errors that can be made during the coding stage such as:

  • Syntax errors
  • Initialisation errors
  • Confusion of parameters
  • Errors in loop counters
  • Incorrect handling of a decision
  • Multiple or non-definition of variables
  • Errors in writing variable names
  • Incorrect declaration of type and dimensions

Lastly there can be errors in translation:

  • Compiler errors
  • Confusion of library names

Selecting appropriate test data sets is also an important part of the testing stage. The person testing the program should know what results should be outputted if the program works correctly so that he/she can compare them to the actual results that the program outputs.

Normal Data

A normal data set should be tested to show that the program works as it is supposed to.

Boundary Data Sets (Extreme Data)

This specific type of data set is used to test the boundary limits within a program.

Exceptional Data (Out of Range Data)

Exceptional data is used to test that the program can properly handle unexpected inputs.

 

Phases of Testing

  • Procedure/Module Testing – Individual procedures and modules tested
  • Integration Testing – Test the modules work together
  • System Testing – Test the overall system
  • Acceptance Testing – Customer tests the program against their specification
  • Alpha and Beta Testing – Put the software out to users to test

 

There are several options as to who can test the program depending on what phase of testing the program is at. Mainly, tests are performed by the team of programmers who have developed the program.

However, acceptance testing is carried out by the client whom the program has been written for and alpha and beta testing is carried out by a group of users. It is becoming more and more common to be able to download free beta versions of programs off the internet.

It is a commonly held belief that the testing stage of the SDP removes all of the bugs from a program…

THIS IS NOT TRUE!

Testing only alerts us to the existence of bugs in our program, it does not eradicate them!

Testing can never fully prove that a program is entirely correct. No matter how much testing is performed on the program, it will always be plausible that bugs and system errors remain within the depths of the program, remaining undetected for perhaps the entire lifetime of the program!

 

Thank you for reading,

Lee Watt

Debugging in REALbasic

Debugging is the process that the programmer goes through in order to find and remove as many of the bugs as they can in the program. It is near impossible to remove ALL bugs from a program due to there being an infinite number of them.

To debug in REALbasic you use tools such as breakpoints. This stops the program from executing any code past the breakpoint. This means you can “Step” through the program, checking each little bit of code for any bugs.

The First Three Stages of Software Development: Analysis, Design and Implementation

Analysis

Although all 7 stages of the Software Development Process (SDP) are important, this is one of the key steps to a successful piece of software.

In the Analysis stage the analyst must find and accept what the problem is. Then the analyst must interview his/her client so that both sides are clear on what the problem is. Afterwards , the client and analyst would both agree on what’s called a ‘Software Specification’. This is a document which contains:

  • A clear definition of the problem
  • Foundations for a legal contract/agreement that the analyst and their client must settle upon

Another thing which the analyst must do is consider the inputs, processes and outputs of the program on which they are working on.

Design

No one wants to buy/use something that has been badly designed! Would you want to use a parachute that had been designed with a hole in it? Or perhaps you’d like to buy a car that was designed without any safety features? No, I didn’t think so. The same goes for computer programs.

A finely designed program makes implementation (which will be discussed further on in this post) much easier for the programmer. The design of a program means splitting up a program into different, smaller blocks of code.

The purpose of this is to develop an Algorithm.

Design should be modular which means we are able to break larger pieces of software into smaller parts. Different modules can be programmed by different people.

Top-Down design involves examining the main obstacle and breaking it down into smaller, more convenient modules. This process is repeated, helping the programmer by breaking the problems into smaller steps. This is known as Stepwise Refinement.

 

Bottom-Up design means the opposite, building one big solution from lots of little modules.

Design Notations

There are several types of design notations a few of them being:

The Human Computer Interface (HCI) is the way on which a computer program and the user interact. There are a number of laws which the HCI should follow e.g. Menu Selection, Command input and data display should be consistent.

Implementation

Before any writing of code can be carried out, it is important to agree on a fitting software development environment. There are different software developing environments for different fields e.g. Algol for Science

There are 3 different types of programming language:

  • Procedural
  • Declarative
  • Event-Driven

In a Procedural language , the programmer tells the computer, specifically, the order in which he wants the operations to be carried out. A procedural program has a distinct start and finish point.

In a Declarative language, the programmer declares all of the facts and relationships at the outset. Queries can then be performed on the facts and relationships in order to deal with any difficulties they may be having with the program.

In an Event-Driven environment, the programmer can design the HCI with different buttons, static text, fields etc. Chunks of program are carried out upon the happening of some sort of event e.g the push of a button, key press etc.

 

 

Thank you for taking the time to read this post, I hope you found it intellectually valuable.

Lee Watt.

What I Learnt This Week

Pseudocode

Is an outline of a program written in a way that it can be easily converted into a computer

Algorithms

Algorithms are a set of instructions that are required to help solve a problem

Event Driven Programmes

This is when an action must be performed (e.g. clicking a button) in order to activate the code.

Real BASIC

Real BASIC is a common programming environment used.

Programming

During the course of the week I wrote several programmes using Real BASIC. These programmes were:

  • Hello World
  • Extension
  • Game Score Example
  • String Variables
  • Simple Calculator
  • Favourite Colour
  • Arithmetic Calculator
  • Square Numbers
  • Cube Numbers

Variable

A variable is a value which can change i.e. it’s value VARIES!

Assignment

Giving a variable a value.

Initialisation

Assigning the value to variables at the beginning of the program.

Assignment

I was told to work through the Int2 / Higher Computing Programming Checklist as fast as possible.