Module Identifier CS23420  
Academic Year 2007/2008  
Co-ordinator Mr David E Price  
Semester Semester 1  
Other staff Mr David E Price, Mr David J Smith, Dr David Barnes, Dr Frederick W Long, Mr Peter Hoskins, Dr Adrian D Shaw, Mr Richard C Shipman  
Pre-Requisite CS10110  
Co-Requisite CS21120  
Course delivery Lecture   44 Hours.  
  Seminars / Tutorials   up to 2 x 1 hour sessions  
  Practical   up to 11 x 2 hours (un-timetabled, in students' own time)  
  Other   Assessed coursework - 75 hours  
  Other   Revision / background reading etc. - 55 hours  
Assessment TypeAssessment Length/DetailsProportion
Semester Exam2 Hours WRITTEN EXAMINATION  40%
Further details  

Learning outcomes

On successful completion of this module students should be able to:
be able to analyse a block diagram of a computer and explain how it works at the level of logic gates.

be able to analyse and develop low level programs and describe how they are executed by a CPU.

be able to describe how a computer performs input and output operations.

be able to judge the applicability of high and low level language programming.

have consolidated and extended their knowledge of programming languages.

be able to utilize the new skills acquired to analyse and solve problems using the C .

be able to explain how abstract concepts in high-level languages, such as `function call' or `local variable', are implemented in machine code.

be able to exercise significant judgment in being able to evaluate whether C or Java would be the most appropriate language to use for a range of situations.

be able to use specialized skills, namely in the use of operating system facilities.

have reviewed the importance of standards by means of studying the specifications of ANSI standard C.


Brief description

This module examines what a computer is and how it works, down to a level just above electronics. The module provides students who continue to study software development with an appropriate understanding of the hardware on which programs run and how programs are executed. The module will look at programming in assembly language and machine code.

This module aims to teach the basic features of the C programming language, and provides an introduction to the structure of the UNIX operating system and the UNIX programming interface. Many of the facilities of C will be introduced by comparison with those of Java, the emphasis being on the rationale behind the language design decisions for the two programming languages. Emphasis will also be placed on C programming incorporating good modular design, readability, portability, and use of appropriate development tools.

The module considers how a program, written in a high level language, (using C as an example), is represented as low level assembly language and ultimately executed by a computer.

The latter part of the course will introduce the interface presented to Unix by functions and system calls for use from C.

The module will also consider the relevance of standards, both in C and in UNIX.


1. Introduction - 1 lecture

An introduction to the module.

2. Revision of "What is a computer?" - 3 Lectures

Block diagram overview; CPU, memory, I/O, Bus. Memory, Digital Logic; pigeon-hole model, address and contents, bits bytes and words. Address, data and control buses. Basic data transfer.

3. Inside the CPU - 3 Lectures

Simple examples of instructions. The fetch-execute cycle and the program counter. Registers. ALU. Control unit. Implementing a machine code in hardware.

4. A real CPU example: for instance the Motorola 68 HC11or similar - 5 Lectures

Some machine codes and mnemonics. Addressing modes. Assembly code.

5. Introduction to executing high-level software - 2 Lectures

Machine-code equivalents of high-level constructs. Function calls. Stack frames and local variables.

6. I/O - 3 Lectures

Reading and writing data. Interrupts. Transferring large amounts of data; DMA, block I/O.

7. Case Studies of typical assembly language programs - 3 Lectures

A small group of typical assembly language programs will be presented and discussed as examples of good practice.

8. Exercises - 5 Practicals

Use a CPU simulator to watch instruction execution. Assembly language comprehension (probably, but not necessarily, by writing a program).

9. Basic Concepts of C - 2 Lectures

History of the C language, philosophical differences between C language design and Java. ANSI C. Basic form of a C program compared with that of a Java program. Using the compiler.

10. Control Structures - 2 Lectures

Sequence, branching and iteration in C compared with that of Java.

11. Basic Data Structures - 1 Lecture

Review of basic data types and operators in C.

12. Functions - 1 Lecture

Discussion of ways in which functions are implemented, and used in C, including parameter passing mechanisms.

13. Composite Data Structures - 1 Lecture

A first discussion of Arrays in C. Input/Output.

14. Software Support Tools - 1 Lecture

Make, Lint, Debuggers. Libraries and library utilities. Static/Dynamic analysers.

15. C Programming Style and Portability - 1 Lecture

Language standards. Portability. Programming standards.

16. Arrays, Pointers and Functions - 2 Lectures

A discussion of pointer data types, how they relate to arrays, and how they contrast with Java objects.

17. Dynamic Data Structures - 2 Lectures

Implementation of various record structures and dynamic structures. Pointers. Malloc. Examples in C. Parallels will be drawn with how the internals of Java do this for you.

18. Pitfalls - 1 Lecture

Major problem areas. Design rationale of C and of Java in problem areas.

19. Further Features - 1 Lecture

C preprocessor, header files, conditional inclusion, macro substitution, bitwise operators, casts, enumeration, scope, static and external declarations, separate compilation.

20. Case Studies of typical ANSI C programs - 4 Lectures

A small group of typical ANSI C programs will be presented and discussed as examples of good practice.

21. Exercises - 4 Practicals

Formative practicals covering the main features of the C language.

22. Representation of a typical C program in assembly language - 2 Lectures

Extending the material introduced earlier in the module to examine how a typical small C program is represented in assembly language after it has been compiled.

23. Exercises - 1 Practical

Formative practical covering the representation of a simple C program in assembly language.

24. The Structure of UNIX - 1 Lecture

An overview of the structure of the UNIX operating system and a description of the major components, including: the kernel, device drivers, IEEE POSIX and the terminal. An introduction to the programming interface to UNIX.

25. The Filesystem and Files - 1 Lectures

The function and system calls available from C to interact with files and filesystems.

26. Exercises - 1 Practical

Formative practical covering the use of C functions and system calls to interact with the facilities of the UNIX operating system.

27 Summary and Conclusion - 1 lecture

Drawing together the topics covered in the module.

Module Skills

Problem solving This is inherent in both the formative practical work and the assessed coursework.  
Research skills The students will need to search for and use relevant technical information while completing practical and assessed coursework.  
Communication Written skills will be needed to complete supporting documents to accompany assessed coursework.  
Improving own Learning and Performance See 2 above  
Team work No.  
Information Technology The whole module concerns this area.  
Application of Number No.  
Personal Development and Career planning Carefully time management will be needed as so to enable them to complete coursework etc.  
Subject Specific Skills They will develop a detailed knowledge of the internal functioning of a computer system and how programs gain access to the facilities of an operating system.  

Reading Lists

** Recommended Text
Prinz, Peter (Jan. 2006) C in a Nutshell O'Reilly Media, Incorporated 0596006977
Prinz, Peter. (2003) C :pocket reference /Peter Prinz and Ulla Kirch-Prinz ; translated by Tony Crawford. 0596004362
Tocci, Ronald J. (2003.) Microprocessors and microcomputers :hardware and software /Ronald J. Tocci, Frank J. Ambrosio. 0130609048
** Supplementary Text
Kelley, Al. (1998 (various p) A book on C :programming in C /Al Kelley, Ira Pohl. 0201183994
** Recommended Consultation
Haviland, Keith (1998.) Unix system programming :a programmer's guide to software development /Keith Haviland, Dina Gray, Ben Salama. 0201877589
Kernighan, Brian W. (1999.) The practice of programming /Brian W. Kernighan, Rob Pike. 020161586X
Raymond, Eric S. (2004.) The Art of UNIX programming /Eric Steven Raymond. 0131429019

Technical Reports
** Recommended Text
L.W. Cannon (1990) Indian Hill C Style and Coding Standards University of Toronto


This module is at CQFW Level 5