<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Andrei Tra wrote:
<blockquote cite="mid:100827.64399.qm@web30204.mail.mud.yahoo.com"
type="cite">Salut,<br>
Observasem ca la mine rulau toate testele pe Windows bine, exceptand
testul 8 care in cca. 1 data din 4, dadea eronat ( eroarea consta in
max. 3 cuvinte care nu apareau in ordinea in care trebuie ). Am
reverificat algoritmii si in final am ajuns la apelul Sleep(), astfel
ca am facut o comparatie intre cat dureaza efectiv functia ( valoarea
'Actually slept' ) si cat "i s-a cerut sa dureze" ( valoarea
'requested') ( caz concret, pe testul 8 ). Cateva exemple din fisierul
de log (timpii sunt exprimati in milisecunde ):<br>
<br>
Actually slept: 1875 ( requested: 1800 ) ( + 75 )<br>
Actually slept: 2203 ( requested: 2100 ) ( + 103 )<br>
Actually slept: 2312 ( requested: 2200 ) ( + 112 )<br>
Actually slept: 3140 ( requested: 3100 ) ( + 40 )<br>
Actually slept: 3406 ( requested: 3400 ) ( + 6 )<br>
<br>
Concluzia e ca timpul efectiv de asteptare poate diferi de cel
solicitat intr-o plaja destul de larga, astfel ca ( presupun ) nu e
imposibil sa mai apara unele neconcordante intre rezultatul corect al
testului si cel furnizat de program (neconcordante mici insa), in
"anumite" conditii de rulare.<br>
Ar mai putea cineva sa efectueze niste teste similare, in scop de
verificare?<br>
</blockquote>
Eu am facut altfel - am banuit functia Sleep(), asa ca am trecut la
WaitableTimer. Fara ca totusi rezultatul sa se schimbe.<br>
<br>
Am postat acum vreo 2 zile un fisier de logging (de pe ultima
varianta, cu WaitableTimer), care arata cam asa:<br>
<br>
1-31350239:Sleeping for 50 ms;
<br>
1-31350289:sending command <code class="moz-txt-verticalline"><span
class="moz-txt-tag">|</span>a picasso<span class="moz-txt-tag">|</span></code>
//La 289 primul client a iesit din sleep, si trimite deja comanda spre
server
<br>
1-31350289:Sleeping for 200 ms;
<br>
1-31350489:sending command <code class="moz-txt-verticalline"><span
class="moz-txt-tag">|</span>a philippine<span class="moz-txt-tag">|</span></code>
<br>
1-31350489:Sleeping for 200 ms;
<br>
1-31350689:sending command <code class="moz-txt-verticalline"><span
class="moz-txt-tag">|</span>a sofia<span class="moz-txt-tag">|</span></code>
<br>
<br>
2-31350299:sending command <code class="moz-txt-verticalline"><span
class="moz-txt-tag">|</span>a albertina<span class="moz-txt-tag">|</span></code>
//In timp ce al doilea client porneste abia la 299, 10ms mai tarziu
<br>
2-31350299:Sleeping for 200 ms;
<br>
2-31350499:sending command <code class="moz-txt-verticalline"><span
class="moz-txt-tag">|</span>a ashlee<span class="moz-txt-tag">|</span></code>
<br>
2-31350499:Sleeping for 200 ms;
<br>
2-31350699:sending command <code class="moz-txt-verticalline"><span
class="moz-txt-tag">|</span>a sharleen<span class="moz-txt-tag">|</span></code>
<br>
2-31350699:Sleeping for 200 ms;
<br>
2-31350900:sending command <code class="moz-txt-verticalline"><span
class="moz-txt-tag">|</span>a alisha<span class="moz-txt-tag">|</span></code>
<br>
<br>
Timpii sunt tot in ms, obtinuti cu GetTickCount(). In cazul meu,
timpii de somn par buni, doar ca se termina cele 50ms inainte sa plece
al doilea proces :)<br>
<br>
<pre class="moz-signature" cols="72">--
Bogdan Sass
CCAI,CCSP,JNCIA-ER,CCIE #22221 (RS)
Information Systems Security Professional
"Curiosity was framed - ignorance killed the cat"</pre>
</body>
</html>