T1105

Ladda ner som PDF

Linux Systems Programming

System programming is the art of managing processes, signals, pipes, sockets, shared memory, messages queues, semaphores and more. In this course you will learn everything needed to start writing system level applications in Linux.

  1. The first part of the course explains in depth the contents and organization of processes, virtual memory, function calls using stack frames, linkage, memory management and more.
  2. The second part, explains all aspects of I/O, such as file systems, devices, file, system calls for I/O, memory mapped I/O, manipulation of file descriptors and more.
  3. The third part, deals with process creation (fork) and management, executables, signals and more.
  4. The fourth part, describes different ways to communicate between processes and threads, such as pipes, fifos, message queues, shared memory, semaphores, TCP sockets and more.

Every chapter contains a practical C/C++ programming exercise that illustrates the concepts and Linux API, discussed.

Målgrupp

C/C++ programmers

Förkunskaper

- Fluent in C/C++ programming

- Fluent in using a Unix/Linux system

- We will use Ubuntu Linux during the course

- Rudimentary knowledge about processes, threads and synchronization

- Understanding basic data structures

Content:

Application

Understanding the concept of a Linux application

The Process Concept

  • What is a process and dows it differ from a thread
  • Process meta-data

Virtual Address Space Organization

  • Virtual memory pages
  • Address translation
  • What happens during a page fault
  • Memory areas and their functions

Compilation and Linking

  • Overview of the various compilation steps
  • Understanding the magic number
  • Creating statically linked libraries
  • Creating dynamically linked libraries
  • Using programs to inspect compiled files such as string, nm, objdump, ldd

Understanding Function Calls

  • The call stack
  • The content of stack frames
  • The details of a single function call
  • Implementing variable number of function arguments
  • Using setjmp/longjmp
  • Understanding how longjmp is used when C++ throws an exception

Library and System Calls

  • What is call to a library
  • What is a system call
  • How is the kernel code invoked during a system call
  • Tracing library and system calls

Memory Management

  • What is dynamic memory anyway
  • The C APIs for using the heap
  • Brief about how to implement heap management
  • Estimating the current heap size
  • Implementing a C++ allocator for use with containers
  • Allocating memory blocks on the call stack
  • Tracking memory leaks with valgrind
  • The C++ APIs for using the heap

Creating Processes

  • Copying a process with fork
  • Special... Läs mer

Content:

Application

Understanding the concept of a Linux application

The Process Concept

  • What is a process and dows it differ from a thread
  • Process meta-data

Virtual Address Space Organization

  • Virtual memory pages
  • Address translation
  • What happens during a page fault
  • Memory areas and their functions

Compilation and Linking

  • Overview of the various compilation steps
  • Understanding the magic number
  • Creating statically linked libraries
  • Creating dynamically linked libraries
  • Using programs to inspect compiled files such as string, nm, objdump, ldd

Understanding Function Calls

  • The call stack
  • The content of stack frames
  • The details of a single function call
  • Implementing variable number of function arguments
  • Using setjmp/longjmp
  • Understanding how longjmp is used when C++ throws an exception

Library and System Calls

  • What is call to a library
  • What is a system call
  • How is the kernel code invoked during a system call
  • Tracing library and system calls

Memory Management

  • What is dynamic memory anyway
  • The C APIs for using the heap
  • Brief about how to implement heap management
  • Estimating the current heap size
  • Implementing a C++ allocator for use with containers
  • Allocating memory blocks on the call stack
  • Tracking memory leaks with valgrind
  • The C++ APIs for using the heap

Creating Processes

  • Copying a process with fork
  • Special process IDs
  • Terminating a process
  • What are zombies and daemons
  • Loading a new executable with exec
  • Implementing class Process

Input / Output

Different forms of performing I/O

File Systems

  • What is a file system
  • FS types
  • File types
  • Basic operations on files, from the kernel's perspective
  • I-nodes
  • Directory files
  • File descriptors
  • Devices
  • Mounting devices

The /proc file system

  • What is the /proc FS
  • Top-level info files
  • Process-specific info files
  • Reading /proc info files using C++

Regular I/O

  • How to use the kernel API of open/close
  • Opening modes
  • Setting file permissions
  • How to use the kernel API of read/write
  • Changing the file read/write position
  • Manipulating files in the file system
  • Using C++ fstream for binary record-oriented files

Advanced I/O

  • Manipulation of file descriptors
  • Using memory mapped I/O
  • Using non-blocking I/O
  • Using non-deterministic I/O
  • Implementing class MemoryMappedFile

Inter-process Communication (IPC)

Different forms of interchanging data between processes.

Signals

  • What are signals
  • Sending signals from the shell and from program code
  • Implementing signal handlers
  • Registering signals and signal masks
  • Implementing timeouts
  • Creating interval timers
  • Invoking longjmp from a signal handler
  • Implementing class GlobalSignalHandler
  • How to translate a signal, such as SEGV (segmentation fault) into a C++ exception

Channels

  • What is a channel
  • Pipes
  • Fifos
  • Implementing class Fifo

Message Queues

  • What is a message queue and how do it differ from a channel
  • Overview of the API
  • Usages
  • Implementing class MessageQueue

Shared Memory

  • What is shared memory
  • Overview of the API
  • Usages
  • Implementing class SharedMemory and use it as a C++ allocator

Semaphores

  • What is a semaphore
  • Memory vs file-system based semaphores
  • Overview of the API
  • Usages
  • Implementing class Semaphore
  • Implementing class FileSystemSemaphore
  • Implementing a message queue with semaphores for use in shared memory

TCP Sockets

  • What is a TCP socket
  • API overview
  • Network byte order (NBO)
  • Creating client sockets
  • Creating server-side sockets
  • Implementing class Socket
  • Implementing class ServerSocket
  • Implementing a iostreams compatible socket type

Kursfakta

Kurs-ID: T1105
Längd: 3 dag
Pris exkl moms: 26 950 kr
Inregistrering: 09.00
Kursstart: 09.30
Kursslut (ca): 17.00

Frågor om kursen?

Har du frågor om kursens innehåll, leveransdatum/ort eller behöver en företagsanpassad variant? Fyll i formuläret nedan!


Kan betalas med:
TRAINING CARD

Ort och datum

Stockholm
13 dec-15 dec
Boka nu!
19 mar-21 mar
Boka nu!
18 jun-20 jun
Boka nu!
Göteborg
13 dec-15 dec
R
Boka nu!
19 mar-21 mar
R
Boka nu!
18 jun-20 jun
R
Boka nu!
Malmö
13 dec-15 dec
R
Boka nu!
Cloud Access
i Läs mer

Delta på kursen från ditt hem, jobb eller annan plats.

13 dec-15 dec
Boka nu!
19 mar-21 mar
Boka nu!
18 jun-20 jun
Boka nu!

Tipsa