i_hate_toms
New Member
Hello all.
I'm a University student of computer science engineering, and we have a subject called "Operating System Designing Concepts".
Every time the book explains something with an example, they write code in a weird looking language which i can hardly figure. I'll post an example here:-
module m_p_c
b_b: monitor;
begin
buffer:array[1..capacity] of item;
in, out : (1..capacity);
count : (0..capacity);
mayproduce, mayconsume : condition;
procedure mput(pitem : item); {public}
begin
if count = capacity then mayproduce.wait;
buffer[in] :=pitem;
in := (in mod capacity)+1;
count := count+1;
mayconsume.signal
end; {mput}
procedure mtake (var citem : item); {public}
begin
if count=0 then mayconsume.wait;
citem :=buffer[out];
out := (out mod capacity)+1;
count := count-1;
mayproduce.signal
end; {mtake}
{monitor body - initialization}
in :=1;
out :=1;
count := 0;
end b_b;
end {m_p_c}
What the eff is this language? Why won't they use 'C'?
I cannot figure out a thing.
If someone here can work this out, it'd be great if you could help me understand this. Not just this one program, but the programming language that's being used. The book has thousands of programs written in this style, it'll get annoying for you guys if i keep posting 15 programs here, every day. a better solution, would be if someone can help me work out this language. The only languages i've learned so far in the university, except for some assembly languages, are C, C++, Java, VisualBasic, and HTML (if HTML counts as a language.) This code sample, doesn't remotely look anything like the languages i otherwise program in (not professionally of course, we need to write these homework stuff)
Thanks for your time friends. Really appreciated. :good:
I'm a University student of computer science engineering, and we have a subject called "Operating System Designing Concepts".
Every time the book explains something with an example, they write code in a weird looking language which i can hardly figure. I'll post an example here:-
module m_p_c
b_b: monitor;
begin
buffer:array[1..capacity] of item;
in, out : (1..capacity);
count : (0..capacity);
mayproduce, mayconsume : condition;
procedure mput(pitem : item); {public}
begin
if count = capacity then mayproduce.wait;
buffer[in] :=pitem;
in := (in mod capacity)+1;
count := count+1;
mayconsume.signal
end; {mput}
procedure mtake (var citem : item); {public}
begin
if count=0 then mayconsume.wait;
citem :=buffer[out];
out := (out mod capacity)+1;
count := count-1;
mayproduce.signal
end; {mtake}
{monitor body - initialization}
in :=1;
out :=1;
count := 0;
end b_b;
end {m_p_c}
What the eff is this language? Why won't they use 'C'?
I cannot figure out a thing.
If someone here can work this out, it'd be great if you could help me understand this. Not just this one program, but the programming language that's being used. The book has thousands of programs written in this style, it'll get annoying for you guys if i keep posting 15 programs here, every day. a better solution, would be if someone can help me work out this language. The only languages i've learned so far in the university, except for some assembly languages, are C, C++, Java, VisualBasic, and HTML (if HTML counts as a language.) This code sample, doesn't remotely look anything like the languages i otherwise program in (not professionally of course, we need to write these homework stuff)
Thanks for your time friends. Really appreciated. :good:
Last edited: