Hi
I would like some ideas on way to solve the concurrency issue. The
problem is , I have an object say X which multiple readers need to
access and also to update. They do so by say two functions :
// simplistic view of the problem
Read()
{
return X;
}
Update(Y)
{
X= Y;
}
Now I would like to block any reader while calling update. With the
general solutions provided of having say a mutex and using it in Read
and Update would solve the problem. But then this would block multiple
readers also which is not desired. i.e a block on read should be
allowed only when update is called. Having a boolean and checkin is
not ideal as the atomicity of the operation is not guaranteed. Any
ideas on this? 10 3586
On 21 Feb, 11:08, "Hunk" <santosh.udyav. ..@gmail.comwro te:
Hi
I would like some ideas on way to solve the concurrency issue. The
problem is , I have an object say X which multiple readers need to
access and also to update. They do so by say two functions :
// simplistic view of the problem
Read()
{
return X;
}
Update(Y)
{
X= Y;
}
Now I would like to block any reader while calling update. With the
general solutions provided of having say a mutex and using it in Read
and Update would solve the problem. But then this would block multiple
readers also which is not desired. i.e a block on read should be
allowed only when update is called. Having a boolean and checkin is
not ideal as the atomicity of the operation is not guaranteed. Any
ideas on this?
you nead reader-writer lock. the best implementation I've
seen is Valery Pryamikov's mrsw_guard
On Feb 21, 3:08 am, "Hunk" <santosh.udyav. ..@gmail.comwro te:
Hi
I would like some ideas on way to solve the concurrency issue. The
problem is , I have an object say X which multiple readers need to
access and also to update. They do so by say two functions :
// simplistic view of the problem
Read()
{
return X;
}
Update(Y)
{
X= Y;
}
Now I would like to block any reader while calling update. With the
general solutions provided of having say a mutex and using it in Read
and Update would solve the problem. But then this would block multiple
readers also which is not desired. i.e a block on read should be
allowed only when update is called. Having a boolean and checkin is
not ideal as the atomicity of the operation is not guaranteed. Any
ideas on this?
Is this a multi-threaded program? If it is, the best solution is to
use read-write locks in pthread library. See the manpage of
pthread_rwlock_ wrlock and pthread_rwlock_ rdlock. Note that you need to
have -DUSE_UNIX98 in your compiler flags.
On Feb 21, 7:55 pm, "Bharath" <cbku...@gmail. comwrote:
On Feb 21, 3:08 am, "Hunk" <santosh.udyav. ..@gmail.comwro te:
Hi
I would like some ideas on way to solve the concurrency issue. The
problem is , I have an object say X which multiple readers need to
access and also to update. They do so by say two functions :
// simplistic view of the problem
Read()
{
return X;
}
Update(Y)
{
X= Y;
}
Now I would like to block any reader while calling update. With the
general solutions provided of having say a mutex and using it in Read
and Update would solve the problem. But then this would block multiple
readers also which is not desired. i.e a block on read should be
allowed only when update is called. Having a boolean and checkin is
not ideal as the atomicity of the operation is not guaranteed. Any
ideas on this?
Is this a multi-threaded program? If it is, the best solution is to
use read-write locks in pthread library. See the manpage of
pthread_rwlock_ wrlock and pthread_rwlock_ rdlock. Note that you need to
have -DUSE_UNIX98 in your compiler flags.- Hide quoted text -
- Show quoted text -
Thanks... yes it is a multithreaded program. i'll take a look at the
reader writer locks mentioned. Any idea on how this is implemented in
zthreads?
On Feb 21, 9:59 pm, "Hunk" <santosh.udyav. ..@gmail.comwro te:
On Feb 21, 7:55 pm, "Bharath" <cbku...@gmail. comwrote:
On Feb 21, 3:08 am, "Hunk" <santosh.udyav. ..@gmail.comwro te:
Hi
I would like some ideas on way to solve the concurrency issue. The
problem is , I have an object say X which multiple readers need to
access and also to update. They do so by say two functions :
// simplistic view of the problem
Read()
{
return X;
}
Update(Y)
{
X= Y;
}
Now I would like to block any reader while calling update. With the
general solutions provided of having say a mutex and using it in Read
and Update would solve the problem. But then this would block multiple
readers also which is not desired. i.e a block on read should be
allowed only when update is called. Having a boolean and checkin is
not ideal as the atomicity of the operation is not guaranteed. Any
ideas on this?
Is this a multi-threaded program? If it is, the best solution is to
use read-write locks in pthread library. See the manpage of
pthread_rwlock_ wrlock and pthread_rwlock_ rdlock. Note that you need to
have -DUSE_UNIX98 in your compiler flags.- Hide quoted text -
- Show quoted text -
Thanks... yes it is a multithreaded program. i'll take a look at the
reader writer locks mentioned. Any idea on how this is implemented in
zthreads?- Hide quoted text -
- Show quoted text -
I never used zthreads but this link might help. http://zthread.sourceforge.net/html/...WriteLock.html
"dasjotre" <da******@googl email.comwrote in message
news:11******** **************@ q2g2000cwa.goog legroups.com...
On 21 Feb, 11:08, "Hunk" <santosh.udyav. ..@gmail.comwro te:
[...]
you nead reader-writer lock. the best implementation I've
seen is Valery Pryamikov's mrsw_guard
how does it compare to the following algorithm:
DOH! sorry for the other msg... I left out the link!
"dasjotre" <da******@googl email.comwrote in message
news:11******** **************@ q2g2000cwa.goog legroups.com...
On 21 Feb, 11:08, "Hunk" <santosh.udyav. ..@gmail.comwro te:
[...]
you nead reader-writer lock. the best implementation I've
seen is Valery Pryamikov's mrsw_guard
how does it compare to the following algorithm: http://groups.google.com/group/comp....fb0ed46a4bcb4b This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Robert Schuldenfrei |
last post by:
Hi NG,
I am looking for an opinion here. I am new to C# and SQL, being an old
COBOL hand. I have started into a conversion of an old COBOL ERP system. I
have a number of functions working now and it is time to decide how best to
deal with the issues of concurrency. The old COBOL programs used record
locking to prevent concurrency errors...
|
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...
|
by: Homa |
last post by:
Hi,
I'm thinking what will happen if two users access a page at the same
time. If there are any local variable in the page, will this cause
concurrency problem?
Simarily, if this page need to call some functions, say
logic.doSomthing(), and the class logic is a singleton (for
simplicity), will there be problems?
|
by: Jerry |
last post by:
Hi,
I have an app which retrieves data from a sql server table
and displays it on a datagrid. If 2 sessions of this app
are running and 2 users try to update the same record at
about the same time, one of the apps will yield a
concurrency violation error. The app with the error will
have a little red error symbol next to the record in...
|
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...
| |
by: mfreeman |
last post by:
The minimal code (VB.NET 2003) needed to show this problem is shown
below. All I do is loop through the records in the table and update
them without making any changes. Out of 600 records, about 40 of them
throw Concurrency violation errors in the update, and my GetAllColErrs
function provides no output. In comparing the rows that throw...
|
by: Andrew Robinson |
last post by:
I am working on a system system that requires optimistic concurrency within
a web app. At first I thought this would be easy. We generate our own
entities and dal/service layer but I now see that working with controls like
a grid view pose some very complicated issues.
If I am using rowversion, when do I start the "clock"? When I first...
|
by: =?Utf-8?B?V2lsc29uIEMuSy4gTmc=?= |
last post by:
Hi Experts,
I am doing a prototype of providing data access (read, write & search)
through Web Service. We observed that the data storing in SQL Server 2005,
the memory size is always within 250MB. Our aim is to support ~50K
concurrency users.
After investigation, we are thinking to use In-memory database for achieving
|
by: =?Utf-8?B?QmlsbGlhbQ==?= |
last post by:
I am not sure if this is the right group to post to but I fugured I'd start
here. Let me know if there is a more appropriate group. I wanted to try the
forums before I wait 3+ hours on the phone to get a suport incident opened.
I am having sever concurrenct issues with a web app running on Server
2003, IIS 6, .Net 2.0 and using SQL Server...
|
by: John |
last post by:
Hi
I have developed the following logic to handle db concurrency violations. I
just wonder if someone can tell me if it is correct or if I need a
different approach.Would love to know how pros handle it.
Thanks
Regards
|
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...
| |
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
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...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |