GNU/Linux System Programming And Kernel Development

Submitted by Chandrashekar Babu on June 12, 2006 - 10:47pm.
::



Duration of the course: 96 hours
Prescribed schedule: 8 hours a week, spanning to 3 months
Required skills: Good knowledge on C programming and data structures, Knowledge of computer hardware architecture and internals


Description
This course is meant for students and professionals aspiring to be Linux system programmers and/or kernel developers. The focus is mainly on building strong foundation and clear understanding of the Linux development platform. Participants of the course are expected to devote time in practising sample programs, exploring sources and writing assignments on a regular basis.
This course is NOT meant to morph you into an expert Linux kernel/device-drivers guru (infact, no course in this world would). But it is intended to give you a smooth introduction into the world of Linux development.
Like I always say: I'll teach you how to drive, but its upto you to become a successful motor racing driver!

  • GNU/Linux architecture
    • Linux kernel architecture
    • Linux kernel interfaces
      • System call interface
        • System call numbers
        • System call implementation
        • System call context
      • /dev interface
      • /proc interface
      • /sys interface
      • ioctl interface
    • Programs and Libraries
      • Types of files
      • File permissions and ownership
      • Linux executable programs
      • Shared objects and dynamic linking
    • Linux kernel components
      • Device drivers, modules and arch-dependent code.
      • Linux kernel subsystems

  • Development tools for the GNU/Linux platform
    • Programming environment
      • Primer on the vim editor
      • Primer on the Emacs editor
      • Other notable editors and development environments
    • The GNU compiler toolchain
      • Introduction to GCC compiler suite
      • Basic compiler options
      • GCC optimizer
      • Architectural optimizations
      • Debugging options
      • Miscellaneous options
    • GNU make, automake and autoconf
    • GNU gprof, and GNU gcov tools
    • GNU/Linux libraries
    • Static, Shared and Dynamically linked libraries
    • Library management utilities
    • GNU Debugger (GDB)
    • Valgrind

  • Environment of a GNU/Linux process
    • Userspace programs Vs. Kernelspace programs
    • Flow of a userspace C program on Linux
      • main() function
      • Process termination
        • Normal termination
        • Abnormal termination
        • atexit() function
    • Flow of a kernel-space module on Linux
      • init_module() and cleanup_module() functions
      • module_init() and module_exit() macros
      • The __init, __exit and __initdata macros
    • Parameters of a C program
      • Command line arguments
      • Environment list
      • getenv() function
      • putenv() function
    • Command line arguments to kernel modules
    • Memory layout of a C program
      • Text segment
      • Initialized data segment
      • Uninitialized data segment
      • Stack
      • Heap
    • Memory management
      • Memory pages and zones
      • The kernel slab allocator interface
      • Static allocation on stack within kernelspace
      • malloc(),alloca(), calloc() and realloc() functions
      • free() function
      • brk() and sbrk() function
    • Resource limits
      • getrlimit() and setrlimit() function

  • Process Management
    • Introduction to processes
      • Process hierarchies
      • Process states
      • Process descriptor and task structure
      • Process context
    • Process control
      • Process identifier
      • Getting various identifiers for the process
      • Creating new processes
        • Copy-On-Write policy
        • fork() function
        • vfork() function
        • Terminating a process
          • exit() functions
        • Waiting for a child process to exit
          • wait() and waitpid() functions
          • wait3() and wait4() functions
        • Getting process termination status
          • WIFEXITED(), WIFSIGNALED(), WIFSTOPPED() macros
        • Overlaying the current process
          • exec() functions
        • The system() function
        • Changing user-id and group-id of a process
          • setuid() and setgid() functions
          • setreuid() and setregid() functions
          • seteuid() and setegid() functions
        • Process groups
          • getpgrp() function
          • setpgid() function
        • Sessions
          • setsid() function
        • Controlling terminal
          • The tcgetpgrp() and tcsetpgrp() functions
        • Threads and Light weight processes
          • Kernel Threads
          • LWP
          • User Threads
        • The POSIX Threads library (Pthreads)
          • Multi-threading concepts and Threading models
          • Thread management
          • Mutexes
          • Conditional variables
          • Stack management
          • The Native POSIX Threading Library (NPTL)
        • Process scheduling
          • Scheduling policy
            • I/O bound Vs. Processor bound
            • Priority and Timeslice
          • Process Preemption and Context switching
          • Load balancer
          • Scheduler relevant system calls

      • File system interface
        • Organization of Linux/UNIX filesystem
        • Linux kernel filesystem abstraction layer
        • VFS and their relevant data structures
        • Superblock, Inode, Dentry and File objects
        • File descriptors
        • Functions for file I/O
          • open() function
          • close() function
          • creat() function
          • read() function
          • write() function
          • lseek() function
          • dup() and dup2() functions
          • fcntl() function
          • ioctl() function
        • Functions for accessing files
          • stat(), fstat() and lstat() functions
          • File types
        • File permissions and ownership
          • access(), chmod() and fchmod() functions
          • umask() function
          • chown(), fchown() and lchown() functions
          • SUID and SGID
          • The sticky bit
        • Functions for filesystem operations
          • link() function
          • unlink() function
          • symlink() function
          • readlink() function
          • mknod() function
          • sync() and fsync() functions
          • mount() and umount() functions
        • Miscellaneous file functions
          • truncate() and ftruncate() functions
          • utime() function
        • Functions for directory operation
          • mkdir() and rmdir() functions
          • chdir(), fchdir() and getcwd() functions
          • chroot() function
          • opendir(), closedir() and rewinddir() function
        • The kernel Block I/O layer
          • Block device layout and architecture
          • Buffers and Cache
          • I/O Schedulers

      • The GNU C Library
        • Introduction to GNU libc
        • Character, String and Array handling functions
          • strverscmp(), rawmemchr(), strstr()
          • strspn(), strdup(), strsep(), basename(), dirname()
          • strfry(), memfrob(), a64l(), l64a()
        • Searching, sorting and pattern matching functions
          • lfind(), lsearch(), bsearch()
          • qsort(), hcreate(), hdestroy(), hsearch()
          • tsearch(), tfind(), tdelete(), twalk()
        • File and stream I/O functions
          • fopen(), freopen(), flose(), floseall()
          • flockfile(), ftrylockfile(), funlockfile(),
          • fgetc(), fputc(), fgets(), fputs(), getline(), ungetc()
          • fread(), fwrite()
          • Filesystem interface functions
          • Terminal interface functions
          • Syslog interface functions
          • Date, time, math and cryptographic functions
          • Miscellaneous functions and API

        • Device drivers and I/O
          • Types of devices
            • Character devices
            • Block devices
            • Pseudodevices
            • Major and minor device numbers
          • Invoking device driver code
            • Configuration
            • I/O
            • Control
            • Interrupts, Interrupt Handlers and Bottom Halves
            • Softirqs, Tasklets and Work queues
          • I/O Multiplexing
            • select() function
            • poll() function
          • Memory mapped I/O
            • mmap() function
            • munmap() function
            • msync() function
          • Kernel locking and synchronization
            • Deadlocks, Contention and Scalability
            • Atomic operations
            • Spin Locks
            • Semaphores
            • The Big Kernel Lock
            • Seq Locks
          • Project: Implement a robust kernel-space "Recycle bin"

        • Interprocess Communication
          • Signals
            • Signal Concepts
            • Different types of signals
            • signal() function
            • kill() and raise() functions
            • alarm() and pause() functions
            • Signal sets
              • sigemptyset() and sigfillset() functions
              • sigaddset() and sigdelset() functions
              • sigismember() function
              • sigprocmask() function
              • sigpending() function
              • sigsuspend() function
          • Pipes
            • Introduction
            • pipe() function
            • popen() and pclose() functions
          • FIFOs
            • Introduction
            • mkfifo() function
          • Message queues
            • Introduction
            • msgget() function
            • msgctl() function
            • msgsnd() function
            • msgrcv() function
          • Semaphores
            • Introduction
            • semget() function
            • semctl() function
            • semop() function
          • Shared memory
            • Introduction
            • shmget() function
            • shmctl() function
            • shmat() function
            • shmdt() function
            • Memory mapping of /dev/zero (SVR4)
            • Anonymous memory mapping (4.3+ BSD)

        • Networking with Sockets
          • Basic socket operations
            • Creating a socket using socket() function
            • Establishing connections
            • Binding an address to a socket using bind() function
            • Waiting for connections using listen() and accept() functions
            • Connecting to a server using connect() function
          • UNIX Domain Sockets
            • UNIX domain addresses
            • Waiting for a connection
            • Connecting to a server
            • Unnamed UNIX domain sockets
          • Networking with TCP/IP
            • Byte ordering
              • htonl(), htons(), ntohl() and ntohs() functions
                • IPv4 addressing
                • IP socket addresses
                  • The sockaddr_in structure
                • Manipulating IP addresses
                  • inet_ntoa() function
                  • inet_addr() function
                  • inet_aton() function
                • Using hostnames
                  • The hostent structure
                • Host information lookup
                  • gethostbyname() and gethostbyaddr() functions
                • A TCP Server implementation
                • A TCP Client implementation
                • Socket errors
          • A small network application project