473,503 Members | 2,197 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C-Omega concurrency improvement idea

Greetings,

First of all, I'm not exactly sure how seriously to take the C-Omega project
(http://research.microsoft.com/Comega/). It appears to be a potential
glimpse into what C# 3.0 might become. It has had some press recently and I
have taken a small interest in it. Particularily, I am interested in the
embedded SQL-like syntax that it provides for accessing objects and to a
lessor extent (with regards to my interst in it) databases.

Somewhere along the line, after reading the docs, I learned that it supports
an inherent currency model for achieving parallism during execution of code.
While I like the idea, I don't like the implementation.

For example (just one of the many examples of how to implement concurrent
functionality):

public class Buffer { public async Put(string s); public string Get() &
Put(string s) { return s; }} Makes sense, but isn't, IMO clean.

Hence the purpose of this discussion. How do you think it should look?
What would make it easier and more C#-like?

My idea, perhaps, would be to have a syntax thus:

public class MyClass { public [static] parallel int DoSomething() { ...
return anInt; }}Perhaps at this point, it takes a similar syntax (but a
little different) to a delegate (regardless of whether it actually is
compiled as one):

public class BusinessObject { public void DoSomething() { MyClass
example = new MyClass(); IConcurrentResult icr1 = example.DoSomething();
.... int result = (int)icr1.SyncronizedResult; }}Perhaps even that syntax
isn't as clean, I'm hoping people can give other ideas. I'd like to explore
what people think and provide a pre-compiler for C# to prove the concept (or
change Rotor code to compile it directly). Perhaps we use a "concurrent"
keyword instead of "parallel"?

I was also thinking of inlining it thus:

public void DoSomething() { int[50000] x; int[50000] y; ... parallel
_longLoop for(j=0; j<50000; j++) { for (k=0; k<50000; k++) { y[k] =
k; } x[j] = j; } ... _longLoop.WaitOne(); ...
MessageBox.Show(x[500].ToString());}And as an alternate (personally, I like
the previous example better):

parallel for(j=0; j<50000; j++) { for (k=0; k<50000; k++) { y[k] =
k; } x[j] = j; } _longLoop;There are other things to concider, the
c-omega docs allow for reader-writer locks and so on which could easily be
addressed.

We can also have anonymous concurrency thus:

public void DoSomething() { ... parallel { int[50000] x; int[50000]
y; for(j=0; j<50000; j++) { for (k=0; k<50000; k++) { y[k] =
k; } x[j] = j; } UpdateDatabase(x, y); } ...}Assuming
C-Omega is indeed a glimpse into C# 3.0 and we were to get a concurrent
model for programming, how would you like to see the syntax for concurrency?

Thanks,
Shawn
Nov 17 '05 #1
1 1263
Greetings,

First of all, I'm not exactly sure how seriously to take the C-Omega project
(http://research.microsoft.com/Comega/). It appears to be a potential
glimpse into what C# 3.0 might become. It has had some press recently and I
have taken a small interest in it. Particularily, I am interested in the
embedded SQL-like syntax that it provides for accessing objects and to a
lessor extent (with regards to my interst in it) databases.
Somewhere along the line, after reading the docs, I learned that it supports
an inherent currency model for achieving parallism during execution of code.
While I like the idea, I don't like the implementation.
For example (just one of the many examples of how to implement concurrent
functionality):

public class Buffer {
public async Put(string s);
public string Get() & Put(string s) { return s; }
}

Makes sense, but isn't, IMO clean.

Hence the purpose of this discussion. How do you think it should look?
What would make it easier and more C#-like?

My idea, perhaps, would be to have a syntax thus:

public class MyClass {
public [static] parallel int DoSomething() {
...
return anInt;
}
}

Perhaps at this point, it takes a similar syntax (but a little different) to
a delegate (regardless of whether it actually is compiled as one):

public class BusinessObject {
public void DoSomething() {
MyClass example = new MyClass();
IConcurrentResult icr1 = example.DoSomething();
...
int result = (int)icr1.SyncronizedResult;
}
}

Perhaps even that syntax isn't as clean, I'm hoping people can give other
ideas. I'd like to explore what people think and provide a pre-compiler for
C# to prove the concept (or change Rotor code to compile it directly).
Perhaps we use a "concurrent" keyword instead of "parallel"?

I was also thinking of inlining it thus:

public void DoSomething() {
int[50000] x;
int[50000] y;
...
parallel _longLoop for(j=0; j<50000; j++) {
for (k=0; k<50000; k++) {
y[k] = k;
}
x[j] = j;
}
...
_longLoop.WaitOne();
...
MessageBox.Show(x[500].ToString());
}

And as an alternate (personally, I like the previous example better):

parallel for(j=0; j<50000; j++) {
for (k=0; k<50000; k++) {
y[k] = k;
}
x[j] = j;
} _longLoop;

There are other things to concider, the c-omega docs allow for reader-writer
locks and so on which could easily be addressed.

We can also have anonymous concurrency thus:

public void DoSomething() {

...
parallel {
int[50000] x;
int[50000] y;

for(j=0; j<50000; j++) {
for (k=0; k<50000; k++) {
y[k] = k;
}
x[j] = j;
}
UpdateDatabase(x, y);
}
...
}

Assuming C-Omega is indeed a glimpse into C# 3.0 and we were to get a
concurrent model for programming, how would you like to see the syntax for
concurrency?
Thanks,
Shawn

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1263
by: Robin Tucker | last post by:
With respect to my (now not so recent) thread on Concurrency, I would like to run my idea past you gurus to see if its a runner. First, a brief recap: I have a single user system (one user, one...
4
3088
by: Robert Schuldenfrei | last post by:
Dear NG, I was about to "improve" concurrency checking with a Timestamp when I discovered that my current code is not working. After about a day of beating my head against the wall, I am...
0
922
by: Kazi | last post by:
I'm very influenced by the Comega compiler features (you can download it here: http://research.microsoft.com/Comega/), the ideas are excellent. Is there any possibility to integrate these features...
9
1270
by: Michael S | last post by:
I've been reading about and trying out Cw from microsoft research. http://research.microsoft.com/Comega/doc/comega_startpage.htm My first cent is that the language is weird but have potential....
5
1398
by: John Rivers | last post by:
Hello, The common approaches to concurrency control in web apps: optimistic: - row version (timestamp, guid, datetime, digest) etc. - value checking pessimistic: - locking fields /...
9
2008
by: corey.coughlin | last post by:
Alright, so I've been following some of the arguments about enhancing parallelism in python, and I've kind of been struck by how hard things still are. It seems like what we really need is a more...
4
1548
by: Bob | last post by:
While testing my my program I came up with a consistency exception. My program consists of three datagridviews, One called dgvPostes which is the parent grid and its two children,one called...
1
1888
by: davy zhang | last post by:
first here is my basic idea is every actor holds their own msg queue, the process function will handle the message as soon as the dispatcher object put the message in. This idea naturally leads...
0
364
by: James Mills | last post by:
On Tue, Nov 11, 2008 at 3:57 PM, davy zhang <davyzhang@gmail.comwrote: You could try circuits - An event driven way to concurrency. --JamesMills http://trac.softcircuit.com.au/circuits/ ...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7008
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7467
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5594
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5022
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3177
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3168
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
746
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.