EEN424 T (Systems Programming) Autumn 2012
Tues, Thurs at 5:00 pm in MM212

The Book

Examinations:

Assignments

     1    Due Thurs 27th Sept (part 1), Tues 2nd Oct (part 2).
                Binary Trees in a Primitive Language     
2 Due Sun 21st October.
Make a stdio library.
3 Due Thurs 1st November.
Conversion to C.
4 Due: Tuesday 20th November.
Make your own unix shell in C, part 1.
Split the command line into parts, allowing some basic kind of quoting, be able to execute any command that is implemented by another program (such as ls, a.out, cc, etc.) and whatever builtin commands you find useful for debugging and testing.
5 Due: 5pm Tues 6th November.
Do your assigned reading.
6 Due: Sun 9th December.
Make your own unix shell, part 2.
Email assignments to grader424 at rabbit.eng.miami.edu.
Put your full name and which assignment it is in the subject.

Class History

Class 1  Thur 23‑8‑2012   Quick introductions, etc.
The three main topics of the class are: C programming, shell scripting, Unix systems programming.
Why C is so annoying, and where it came from evolutionarily.
What a shell really is, A first little bit of shell scripting.
Class 2  Tue 28‑8‑2012   A more interesting script sample: easy file backups
An introduction to unix systems programming. How will we make this program do what we want?
Class 3  Thur 30‑8‑2012   fork() just duplicates a process,
but it can be tamed and put to good use. Working towards some parallel processing.
Class 4  Tue 4‑9‑2012   An odd mixture of C++, C, and unix functions completing our initial exploration of parallel processing with fork and pipe.
Class 5  Thur 6‑9‑2012   Sneaking up on C, Introduction to BCPL.
Class 6  Tue 11‑9‑2012   Microsoft announcement.
BCPL practice: hello world, output functions, formatted output and floats, boring factorial, sorting an array and pointers, random numbers and static variables, selectors and dos date/times.
Class 7  Thur 13‑9‑2012   Read manuals!
large compressed data structures,
The importance of dynamic memory allocation, making strings.
This is what the standard library looks like.
Class 8  Tue 18‑9‑2012   Low level tricks with bits.
C-style string processing, gets() and the buffer overrun problem.
Class 9  Thur 20‑9‑2012   Designing stdio to provide a convenient interface between the programmer and the low level operating system functions.
Class 10  Tue 25‑9‑2012   Dealing with inno's greed: what ungetc is all about.
The rest of the stdio design, how stdout can be made to work the same way as a FILE* for a real disc file.
Why array sizes must be constants, assembly language can be helpful: BCPL and assembly, but not always: C equivalent and AT&T/Intel assembly.
Class 11  Thur 27‑9‑2012   C and BCPL both had the same purpose. They were never intended for scientific, mathematical, or data processing tasks, and certainly not for learning programming. There were "nice", safe standard languages for all of those purposes: Algol, Pascal, Cobol.
C and BCPL were both designed to make the programming tasks that had previously required assembly language easier, and increase programmer productivity. BCPL makes no attempt to save the programmer from mistakes. C does, but only when that does not conflict with execution speed.
Even the introduction of numeric types brings with it complexities and disguised dangers.
Class 12  Tue 2‑10‑2012   In C: all about structs, the different namespaces, typedefs, partial declarations. Macros are very bad. The two subtly different ideas of what a constant is.
Class 13  Thur 4‑10‑2012   Arrays and the rules for pointer arithmetic in C.
Some type denotations are very complicated.
Class 14  Tue 9‑10‑2012   Function types, the signal catcher, corrected - I had forgotten something.
Unions and scanf, fully decoding the floating point format.
Class 15  Thur 11‑10‑2012   Separate compilation and linking, .h .o and .a files, cc -lm and so on.
Command line processing by shells, \ ' " $shell variable substitution, envirornemt variables are different, and aliasses.
Class 16  Tue 16‑10‑2012   What a shell must do, and how it can do it, part 1.
Class 17  Thur 18‑10‑2012   test topics, isatty, * and ? substitutions.
scanf is too clumsy when there may be something wrong with the input, use fgets and process the line yourself.
stat and struct stat and how to use them.
i-nodes that uniquely represent files, the structure of a directory, hard and soft (or symbolic) links.
Class 18  Tue 23‑10‑2012   Test Day.
Class 19  Thur 25‑10‑2012   All sorts of things to do with a shell starting a program. Basic: fork, execv, wait. Background: move wait into a SIGCHLD signal handler. Redirecting output to a file: fork, close 1, open. Piping A into B: pipe p, fork { close 1, dup p[1], close p[0], close p[1], execv A } fork { close 0, dup p[0], close p[0], close p[1], execv B } close p[0], close p[1]. Chaining together more than two programs needs even more pipes and dups and closes.
Class 20  Tue 30‑10‑2012   Announcement.
What we learned from the test. Don't forget the basics. Practice all the time!
Class 21  Thur 1‑11‑2012   Communications between processes: pipes (only possible for closely related processes), through files (slow and clumsy), through signals (low bandwidth, but a useful tool) signal list, through named pipes (mkfifo). Introducing sockets.
Class 22  Tue 6‑11‑2012   Announcement 1, Announcement 2.
Communicating through sockets.
Class 23  Thur 8‑11‑2012   Internet who am I? and where are you?.
Something's on the web. A TCP Client program, and a matching server.
Also a unix domain server and client.
Class 24  Tue 13‑11‑2012   Reading from multiple interactive streams: fcntl for non-blocking and asynchronous mode, things from <fcntl.h>.
Controlling a terminal, termios & tcsetattr to turn off echo and processing of special keys, and completely raw input and output.
Class 25  Thur 15‑11‑2012   Functions with unpredictable parameters like printf, using stdarg with "...". Setjmp and longjmp; extern, static, const, volatile, auto(matic), register, restricted. The 18th of January 2038.
Class 26  Tue 20‑11‑2012   time, strftime, users, modes, getrlimit, /proc.
Class 27  Tue 27‑11‑2012   Second Test.
Class 28  Thur 29‑11‑2012   Comparing threads with processes; memory spaces, the pthreads library, race conditions and the semaphore/mutex.