Page Personnelle de Vincent Kerhoas
Vincent Kerhoas
Enseignant du Supérieur
Professeur Agrégé
Page Personnelle de Vincent Kerhoas

System Programming

Back                  << Index >>

A few illustrated reminds about linux system programming.
For complete explanations, please have a look at : https://www.enib.fr/~harrouet


Every following examples can be downloaded here :



CODE

just write ‘make’ in a terminal to compile all of them.


Hello World

hello_world


Repeat

repeat


Calculate Average

repeat


Using Files ( Low Level)

file_low_level


Using Files ( High Level)


Exec Function


Redirections

file_low_level


Process and Fork

A process is a running program.
If you want to launch another process ( child ) in a running process ( parent ),
you have to use the FORK() function.
Both of them share the same code, but the memory allowed is different.
You can distinguish them with their PID ( Process ID ).

process_fork


Process Dialog : Pipes

Since processes don’t share the same memory, you can use pipes to exchange datas.

process_pipe


Process Dialog : Socket

Sockets can be used as pipes as well.

process_pipe


Process Dialog : Tubes and Redirection

process_redirect


Threads

Threads can be seen as ‘light’ processes. Threads created in a process share the same memory.


Calc with threads


Back                  << Index >>