Module Identifier CS23710  
Module Title C AND UNIX SYSTEMS PROGRAMMING  
Academic Year 2000/2001  
Co-ordinator Dr Mark Ratcliffe  
Semester Semester 2  
Pre-Requisite CS22210  
Co-Requisite CS21120  
Course delivery Lecture   19 lectures  
  Practical   (Up to) 15 x 2 hr sessions  
Assessment Course work   Four pieces   100%  
  Supplementary examination   Will take the same form, under the terms of the Department's policy    

General description
The main objectives of this course are to teach the basic features of the C programming language, the structure of the UNIX operating system and the UNIX interface to the programmer.

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

The second 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.

Aims
The aim of this course is to teach the student the fundamentals of the C language. In order to compare the facilities and underlying philosophy of C with that of Java, the first part of the course will draw closely on the material that is covered in CS21120 .

The UNIX operating system is studied as an example of the operating systems material covered in CS22210 and also as an application of the C language.

Learning outcomes
The detailed objectives of this module are:

Syllabus
1. Basic Concepts - 1 Lecture
History of the C language, philosophical differences between C language design and Java. Basic form of a C program compared with that of a Java program. Using the compiler.

2. Control Structures - 2 Lectures
Sequence, branching and iteration in C compared with that of Java.

3. Basic Data Structures - 1 Lecture
Review of basic data types and operators in C.

4. Subprograms - 1 Lecture
Discussion of ways in which functions are implemented, and used in C, including parameter passing mechanisms.

5. Composite Data Structures - 1 Lecture
A first discussion of Arrays in C. Input/Output.

6. Software Support Tools - 1 Lecture
Make, Lint, Debuggers. Libraries and library utilities. Static/Dynamic analysers.

7. C Programming Style and Portability - 1 Lecture
Language standards. Portability. Programming standards.

8. Arrays, Pointers and Functions - 2 Lectures
A discussion of pointer data types, how they relate to arrays, and how they contrast with Java objects.

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

10. Pitfalls - 1 Lecture
Major problem areas. Design rationale of C and of Java in problem areas.

11. Further Features - 1 Lecture
C preprocessor, header files, conditional inclusion, macro substitution, bitwise operators, casts, enumeration, scope, static and external declarations, separate compilation.

12. 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, the filesystem, the process, interprocess communication, the terminal. An introduction to the programming interface to UNIX.

13. The Filesystem and Files - 1 Lecture
The structure of the filesystem and associated operations. The types of file and the operations on files.

14. The Terminal - 1 Lecture
A study of the general interface.

15. Standards - 1 Lecture
ANSI 'C'; IEEE POSIX; UNIX International SVID; XOPEN XPG; COSE

16. Window systems and Event-Driven Programming - 1 Lecture
An appreciation of some of the problems involved in the programming of applications which interact with the X window system. Includes studying event-driven programming techniques.

Reading Lists
Books
** Recommended Text
L. Ammeraal. (1991) C for Programmers [Access to either Ammeraal or Kelley and Pohl will normally be sufficient.]. Wiley
C. Brown. (1994) UNIX Distributed Programming [Only one of Robbins and Robbins or Brown is required.]. Addison Wesley
A. Kelley and I. Pohl. (1995) A Book on C: programming in C [Access to either Ammeraal or Kelley and Pohl will normally be sufficient.]. 3rd. Benjamin Cummings
Kay A. Robbins and Steven Robbins. (1996) Practical Unix Programming (A guide to concurrency, Communications and Multithreading) [Only one of Robbins and Robbins or Brown is required.]. Prentice Hall PTR
** Consult For Futher Information
J. Cox and B. Goodheart. (1994) The Magic garden.. Prentice Hall
B.W. Kernighan and D. Ritchie. (1988) The C Programming Language - 2nd Edition. Prentice Hall
Andrew Koenig. (1988) C - Traps and Pitfalls. Addison Wesley
P. Van der Linden. (1994) Expert C Programming, Deep C Secrets. Prentice Hall
L. Hatton. (1994) Safer C, Developing Software for High-integrity and Safety-critical Systems. McGraw-Hill

Technical Reports
L.W. Cannon et.al.. (1990) Indian Hill C Style and Coding Standards [This highly recommended document is available in the home directory of user cmk as misc/c/docs/ihstyle.ps.]. University of Toronto