473,889 Members | 1,425 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Thread synchronization question

What happens in the case where a mutex is used to protect a file on a
windows application, but a unix script running elsewhere attempts to
manipulate that file while the mutex is not signaled? Is synchronization
enforced over these disparate systems? How?

--
Regards,
Alvin Bruney
Nov 16 '05 #1
11 1910

Since the UNIX script runs outside your Windows Application's AppDomain, it
won't protect your file.

-Oleg.

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:uR******** ******@TK2MSFTN GP10.phx.gbl...
What happens in the case where a mutex is used to protect a file on a
windows application, but a unix script running elsewhere attempts to
manipulate that file while the mutex is not signaled? Is synchronization
enforced over these disparate systems? How?

--
Regards,
Alvin Bruney

Nov 16 '05 #2
That is sad. Is there any way to protect the file in my situation?

--
Regards,
Alvin Bruney
"Oleg Ogurok" <ol**@ogurok.co m.ihatespammers .ireallydo.co> wrote in message
news:10******** *****@corp.supe rnews.com...

Since the UNIX script runs outside your Windows Application's AppDomain,
it won't protect your file.

-Oleg.

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:uR******** ******@TK2MSFTN GP10.phx.gbl...
What happens in the case where a mutex is used to protect a file on a
windows application, but a unix script running elsewhere attempts to
manipulate that file while the mutex is not signaled? Is synchronization
enforced over these disparate systems? How?

--
Regards,
Alvin Bruney


Nov 16 '05 #3
rather 'ugly' but how about marking the file as read only.

HTH

Ollie Riches

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:eC******** ******@tk2msftn gp13.phx.gbl...
That is sad. Is there any way to protect the file in my situation?

--
Regards,
Alvin Bruney
"Oleg Ogurok" <ol**@ogurok.co m.ihatespammers .ireallydo.co> wrote in message news:10******** *****@corp.supe rnews.com...

Since the UNIX script runs outside your Windows Application's AppDomain,
it won't protect your file.

-Oleg.

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:uR******** ******@TK2MSFTN GP10.phx.gbl...
What happens in the case where a mutex is used to protect a file on a
windows application, but a unix script running elsewhere attempts to
manipulate that file while the mutex is not signaled? Is synchronization enforced over these disparate systems? How?

--
Regards,
Alvin Bruney



Nov 16 '05 #4
That's not really going to help, since his program is going to want to
access it. Basically, Alvin is going to have to lock the file exclusively
when he accesses it. When the Unix system tries to access the file, it will
be denied, and that system will have to prepare for that (since it will have
to access the file through Windows anyway, this will work).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Ollie Riches" <ol**********@h otmail.com> wrote in message
news:uU******** ********@tk2msf tngp13.phx.gbl. ..
rather 'ugly' but how about marking the file as read only.

HTH

Ollie Riches

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:eC******** ******@tk2msftn gp13.phx.gbl...
That is sad. Is there any way to protect the file in my situation?

--
Regards,
Alvin Bruney
"Oleg Ogurok" <ol**@ogurok.co m.ihatespammers .ireallydo.co> wrote in

message
news:10******** *****@corp.supe rnews.com...
>
> Since the UNIX script runs outside your Windows Application's
> AppDomain,
> it won't protect your file.
>
> -Oleg.
>
> "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
> news:uR******** ******@TK2MSFTN GP10.phx.gbl...
>> What happens in the case where a mutex is used to protect a file on a
>> windows application, but a unix script running elsewhere attempts to
>> manipulate that file while the mutex is not signaled? Is synchronization >> enforced over these disparate systems? How?
>>
>> --
>> Regards,
>> Alvin Bruney
>>
>
>



Nov 16 '05 #5
only a suggestion :)

okay how about renaming the file temporarly?

Ollie

P.S. caspers house doesn't like firefox much......
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:uq******** ******@tk2msftn gp13.phx.gbl...
That's not really going to help, since his program is going to want to
access it. Basically, Alvin is going to have to lock the file exclusively
when he accesses it. When the Unix system tries to access the file, it will be denied, and that system will have to prepare for that (since it will have to access the file through Windows anyway, this will work).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Ollie Riches" <ol**********@h otmail.com> wrote in message
news:uU******** ********@tk2msf tngp13.phx.gbl. ..
rather 'ugly' but how about marking the file as read only.

HTH

Ollie Riches

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:eC******** ******@tk2msftn gp13.phx.gbl...
That is sad. Is there any way to protect the file in my situation?

--
Regards,
Alvin Bruney
"Oleg Ogurok" <ol**@ogurok.co m.ihatespammers .ireallydo.co> wrote in

message
news:10******** *****@corp.supe rnews.com...
>
> Since the UNIX script runs outside your Windows Application's
> AppDomain,
> it won't protect your file.
>
> -Oleg.
>
> "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
> news:uR******** ******@TK2MSFTN GP10.phx.gbl...
>> What happens in the case where a mutex is used to protect a file on a >> windows application, but a unix script running elsewhere attempts to
>> manipulate that file while the mutex is not signaled? Is

synchronization
>> enforced over these disparate systems? How?
>>
>> --
>> Regards,
>> Alvin Bruney
>>
>
>



Nov 16 '05 #6
Alvin:

I think the only way to do this is at the OS level. Open the file for
exclusive access. Windows (the OS) will prevent access to it until the
opening application releases its lock.

John Puopolo

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:uR******** ******@TK2MSFTN GP10.phx.gbl...
What happens in the case where a mutex is used to protect a file on a
windows application, but a unix script running elsewhere attempts to
manipulate that file while the mutex is not signaled? Is synchronization
enforced over these disparate systems? How?

--
Regards,
Alvin Bruney

Nov 16 '05 #7
Ollie,

That's not going to help either, because the OP wants to synchronize
access to the same file. If both want to write, and he is using a copy,
then the unix process won't be able to see the changes he makes. He has to
exclusively lock the file, or use some sort of transaction coordinator that
works with files, or run a custom solution where the unix process sends
messages to a process on the windows box indicating the operations it wants
to take, and only that process on the windows box can access the file.

As for caspershouse.co m, I'm not too big on cross-browser compatability
=) Sorry.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Ollie Riches" <ol**********@h otmail.com> wrote in message
news:un******** ******@TK2MSFTN GP11.phx.gbl...
only a suggestion :)

okay how about renaming the file temporarly?

Ollie

P.S. caspers house doesn't like firefox much......
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote
in
message news:uq******** ******@tk2msftn gp13.phx.gbl...
That's not really going to help, since his program is going to want
to
access it. Basically, Alvin is going to have to lock the file
exclusively
when he accesses it. When the Unix system tries to access the file, it

will
be denied, and that system will have to prepare for that (since it will

have
to access the file through Windows anyway, this will work).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Ollie Riches" <ol**********@h otmail.com> wrote in message
news:uU******** ********@tk2msf tngp13.phx.gbl. ..
> rather 'ugly' but how about marking the file as read only.
>
> HTH
>
> Ollie Riches
>
>
>
> "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
> news:eC******** ******@tk2msftn gp13.phx.gbl...
>> That is sad. Is there any way to protect the file in my situation?
>>
>> --
>> Regards,
>> Alvin Bruney
>> "Oleg Ogurok" <ol**@ogurok.co m.ihatespammers .ireallydo.co> wrote in
> message
>> news:10******** *****@corp.supe rnews.com...
>> >
>> > Since the UNIX script runs outside your Windows Application's
>> > AppDomain,
>> > it won't protect your file.
>> >
>> > -Oleg.
>> >
>> > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in
>> > message
>> > news:uR******** ******@TK2MSFTN GP10.phx.gbl...
>> >> What happens in the case where a mutex is used to protect a file on a >> >> windows application, but a unix script running elsewhere attempts
>> >> to
>> >> manipulate that file while the mutex is not signaled? Is
> synchronization
>> >> enforced over these disparate systems? How?
>> >>
>> >> --
>> >> Regards,
>> >> Alvin Bruney
>> >>
>> >
>> >
>>
>>
>
>



Nov 16 '05 #8
I was thinking along the lines that a process would attempt to rename the
file and do what it wants and then rename it back to the original name, if
the other process attempt to access\rename the file whilst the other process
is using the file it would fail and it would have to schedule a retry.....

but as John points out why not just use an exclusive open on the file.

Ollie

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:#I******** ******@TK2MSFTN GP14.phx.gbl...
Ollie,

That's not going to help either, because the OP wants to synchronize
access to the same file. If both want to write, and he is using a copy,
then the unix process won't be able to see the changes he makes. He has to exclusively lock the file, or use some sort of transaction coordinator that works with files, or run a custom solution where the unix process sends
messages to a process on the windows box indicating the operations it wants to take, and only that process on the windows box can access the file.

As for caspershouse.co m, I'm not too big on cross-browser compatability =) Sorry.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Ollie Riches" <ol**********@h otmail.com> wrote in message
news:un******** ******@TK2MSFTN GP11.phx.gbl...
only a suggestion :)

okay how about renaming the file temporarly?

Ollie

P.S. caspers house doesn't like firefox much......
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote
in
message news:uq******** ******@tk2msftn gp13.phx.gbl...
That's not really going to help, since his program is going to want
to
access it. Basically, Alvin is going to have to lock the file
exclusively
when he accesses it. When the Unix system tries to access the file, it

will
be denied, and that system will have to prepare for that (since it will

have
to access the file through Windows anyway, this will work).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Ollie Riches" <ol**********@h otmail.com> wrote in message
news:uU******** ********@tk2msf tngp13.phx.gbl. ..
> rather 'ugly' but how about marking the file as read only.
>
> HTH
>
> Ollie Riches
>
>
>
> "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
> news:eC******** ******@tk2msftn gp13.phx.gbl...
>> That is sad. Is there any way to protect the file in my situation?
>>
>> --
>> Regards,
>> Alvin Bruney
>> "Oleg Ogurok" <ol**@ogurok.co m.ihatespammers .ireallydo.co> wrote in
> message
>> news:10******** *****@corp.supe rnews.com...
>> >
>> > Since the UNIX script runs outside your Windows Application's
>> > AppDomain,
>> > it won't protect your file.
>> >
>> > -Oleg.
>> >
>> > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in
>> > message
>> > news:uR******** ******@TK2MSFTN GP10.phx.gbl...
>> >> What happens in the case where a mutex is used to protect a file
on a
>> >> windows application, but a unix script running elsewhere attempts
>> >> to
>> >> manipulate that file while the mutex is not signaled? Is
> synchronization
>> >> enforced over these disparate systems? How?
>> >>
>> >> --
>> >> Regards,
>> >> Alvin Bruney
>> >>
>> >
>> >
>>
>>
>
>



Nov 16 '05 #9
Which is what I pointed out two postings ago =)

"Ollie Riches" <ol**********@h otmail.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
I was thinking along the lines that a process would attempt to rename the
file and do what it wants and then rename it back to the original name, if
the other process attempt to access\rename the file whilst the other
process
is using the file it would fail and it would have to schedule a retry.....

but as John points out why not just use an exclusive open on the file.

Ollie

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote
in
message news:#I******** ******@TK2MSFTN GP14.phx.gbl...
Ollie,

That's not going to help either, because the OP wants to synchronize
access to the same file. If both want to write, and he is using a copy,
then the unix process won't be able to see the changes he makes. He has

to
exclusively lock the file, or use some sort of transaction coordinator

that
works with files, or run a custom solution where the unix process sends
messages to a process on the windows box indicating the operations it

wants
to take, and only that process on the windows box can access the file.

As for caspershouse.co m, I'm not too big on cross-browser

compatability
=) Sorry.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Ollie Riches" <ol**********@h otmail.com> wrote in message
news:un******** ******@TK2MSFTN GP11.phx.gbl...
> only a suggestion :)
>
> okay how about renaming the file temporarly?
>
> Ollie
>
> P.S. caspers house doesn't like firefox much......
>
>
> "Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om>
> wrote
> in
> message news:uq******** ******@tk2msftn gp13.phx.gbl...
>> That's not really going to help, since his program is going to
>> want
>> to
>> access it. Basically, Alvin is going to have to lock the file
>> exclusively
>> when he accesses it. When the Unix system tries to access the file,
>> it
> will
>> be denied, and that system will have to prepare for that (since it
>> will
> have
>> to access the file through Windows anyway, this will work).
>>
>>
>> --
>> - Nicholas Paldino [.NET/C# MVP]
>> - mv*@spam.guard. caspershouse.co m
>>
>> "Ollie Riches" <ol**********@h otmail.com> wrote in message
>> news:uU******** ********@tk2msf tngp13.phx.gbl. ..
>> > rather 'ugly' but how about marking the file as read only.
>> >
>> > HTH
>> >
>> > Ollie Riches
>> >
>> >
>> >
>> > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in
>> > message
>> > news:eC******** ******@tk2msftn gp13.phx.gbl...
>> >> That is sad. Is there any way to protect the file in my situation?
>> >>
>> >> --
>> >> Regards,
>> >> Alvin Bruney
>> >> "Oleg Ogurok" <ol**@ogurok.co m.ihatespammers .ireallydo.co> wrote in
>> > message
>> >> news:10******** *****@corp.supe rnews.com...
>> >> >
>> >> > Since the UNIX script runs outside your Windows Application's
>> >> > AppDomain,
>> >> > it won't protect your file.
>> >> >
>> >> > -Oleg.
>> >> >
>> >> > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in
>> >> > message
>> >> > news:uR******** ******@TK2MSFTN GP10.phx.gbl...
>> >> >> What happens in the case where a mutex is used to protect a file on > a
>> >> >> windows application, but a unix script running elsewhere
>> >> >> attempts
>> >> >> to
>> >> >> manipulate that file while the mutex is not signaled? Is
>> > synchronization
>> >> >> enforced over these disparate systems? How?
>> >> >>
>> >> >> --
>> >> >> Regards,
>> >> >> Alvin Bruney
>> >> >>
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
>



Nov 16 '05 #10

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

Similar topics

5
15589
by: Cyrus | last post by:
I have a question regarding synchronization across multiple threads for a Hashtable. Currently I have a Threadpool that is creating worker threads based on requests to read/write to a hashtable. One function of the Hashtable is to iterate through its keys, which apparently is inherently not thread-safe. Other functions of the Hashtable include adding/modifying/deleting. To solve the synchronization issues I am doing two things: 1. Lock...
5
2603
by: Bill Davidson | last post by:
Hello All: I've got a question about synchronization requiremements in a C# worker thread procedure that, among other things, sinks events from outside sources. I realize the worker thread will be interrupted to handle an incoming event (and the flow of execution subsequently diverted to the respective event handler). My question is at what point or points could this interruption occur. Will it only occur when the worker thread is...
1
1789
by: Bill Davidson | last post by:
(RESEND: I added a little more code to the sample for clarity) Hello All: I've got a question about synchronization requiremements in a C# worker thread procedure that, among other things, sinks events from outside sources. I realize the worker thread will be interrupted to handle an incoming event (and the flow of execution subsequently diverted to the respective event handler). My question is at what point or points could this...
4
3212
by: scott | last post by:
hi all, Thx to any one that can offer me help, it will be much appreciated. iv got a multithreaded program and need to use thread synchronization. The synchronization does not have to work across multiple processes just the one. I was wondering if any one new which one used the least overhead. Im at current using mutexes but was wondering if there was something a bit
20
2427
by: Bob Day | last post by:
Using VS 2003, VB, MSDE... There are two threads, A & B, that continously run and are started by Sub Main. They instantiationsl of identical code. Thread A handles call activity on telephone line 1 and Thread B handles call activity on telephone line 2. They use a common SQL datasource, but all DataSets are unique to each thread. Is there a way for thread A to occasionally communication to thread B that something has happened? ...
6
1418
by: Robert Speck | last post by:
Hi there, Can anyone shed anymore light on why "Thread.Suspend()" has been deprecated by MSFT beyond what MSDN says about it. I'm not sure if I quite appreciate the various pitfalls they discuss but using it under certain circumstances still seems reasonable. For instance, I want to display a small modal dialog with a "Cancel" button which allows the user to abort a background thread. If the user clicks this button, I then want to prompt...
13
3640
by: arun.darra | last post by:
Are the following thread safe: 1. Assuming Object is any simple object Object* fn() { Object *p = new Object(); return p; } 2. is return by value thread safe?
0
1988
by: sundman.anders | last post by:
Hi all! I have a question about thread synchronization and c++ streams (iostreams, stringstreams, etc). When optimizing a program for a multicore processor I found that stringstream was causing a LOT of synchronization overhead. After a bit of digging I concluded that this synchronization has to do with the access to a global locale inside the stream. The problem can be seen by running the small distilled benchmark code
19
2333
by: Hapa | last post by:
Does only reading (never writing) of a variable need thread synchronisation? Thanks for help? PS. Anybody knows a Visual C++ news group?
8
1433
by: Markus | last post by:
Hello everyone. Recently I stumbled upon an interesting problem related to thread-parallel programming in C (and similarily C++). As an example assume a simple "buffer" array of size 8, e.g. with static lifetime and exteral linkage. One thread fills the buffer structure, and the other in some way evaluates its contents, e.g. do { synchronize_with_other_thread(); for (int i=0;i<8;++i) {
0
9809
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
11190
Oralloy
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10791
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...
1
10889
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 most users, this new feature is actually very convenient. If you want to control the update process,...
1
7993
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7150
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
5829
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...
2
4251
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3256
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.