Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Operating Systems Practical Work

Rating
-
Sold
-
Pages
3
Uploaded on
22-04-2026
Written in
2025/2026

Operating Systems Practical Work

Institution
ESSTHS

Content preview

École Supérieure des Sciences et de la Technologie de Hammam Sousse

TP : Système D’exploitation 2 Durée : 1h30 / Classe : LI1
Enseignant : Ben Khlifa Hamza Année universitaire : 2025-2026



💻 Correction TP3 : Gestion des Threads
Exercice 1 : Création d'un Thread (Facile)
Correction
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>

// Fonction ex cut e par le thread
void *fonction_thread(void *arg) {
printf("[Thread] ID: %lu - Bonjour depuis le thread secondaire !\n", pthread_self());
pthread_exit(NULL);
}

int main() {
pthread_t thread;

// Cr ation du thread
if (pthread_create(&thread, NULL, fonction_thread, NULL) != 0) {
perror("Erreur lors de la cr ation du thread");
exit(EXIT_FAILURE);
}

printf("[Main] ID: %lu - Bonjour depuis le thread principal !\n", pthread_self());

// Attendre la fin du thread secondaire
pthread_join(thread, NULL);

return 0;
}

Explication
• Un thread est créé et exécute fonction_thread().
• pthread_create() lance le thread.
• pthread_join() attend que le thread se termine avant de quitter.




1/3

Document information

Uploaded on
April 22, 2026
Number of pages
3
Written in
2025/2026
Type
Class notes
Professor(s)
Yassmine yazid
Contains
All classes

Subjects

$8.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
yassmineyazid

Also available in package deal

Thumbnail
Package deal
Operating Systems
-
10 2026
$ 89.90 More info

Get to know the seller

Seller avatar
yassmineyazid ESSTHS
View profile
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
2 weeks
Number of followers
1
Documents
73
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions