Chabot CollegeFall 2002

Removed Fall 2006

Course Outline for Computer Science 18B

LINUX SYSTEMS PROGRAMMING I

Catalog Description:

18B - Linux Systems Programming I2 units

Introduction to the Linux operating system and its resources. Concepts of multi-tasking operating systems, system calls, process control. Basic Linux shells, file handling, inter-process communication, and resource sharing. Prerequisite: Computer Science 15 or Computer Science 18A and Computer Science 42 (all completed with a grade of C or higher). 1.5 hours lecture, 1.5 hours laboratory.

Prerequisite Skills:

Before entering the course the student should be able to:

  1. explain the steps in the software engineering lifecycle;
  2. use accepted design methods (structure charts, pseudocode, simple class diagrams) to develop and code several (six-ten) programs of intermediate difficulty and length in the C++ language, including programs broken into several files;
  3. adhere to style and documentation standards in writing programs;
  4. use system debuggers to step into and over code, set breakpoints and watch variables;
  5. identify what makes a good test data suite and use it to thoroughly test a program under development;
  6. write C++ overloaded functions, simple recursive functions, function templates;
  7. define, initialize, dereference and manipulate pointers;
  8. manipulate arrays using pointer notation;
  9. define, design and use simple C++ classes, including at least one project that uses a class inheritance hierarchy;
  10. manipulate both standard C-strings using the cstring library and string objects using the ANSI string library;
  11. overload C++ operators both as member functions and friend functions;
  12. define and use virtual member functions to implement polymorphic behavior;
  13. identify bitwise, unary and binary scope resolution, and conditional operators;
  14. use the new and delete operators to implement a singly linked list;
  15. be proficient in using UNIX tools;
  16. know about the Linux variant of UNIX;
  17. have a working knowledge of enhanced UNIX shells;
  18. be able to program and use shell scripts;
  19. have a basic knowledge of awk;
  20. be familiar with process control;
  21. be familiar with security issues;
  22. be familiar with basic system administration concepts and procedures.

Expected Outcomes for Students:

Upon completion of the course the student should be able to:

  1. identify the differences between the C standard libraries and Linux libraries;
  2. design, write, debug and document well-structured programs of small- to medium- length in the C language, using Linux system resources and the Linux libraries;

3.demonstrate familiarity with processes under Linux and create, signal, and kill processes;

4.demonstrate familiarity with Linux multitasking and describe, at a high level, how multitasking is done in Linux;

  1. demonstrate familiarity with semaphores in Linux and write C programs that correctly use semaphores;

Chabot CollegePage 2

Course Outline for Computer Science 18B

Fall Semester 2002

Expected Outcomes for Students: continued

  1. demonstrate familiarity with interprocess communication (IPC) signals in Linux and write C programs that correctly send and handle signals;
  2. demonstrate familiarity with shared resources (such as shared memory) in Linux and write C programs that correctly use shared resources;
  1. demonstrate familiarity with other Linux IPC tools, such as pipes and message queues, and write C programs that use these tools;
  2. identify parent and child processes, and user and group ids of processes;
  3. demonstrate familiarity with the internal workings of a simple shell, and write a simple shell;
  4. demonstrate familiarity with daemons and write a simple daemon;
  5. handle runtime errors from within C programs;
  6. demonstrate familiarity with networks as a user.

Course Content:

  1. The Linux operating system overview
  1. Differences between Linux and other UNIX variations, the GNU software license
  2. Multi-tasking and multi-user operating systems, the kernel, shells and processes
  3. Linux system calls vs. C library calls, user mode vs. kernel mode
  1. Review development tools
  1. gcc and make

3.Linux O/S services

  1. The unistd library and system services
  2. Manipulating processes, environment variables, setuid and setgid programs

b.Getting user and process information, process and parent ID's

  1. Managing processes: system(), fork() and the exec() family of system calls, wait()
  2. Killing processes, exit(), abort() and kill()

4. Signals

  1. More about kill(), the kill command and the kill() function
  2. Waiting for events, alarm(), pause(), general signal handling with the signal library
  3. Using a signal handler
  1. System calls
  1. The difference between C library and system calls, why do you need system calls?
  2. Classes of system calls: process management, file I/O, memory management, and signal handling and IPC
  3. Error codes from system calls and how to handle errors
  1. Basic Linux file handling
  1. The difference between C-library file handling and Linux kernel file handling
  2. File permissions and types, introduction to special files and devices (FIFO, device, symbolic link, regular file, socket, directory, block device)
  3. The file mode bits: type, access and modifier; the umask
  4. The file handling interface: stat(), open(), creat(), close(), read(), write(), lseek(), etc.
  5. Stream and random access files
  1. The GNU debugger (Optional)
  1. Using gdb for logic and memory errors
  2. Types of memory bugs (leaks, corruption and illegal access).
  3. Other debugging tools (for example, Electric Fence, mpr, mcheck)

Chabot CollegePage 3

Course Outline for Computer Science 18B

Fall Semester 2002

Methods of Presentation:

1.Lecture

2.In-class example programs with explanations and demonstrations

Assignments and Methods of Evaluating Student Progress:

  1. Typical Assignments
  2. Small programming assignments illustrating main points from lecture

1)Create a program that uses fork() and exec() to create a child process, and then waits for the child to exit inside the parent process.

2)Create a program that prints its own ID and group ID and its parents ID and group ID.

  1. Non-programming homework to reinforce concepts from lectures and reading

1)At the command line, create and suspend several processes from several different shells, then run ps. Use the output from ps to write a genealogy of the processes.

2)Use gdb to trace execution of a program and report statistics on the systems calls.

2.Methods of Evaluating Student Progress

a.Midterm exam(s)

b.Optional short quizzes

c.Final Exam

Textbook(s) (Typical):

Linux Programming by Example, Kurt Wall, Que Corporation, 2000

Special Student Materials:

Computer lab fee

Diskettes

Optional zip disk

July 2001 Keith Mehl

Hps

CS 18B Outline Fall 2002