page header photo
share Twitter share LinkedIn

course Linux system programming

This course is specific to the Linux system

The course Linux system programming teaches C programmers the advanced mechanisms of the Linux kernel. This course does not offer a monotonous list of available system calls and library functions, but especially covers the underlying concepts.
In this LSP course we discuss subjects like process management (creation and transformation of processes), file access (the conventional way, but also the more advanced way via memory mapping) and directories, and all implementations of interprocess communication (pipes, signals, TCP/UDP sockets, POSIX IPC message queues/shared memory/semaphores).
Furthermore, we extensively discuss the way to develop multithreaded applications with help of the pthread library. This includes subjects like the life cycle of a thread (creation and termination), synchronisation techniques and the recognition of pit falls.

After completing this course, you can use the most advanced possibilities that are offered by the Linux kernel. Read more >>>

Target audience

  • Experienced programmers and software developers with extensive knowledge of the programming language  C and Linux that develop specialized system programs, like daemons or software for embedded applications.
Duration: 5 days       
Contact
Price € 2495.- plus VAT       

Scheduled dates

This course will be scheduled by request only, or as an in-company training. Our course administration maintains a waiting list of interested individuals. Joining that list is without obligation whatsoever.

Detailed information about this course

System calls

The Linux operating system offers a great variety of possibilities for file I/O, process management and interprocess communication. When a C programmer wants to fully exploit this functionality, thorough knowledge of the Linux system calls and the concepts behind these system calls is indispensible.

These system calls allow you to modify file properties and access file data efficiently. Moreover, new processes can be created and process credentials can be manipulated.

Apart from that, the Linux kernel supports a great diversity of mechanisms to transfer data between processes, either local or via a network. Interprocess communication (IPC) can be managed via the conventional pipe mechanism or via shared memory, semaphotres, message queues, signals or sockets.

Multithreaded programming

Multithreading is a programming technique where several threads of execution can be active in parallel within the boundaries of one process. Every thread of execution operates more or less independently within the surrounding process. In this way, several activities can be performed by one process (seemingly) in parallel. This programming technique becomes even more popular, mainly because multiprocessor systems are commonly used.
A multithreaded program is not built by adding some additional system calls or library calls in between the existing statements of your program. Multithreaded programming really requires another way of thinking, wondering continuously what the effect is of a piece of code whenever two or more threads execute it simultaneously.

Prerequisite knowledge

Knowledge of the programming language C is a must.
At least six months of practical experience with Linux (or another UNIX implementations) is desirable.

Technical content of the course

  • Process management
    Process creation, process transformation and process synchronisation. Influencing scheduling priority. Enquire and modify process limits. Enquire and modify process capabilities. Safe use of setuid bit and capabilities on executable file.

    System calls: fork, execl, execv, exit, wait, waitpid, sched_setscheduler, nice, setpriority, getrlimit, setrlimit, getpid, getppid, cap_get_proc, cap_set_proc, cap_free, cap_set_flag, getuid, setuid, seteuid.

  • File I/O
    System calls to create, open, read and write files, and system call to manipulate with the current offset of an opened file. Influence of various options when opening a file. Manipulate with file descriptors. Alternative access on files via memory mapping. Enquire and modify file properties. Monitor modifications on files and directories. File and record locking.

    System calls: open, creat, close, umask, read, write, lseek, fcntl, dup, mmap, munmap, stat, access, truncate, link, unlink, symlink, readlink, chmod, chown, utime, inotify_init, inotify_add_watch.

  • Directory I/O
    Enquire file names from directories. Enquire and modify current directory. Create and remove directories.

    System calls and functions: opendir, readdir, rewinddir, mkdir, rmdir, chdir, getcwd.

  • Device I/O
    Enquire and modify device properties. I/O multiplexing (monitor multiple file descriptors simultaneously).

    System calls: ioctl, select.

  • Pipes
    Setup new pipes. Properties of pipes. Communication via pipes. Pipes with more than one reader and/or writer. Properties and use of named pipes (fifo files)

    System calls and functions: pipe, mknod, mkfifo.

  • Signals
    Signal types. Sending conventional signals and realtime signals. Use of timers. Signal handling in a conventional way. Block and release signals by receiveing process (reliable).

    System calls: kill, signal, pause, alarm, getitimer, setitimer, sigprocmask, sigaction, sigpending, sigsuspend.

  • POSIX IPC
    Setup and gain access to shared memory segments. Synchronise processes/threads with semaphores. Send en receive messages between processes via message queues.

    System calls: shm_open, shm_unlink, sem_open, sem_close, sem_unlink, sem_post, sem_wait, sem_post, sem_init, sem_destroy, mq_open, mq_close, mq_send, mq_receive, mq_setattr, mq_getattr.

  • Sockets
    The socket API. Streams sockets versus datagram sockets. Client-server model. Setup of active socket from client process. Setup of passive socket from server proces. Socket domains and addresses. UNIX domain sockets. TCP/IP sockets (TCP and UDP communication). Translate host names and service names to address info (for IPv4 and for IPv6). Sending broadcasts.

    System calls and functions: socket, connect, bind, listen, accept, getaddrinfo, recvfrom, sendto.

  • Daemonising
    Relations between processes (sessions, process groups, controlling tty). Sequence of actions that allow permanently active processes to run autonomously.

    System calls and functions: getsid, setsid, getpgrp, setpgid.

  • POSIX pthreads
    Thread model used by Linux (tasks, thread group). Thread creation and termination (voluntary or forced). Synchronisation of threads with help of mutexes and condition variables. Use of global variables. Use of thread-safe system calls and functions. Attributes of a thread. Per-thread variables. Threads and signals. Consequences for specific Linux system calls.

    System calls and functions: clone, pthread_create, pthread_self, pthread_equal, pthread_exit, pthread_cancel, pthread_setcancelstate, pthread_testcancel, pthread_join, pthread_detach, pthread_mutex_lock, pthread_mutex_unlock, pthread_mutex_trylock, pthread_cond_wait, pthread_cond_timedwait, pthread_cond_signal, pthread_cond_broadcast, pthread_attr_..., pthread_sigmask, pthread_cleanup_push, pthread_cleanup_pop, pthread_key_create, pthread_key_getspecific, pthread_key_setspecific.

Documentation

Course attendants will receive a student pack containing copies of the presentations, lab exercises, answers to the exercises, and background information.

The course material is in English, and the teaching language will be English unless the attendants prefer the Dutch language unanimously.

Certificate

Shortly after the course the student will receive a certificate as a proof of participation.

Valid XHTML 1.0 Strict   Valid CSS2