Click here to Skip to main content
15,915,319 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Impact of synchronization on application performances Pin
Ahmed Charfeddine19-Aug-08 6:53
Ahmed Charfeddine19-Aug-08 6:53 
GeneralRe: Impact of synchronization on application performances Pin
Jijo.Raj19-Aug-08 7:19
Jijo.Raj19-Aug-08 7:19 
GeneralRe: Impact of synchronization on application performances Pin
Ahmed Charfeddine19-Aug-08 21:50
Ahmed Charfeddine19-Aug-08 21:50 
GeneralRe: Impact of synchronization on application performances Pin
Cedric Moonen19-Aug-08 7:22
Cedric Moonen19-Aug-08 7:22 
GeneralRe: Impact of synchronization on application performances Pin
Ahmed Charfeddine20-Aug-08 0:39
Ahmed Charfeddine20-Aug-08 0:39 
GeneralRe: Impact of synchronization on application performances Pin
Cedric Moonen20-Aug-08 1:08
Cedric Moonen20-Aug-08 1:08 
GeneralRe: Impact of synchronization on application performances Pin
Ahmed Charfeddine20-Aug-08 1:37
Ahmed Charfeddine20-Aug-08 1:37 
GeneralRe: Impact of synchronization on application performances Pin
Cedric Moonen20-Aug-08 2:11
Cedric Moonen20-Aug-08 2:11 
(I'll switch to english if you don't mind, because it is an international website)

hINTModuleState wrote:
Meme faire des write ou des read sur un bool c'est pas syncronisé par défaut.


No, when you have multiple writers you can have a problem when incrementing a variable. Incrementing a variable is done in 3 steps: fetching the value in a registry, incrementing it and putting it back in memory. If two threads try to increment the variable at the same time, you can see the issue I guess (one thread fetches the value, the other one two and then they both increment their local variable).
But, when you have only one writer, you don't have such a problem. Furthermore, as said in the article, reading or writing a 32 bit value is atomic: you fetch it in one step from the memory.


hINTModuleState wrote:
B et A peuvent rentrer concuremment dans les deux blocs :
B prend la meme valueur iStartCount positionné par A,
ensuite A lmodifie name, et B prend la valeur corrompue en meme temps que lui,
finalement un context switch se déclenche sur B et donc A a le temps pour rendre iEndCount semblable à iStartCount, ensuite B revient fait la compariason et donc juge que sa copie n'est pas corrompue.
Déjà il y a un scénario très mauvais selon quoi la valeur de iEndCount retenue par B est > que iStartCount, et cela qd le context switch effectué sur B permet à A d'exécuter encore une autre fois le bloc sité, et dans ce cas ma boucle reste infinie.....
Bon biensur ma boucle, peut etre que j'ai maladroitement implémenté votre idée (bien ke meme is B fait une copie de iStartCount et iEndCount avant name, alors il un autre scénario bizarre ici ki peu avoir lieu..


Mmmh, yes it seems that I overlooked something here. I need to think a bit deeper to that.

Cédric Moonen
Software developer

Charting control [v1.4]
OpenGL game tutorial in C++ [Part 2 online]

GeneralRe: Impact of synchronization on application performances Pin
Cedric Moonen31-Aug-08 22:35
Cedric Moonen31-Aug-08 22:35 
QuestionHow to get the full path of a file (Win32 api) Pin
ice87111719-Aug-08 4:43
ice87111719-Aug-08 4:43 
AnswerRe: How to get the full path of a file (Win32 api) Pin
David Crow19-Aug-08 5:07
David Crow19-Aug-08 5:07 
QuestionRe: How to get the full path of a file (Win32 api) Pin
led mike19-Aug-08 5:27
led mike19-Aug-08 5:27 
AnswerRe: How to get the full path of a file (Win32 api) Pin
ice87111720-Aug-08 19:26
ice87111720-Aug-08 19:26 
AnswerRe: How to get the full path of a file (Win32 api) Pin
Member 419459319-Aug-08 7:40
Member 419459319-Aug-08 7:40 
QuestionCString Format Help Pin
locoone19-Aug-08 4:41
locoone19-Aug-08 4:41 
AnswerRe: CString Format Help Pin
David Crow19-Aug-08 5:15
David Crow19-Aug-08 5:15 
AnswerRe: CString Format Help Pin
sudhir_Kumar19-Aug-08 5:29
sudhir_Kumar19-Aug-08 5:29 
Questionboost exe problem vs8 Pin
andymonaco19-Aug-08 4:23
andymonaco19-Aug-08 4:23 
AnswerRe: boost exe problem vs8 Pin
santhoshv8419-Aug-08 20:57
santhoshv8419-Aug-08 20:57 
AnswerRe: boost exe problem vs8 Pin
andymonaco19-Aug-08 23:05
andymonaco19-Aug-08 23:05 
QuestionWhere should I post queries about Windows Drivers? Pin
Numero Uno19-Aug-08 3:09
Numero Uno19-Aug-08 3:09 
AnswerRe: Where should I post queries about Windows Drivers? [modified] Pin
Rajesh R Subramanian19-Aug-08 3:11
professionalRajesh R Subramanian19-Aug-08 3:11 
GeneralRe: Where should I post queries about Windows Drivers? Pin
Roger Stoltz19-Aug-08 3:18
Roger Stoltz19-Aug-08 3:18 
GeneralRe: Where should I post queries about Windows Drivers? Pin
Rajesh R Subramanian19-Aug-08 3:30
professionalRajesh R Subramanian19-Aug-08 3:30 
Question::ShellExecuteA Pin
T.RATHA KRISHNAN19-Aug-08 2:55
T.RATHA KRISHNAN19-Aug-08 2:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.