473,815 Members | 1,704 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(); IConcurrentResu lt icr1 = example.DoSomet hing();
.... int result = (int)icr1.Syncr onizedResult; }}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.WaitO ne(); ...
MessageBox.Show (x[500].ToString());}A nd 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 1275
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();
IConcurrentResu lt icr1 = example.DoSomet hing();
...
int result = (int)icr1.Syncr onizedResult;
}
}

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.WaitO ne();
...
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
1276
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 copy of the software, one copy of MSDE, one machine) that I wish to convert into a multi-user/single database networked system. The problem I had was that a lot of information is fetched from the database and cached in the client program (the...
4
3106
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 turning to the NG in hopes that someone can spot what I am doing wrong. Key to this technique working is the SQL UPDATE statement. It is designed to fail
0
934
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 into the commercial C# compiler some day? I would like to ask the whole C# community requesting these features. Please, try out Comega! I ask what already exists, it's not impossible to implement.
9
1282
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. I have more cents on the subject but are eager to hear what others have to say. In future versions of Visual Studio, we will be able to mix languages in a project. Hence classes that sport a lot of SQL and/or XML could perhaps benefit from this...
5
1414
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 / locking tables (not discussing here)
9
2038
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 pythonic approach. One thing I've been seeing suggested a lot lately is that running jobs in separate processes, to make it easy to use the latest multiprocessor machines. Makes a lot of sense to me, those processors are going to be more and...
4
1566
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 dgvPlans and the other dgvTanks. What happens is as follows. I will either create or edit a record in the datagridview dgvPlans and call the Updatedb procedure (code below). The first save works OK. Then when that is done, on the same record I will try...
1
1901
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 me to place every actor in a separate thread waiting for msg but the rumor has it, stackless python with tasklet and channel can do much more better in concurrency program, so I dive my head into it.
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
9737
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9613
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10408
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10147
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6899
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5570
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5712
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4360
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3032
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.