<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Cu placere,<div><br><div>Razvan<br><br>--- On <b>Tue, 9/20/11, so-request@cursuri.cs.pub.ro <i>&lt;so-request@cursuri.cs.pub.ro&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: so-request@cursuri.cs.pub.ro &lt;so-request@cursuri.cs.pub.ro&gt;<br>Subject: so Digest, Vol 65, Issue 7<br>To: so@cursuri.cs.pub.ro<br>Date: Tuesday, September 20, 2011, 2:00 AM<br><br><div class="plainMail">Send so mailing list submissions to<br>&nbsp;&nbsp;&nbsp; <a ymailto="mailto:so@cursuri.cs.pub.ro" href="/mc/compose?to=so@cursuri.cs.pub.ro">so@cursuri.cs.pub.ro</a><br><br>To subscribe or unsubscribe via the World Wide Web, visit<br>&nbsp;&nbsp;&nbsp; <a href="http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so" target="_blank">http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so</a><br>or, via
 email, send a message with subject or body 'help' to<br>&nbsp;&nbsp;&nbsp; <a ymailto="mailto:so-request@cursuri.cs.pub.ro" href="/mc/compose?to=so-request@cursuri.cs.pub.ro">so-request@cursuri.cs.pub.ro</a><br><br>You can reach the person managing the list at<br>&nbsp;&nbsp;&nbsp; <a ymailto="mailto:so-owner@cursuri.cs.pub.ro" href="/mc/compose?to=so-owner@cursuri.cs.pub.ro">so-owner@cursuri.cs.pub.ro</a><br><br>When replying, please edit your Subject line so it is more specific<br>than "Re: Contents of so digest..."<br><br><br>Today's Topics:<br><br>&nbsp;&nbsp;&nbsp;1. Re: so Digest, Vol 65, Issue 5 (Razvan Deaconescu)<br><br><br>----------------------------------------------------------------------<br><br>Message: 1<br>Date: Sat, 17 Sep 2011 17:17:26 +0300<br>From: Razvan Deaconescu &lt;<a ymailto="mailto:razvan.deaconescu@cs.pub.ro" href="/mc/compose?to=razvan.deaconescu@cs.pub.ro">razvan.deaconescu@cs.pub.ro</a>&gt;<br>Subject: Re: [so] so Digest,
 Vol 65, Issue 5<br>To: Sisteme de Operare &lt;<a ymailto="mailto:so@cursuri.cs.pub.ro" href="/mc/compose?to=so@cursuri.cs.pub.ro">so@cursuri.cs.pub.ro</a>&gt;<br>Message-ID: &lt;<a ymailto="mailto:1316269047.5336.20.camel@einherjar.cs.pub.ro" href="/mc/compose?to=1316269047.5336.20.camel@einherjar.cs.pub.ro">1316269047.5336.20.camel@einherjar.cs.pub.ro</a>&gt;<br>Content-Type: text/plain; charset="UTF-8"<br><br>On Sat, 2011-09-17 at 04:20 -0700, Razvan Pistolea wrote:<br>&gt; SemaforGeneral(N){<br>&gt; <br>&gt;&nbsp; &nbsp;&nbsp;&nbsp;c = N&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // contor; lasa maxim N<br>&gt;&nbsp; &nbsp;&nbsp;&nbsp;mutex = SemaforBinar(1)&nbsp; &nbsp; &nbsp; &nbsp; // protejeaza contorul<br>&gt;&nbsp; &nbsp;&nbsp;&nbsp;s2 = SemaforBinar(N&gt;1?1:0)&nbsp; &nbsp; // implementeaza "notificarea"<br>&gt;&nbsp; &nbsp;&nbsp;&nbsp;<br>&gt;&nbsp; &nbsp;&nbsp;&nbsp;wait()<br>&gt;&nbsp; &nbsp; &nbsp;
 &nbsp;&nbsp;&nbsp;s2.wait()<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;mutex.wait()<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;c--<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;if c &gt; 0<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;s2.release()<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;mutex.release()<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;<br>&gt;&nbsp; &nbsp;&nbsp;&nbsp;release()<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;mutex.wait()<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;c++<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;if c == 1<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;s2.release()<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;mutex.release()<br>&gt; }<br><br>Da, a?a este. Mul?umim de observa?ie.<br><br>Am g?sit ?i pe Google[1]. Am actualizat rezolvarea[2].<br><br>[1] <a href="http://webhome.csc.uvic.ca/~mcheng/460/notes/gensem.pdf"
 target="_blank">http://webhome.csc.uvic.ca/~mcheng/460/notes/gensem.pdf</a><br>[2] <a href="http://elf.cs.pub.ro/so/wiki/examen#lucrare-2" target="_blank">http://elf.cs.pub.ro/so/wiki/examen#lucrare-2</a><br><br>R?zvan<br><br><br><br>------------------------------<br><br>_______________________________________________<br>so mailing list<br><a ymailto="mailto:so@cursuri.cs.pub.ro" href="/mc/compose?to=so@cursuri.cs.pub.ro">so@cursuri.cs.pub.ro</a><br><a href="http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so" target="_blank">http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so</a><br><br><br>End of so Digest, Vol 65, Issue 7<br>*********************************<br></div></blockquote></div></div></td></tr></table>