Module Identifier CS23420  
Module Title COMPUTER ARCHITECTURE, C AND UNIX SYSTEMS PROGRAMMING  
Academic Year 2005/2006  
Co-ordinator Mr David E Price  
Semester Semester 1  
Other staff Dr Adrian D Shaw, Mr David E Price, Dr David Barnes, Mr Peter Hoskins, Mr Richard C Shipman  
Pre-Requisite CS10110 or equivalent prior knowledge  
Co-Requisite CS21120  
Mutually Exclusive CS23710, CI33710, CS15410, CI25410  
Course delivery Lecture    
  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
Assessment TypeAssessment Length/DetailsProportion
Semester Exam2 Hours WRITTEN EXAMINATION  40%
Semester Assessment75 Hours 3 PIECES OF SOFTWARE DEVELOPMENT COURSEWORK  60%
Supplementary Assessment WILL TAKE THE SAME FORM, UNDER THE DEPARTMENTS' POLICY  100%
Further details http://www.aber.ac.uk/compsci/ModuleInfo/CS23420  

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 and the POSIX operating systems interface.

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, 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 address the structure of the UNIX operating system and the interface presented by functions and system calls for use from C.

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

Content

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 - 4 LecturesSome 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. Exercises - 3 Practicals

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

8. 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.

9. Control Structures - 2 Lectures

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

10. Basic Data Structures - 1 Lecture

Review of basic data types and operators in C.

11. Functions - 1 Lecture

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

12. Composite Data Structures - 1 Lecture

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

13. Software Support Tools - 1 Lecture

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

14. C Programming Style and Portability - 1 Lecture

Language standards. Portability. Programming standards.

15. Arrays, Pointers and Functions - 2 Lectures

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

16. 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.

17. Pitfalls - 1 Lecture

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

18. Further Features - 1 Lecture

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

19. Exercises - 4 Practicals

Formative practicals covering the main features of the C language.

20. 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.

21. Exercises - 1 Practical

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

22. 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.

23. The Filesystem and Files - 3 Lectures

The structure of the filesystem and associated operations. The types of file and the operations on files. The function and system calls available from C to interact with files and filesystems.

24. Process Management - 3 Lectures

The manipulation of processes and interprocess communication. The function and system calls available from C to interact with processes and communication between them within a single computer.

25. Communications Support - 3 Lectures

The support for communication between processes separated by network connections. The function and system calls available from C to enable inter process communication across networks.

26. Exercises - 3 Practicals

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

27 Summary and Conclusions - 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

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

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

Notes

This module is at CQFW Level 5