[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

offtopic: need some help from os programmers pls.



Attn: to all great programmers out there..
Hoping that somebody please help me out with this problem?

sum()
{  for x=1 to 10 do
      var=var+1
}

shared int var=0 //shared variable

fork(sum, 0);
fork(sum, 0); //executing two concurrent processes

I can't figure this one out...my questions are:
  1. what would be the smallest and largest possible values of the shared var output by this concurrent program?

  2. Suppose that an arbitrary number of these processes are permitted to execute concurrently..what effect would this modification have on the range of final values of var?

Thank you for any help.


___________________________________________________________________________
Visit http://www.visto.com/info, your free web-based communications center.
Visto.com. Life on the Dot.



Reply to: