Linux programming in C

Duration: 5 days

Linux is the de facto standard operating system for smart Embedded devices. The C programming language provides a direct way to make use of the operating system features that enable the developers to optimize their components towards the limits of the hardware architecture.

For developers, Linux provides standard POSIX operating system interfaces including parallel processing, virtual memory mapping, signalling, inter-process communication, I/O multiplexing and debugging but also Linux-specific extentions and optimizations. GNU uClibc and musl projects provide C runtime library implementations with abstractions over operating system features like tasks, futexes and shared memory pages. Notable abstractions are threads, mutexes, semaphores, condition variables and message queues.

This workshop is intended for groups of C developers that would benefit from mastering POSIX operating system interfaces and Linux application debugging.

  • Operating system interface
    • POSIX, The Open Group
    • GNU
    • LLVM
  • Standard library options
    • GNU C Library (glibc)
    • uClibc
    • musl
  • Task management
    • Forking processes
    • Executing programs
    • Command-line arguments
    • Process lifecycle
  • Threading
    • Linux light-weight processes (LWP)
    • Mutexes and condition variables
  • Signals
    • Asynchronous handling
    • Atomic variables
    • Synchronous handling
    • Threading considerations
  • Service architecture
    • Master and forked workers
    • Server and clients
  • System services
    • Forking and double forking
    • Detaching and logging
    • Service manager integration
  • Interprocess communication
    • Pipes
    • Local sockets
    • Message queues
    • Shared memory pages
  • Synchronization tools
    • Shared memory cells
    • Peterson's algorithm
    • Real-time signals
    • Linux futex kernel interface
    • Semaphores
    • Mutexes and condition variables
    • Read-write mutexes
    • Sequential locks
  • I/O multiplexing
    • Non-blocking I/O
    • POSIX select and poll
    • Linux epoll and similar tools
    • Abstraction via libevent
  • Network sockets
    • IPv4 and IPv6
    • UDP and TCP
    • Socket options
    • Name resolution (getaddrinfo)
  • Tracing
    • Using ptrace interface (like debugging)
    • Tracing system calls
    • Tracing dynamic library calls
    • SystemTap considerations
  • Debugging
    • Examining symbols with binutils
    • Using ptrace interface
    • Working with GNU Debugger (gdb)
    • DWARF information in binaries
    • Separate debuginfo packages
  • Advanced debugging techniques
    • Disassembling
    • Debugging stripped binaries
    • Handling threads and processes
    • Scripting and altering program memory
    • Core dump analysis