Monday, 20 September 2010

C(++) and Pointers

Been playing with C and C++ variable declarations and pointers (using Microsoft Visual Studio 2010) last few mornings. This code should serve as good reference in future:
#include <iostream>

using namespace std;

int intFunc(int x, int *p, int **pp) {
return x;
}

int *pointerFunc(int x, int *p, int **pp) {
return p;
}

int **pointerPointerFunc(int x, int *p, int **pp) {
return pp;
}

int main()
{
int x, *p, **pp;
int resultx, *resultp, **resultpp;

x=5;
p = &x;
pp = &p;

cout<<"HEY, you, I'm alive! Oh, and Hello World!\n";
printf( "x = %d\n", x );
printf( "&x = %d\n", &x );
printf( "p = %d\n", p );
printf( "*p = %d\n", *p );
printf( "&p = %d\n", &p );
printf( "pp = %d\n", pp );
printf( "*pp = %d\n", *pp );
printf( "**pp = %d\n", **pp );
printf( "&pp = %d\n", &pp );

resultx = intFunc(x,p,&p);
printf( "resultx (intFunc) = %d\n", resultx );

resultp = pointerFunc(x,p,&p);
printf( "resultp (pointerFunc) = %d\n", resultp );

resultx = *pointerFunc(x,p,&p);
printf( "resultx (*pointerFunc) = %d\n", resultx );

resultpp = pointerPointerFunc(x,p,&p);
printf( "resultr (pointerPointerFunc) = %d\n", resultpp );

resultp = *pointerPointerFunc(x,p,&p);
printf( "resultp (*pointerPointerFunc) = %d\n", resultp );

resultx = **pointerPointerFunc(x,p,&p);
printf( "resultx (**pointerPointerFunc) = %d\n", resultx );

cin.get();
}

Friday, 17 September 2010

Processes and Threads

A 'process' is an 'instance' of a 'computer program' that is being 'executed'. It contains the 'program code' and its 'current activity' (state?).

A 'thread of execution' is the smallest unit of 'processing' that can be scheduled by an operating system. It generally results from a 'fork' of a computer program into two or more concurrently executing 'tasks'. Typically, a thread or multiple threads are contained inside a process and share resources such as state and memory.

An advantage/use of multi-threading: the ability for an application to remain responsive to input, e.g. in a single threaded program, if the main execution thread blocks on a long running task, the entire application can appear to freeze. By moving such long running tasks to a worker thread that runs concurrently with the main execution thread, it is possible for the application to remain responsive to user input while executing tasks in the background.

Thursday, 16 September 2010

Insight Onsite application

Posting here my response to the question "How do you believe that participation in the Insight Onsite project will further your career planning?" which I forgot to Blog when I sent it off last February prior to my internship at Tessella:
I intend to pursue a career in industry following my PhD which is due to be completed mid-2010. My area of interest is information technology and software development in particular, and I would hope to find myself in a company where I can utilise both the practical and analytical skills acquired during my undergraduate and doctorate degrees. The Insight Onsite placement would be an ideal way to find out more about my options whilst awaiting my final examination. The placement at Tessella specifically offers exposure to a wide range of projects and careers in my area of interest. It would be extremely useful to get a taster for some of the different software engineering and consultancy services Tessella provides, as well as the knowledge and skills I would need and develop working for such a company. In addition, I look forward to meeting and speaking with employees in different positions and roles, and thereby gaining an invaluable insight into work life and the work environment. I would appreciate immensely this opportunity to experience first hand the range of careers I could expect to opt for when applying for a job.
Writing (starting) my first covering letter today!

Monday, 30 August 2010

Compilers

About to give away my book 'modern compiler implementation in Java'. Was skimming through it and thought I'd Blog some key words/definitions for future reference and as a reminder of some of what I learnt during my undergraduate days:

Compiler - used to translate a programming language into executable code.

Syntax - the way in which words are put together to form phrases, clauses, or sentences.

Abstract - disassociated from any specific instance.

Semantic - of or relating to meaning in language.

Stack - an orderly pile or heap.

Translate - to turn into one's own or another language.

Canonical - reduced to the simplest or clearest schema possible.

Instruction - a code that tells a computer to perform a particular action.

Register - a device for storing small amounts of data.

Debug - to eliminate errors in or malfunctions of.

Garbage - unwanted or useless material. (Heap-allocated records that are not reachable by any chain of pointers from program variables.)

Garbage Collection - process by which memory occupied by garbage is reclaimed for use in allocating new records. (Process performed not by the compiler but by the runtime system: support programs linked with the compiled code.)

Wednesday, 18 August 2010

Software Development Processes

Just read a bit about Software Development Processes. In particular, the 'Waterfall Model' (where progress flows sequentially from top to bottom through various phases) and 'Iterative and Incremental Development' (where progress is through cycles (iterative) and in smaller portions at a time (incremental)).

Regarding the former, an example of the phases (in order): Requirements specification; Design; Construction (AKA implementation or coding); Integration; Testing and debugging (AKA Validation); Installation; Maintenance.

Regarding the latter, a quote from Wikipedia: "Learning comes from both the development and use of the system, where possible key steps in the process start with a simple implementation of a subset of the software requirements and iteratively enhance the evolving versions until the full system is implemented. At each iteration, design modifications are made and new functional capabilities are added."

Friday, 13 August 2010

PhD Submitted, Updating CV, MEng Modules

Submitted my PhD thesis today. Huge sense of relief maa sha Allah. Updating my CV now getting ready for the inevitable job hunt.

Removing the MEng course modules from my CV and Blogging here for the record...

4th Year Modules: Computing for Optimal Decisions, Grid Computing, Intelligent Data and Probabilistic Inference, Knowledge Representation, Management (Economics and Law), Modal and Temporal Logic, Multi-Agent Systems, Network Security

3rd Year Modules: Advances in Artificial Intelligence, Bioinformatics, Computational Finance, Concurrent Programming, Decision Analysis, Operations Research, Organisations & Management Processes, Software Engineering Methods

2nd Year Modules: Artificial Intelligence, Compilers, Complexity and Computability, Computational Techniques, Concurrent Programming, Networks and Communications, Operating Systems, Software Engineering, Statistics

1st Year Modules: Computer Systems, Databases, Discrete Mathematics, Hardware, Logic, Mathematical Methods and Graphics, Programming, Reasoning about Programs

... 8 good long years at Imperial College coming to an end!

Thursday, 12 August 2010

Remote-control warfare: Droning on

Blogging for the record an interesting piece entitled "Remote-control warfare: Droning on" about "How to build ethical understanding into pilotless war planes" which featured in the April 3rd 2010 issue of The Economist (Science and Technology section). A quote:
... Ronald Arkin of the Georgian Institute of Technology's School of Interactive Computing has a suggestion that might ease some of these concerns. He proposes involving the drone itself - or, rather, the software that is used to operate it - in the decision to attack. In effect, he plans to give the machine a conscience...
Good article. Worth a re-read.