Jump to content

Need Help in Understanding Concurrent Programming Psudo Code Question

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
tharindufit

tharindufit

    Newbie

  • Members
  • Pip
  • 2 posts
Hi,

I am an undergraduate student following an IT degree. I would like to have little help in solving following question for an assignment. It will be useful to get some tips on how to do this question.

The Ex instruction exchanges the contents of two memory locations. EX(a,b) is equivalent to an indivisible execution of the following assignment statements:
temp := a;
a := b;
b := temp;

(a) discuss the correctness (safety, deadlock, lockout) of the solution for mutual exclusion shown in following program for exchange.

(b) Generalize it to n processes.

© What would happen if the primitive EX instruction were replaced by the three assignments?

Program exchange;
Var c:integer;
Procedure p1;
Var k: integer;
Begin
    k:= 0;
    Repeat
    Rem1;
    Repeat
        EX(c,k)
    Until k= 1;
        Crit1;
        Ex(c,kl)
    Forever
End;
Procedure p2;
Var k: integer;
Begin
    k:= 0;
    Repeat
    Rem2;
    Repeat
        EX(c,k)
    Until kl = 1;
        Crit2;
        Ex(c,k)
    Forever
End;
Begin (* main program*)
     C :=1;
    Cobegin
p1,p2
coend
end.

---------------------------------------------------------------------------
What does these Crit1, Crit2 mean ? Rem1, Rem2 Mean ?
What is meant by generalize this to n processes ? Is it about calling the program n times or ? about p1 p2 processes ?
-----------------------------------------------------------------------------

Edited by WingedPanther, 19 June 2010 - 03:21 AM.
add code tags (the # button)


#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
We can't know what those mean, having not been in your class. They are probably defined in your book somewhere.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
tharindufit

tharindufit

    Newbie

  • Members
  • Pip
  • 2 posts
oops.. sorry.. I have chosen wrong forum.. :( I know its not good asking questions like this. But I didn't expect a full answer from you. Just wanted may be some points to go on. Anyway sorry again for asking a question from you. I think I will be able to manage with friends. Thanks

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
It's okay to ask questions, you just can't make assumptions :)
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog