Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scheduling problem with Posix threads #2355

Closed
vicuna opened this issue Jan 13, 2000 · 2 comments
Closed

Scheduling problem with Posix threads #2355

vicuna opened this issue Jan 13, 2000 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Jan 13, 2000

Original bug ID: 22
Reporter: administrator
Status: closed (set by @xavierleroy on 2006-06-17T09:54:06Z)
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Jerome Vouillon
Version:
OS:
Submission from: estephe.inria.fr (128.93.11.95)
Submitted by: xleroy

Dans l'exemple suivant, le programme utilisant les threads est
complètement bloqué par celui ne les utilisant pas...

-- Jérôme

mistral-jerome:/tmp > cat > essai.ml
let _ = let x = ref 0. in for i = 0 to 10000000 do x := !x *. 1.1 done
mistral-jerome:
/tmp > ocamlc -o essai essai.ml
mistral-jerome:/tmp > cat essai2.ml
let _ = Thread.create
let _ = let x = ref 0. in for i = 0 to 10000000 do x := !x *. 1.1 done
mistral-jerome:
/tmp > ocamlc -custom -thread -o essai2 unix.cma
threads.cma essai2.ml -cclib "-lunix -lthreads -lpthread"
mistral-jerome:~/tmp > time ./essai & time ./essai2
[1] 1292
./essai 13,21s user 0,01s system 98% cpu 13,470 total
[1] + done time ./essai
./essai2 12,97s user 0,02s system 49% cpu 26,415 total

[Damien Doligez:]
Pas reproductible sur Tru64. Feature de Linux Threads ?

[Jerome Vouillon:]
Voilà ce qui se passe :
Il y a un thread qui signale toutes les 50ms au thread s'exécutant à
ce moment là de laisser la place à un autre thread. Ce thread appelle
pour celà sched_yield. Comme il y a un autre processus qui peut
s'exécuter le thread ne reprend la main qu'après plus de 50ms... et
rappelle immédiatement sched_yield, car le thread horloge s'est
exécuté entre temps. Le thread principal n'a donc jamais l'occasion de
s'exécuter.

-- Jérôme

@vicuna
Copy link
Author

vicuna commented Jun 25, 2004

Comment author: administrator

May be related to #2663 and #2714

@vicuna
Copy link
Author

vicuna commented Jun 17, 2006

Comment author: @xavierleroy

Starting with 3.08, the thread library does more careful use of sched_yield().
The example given works OK in 3.09 under Linux 2.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant