Set & Reset Event at a time by 2 threads

Hi,

OS: Win XP Prof
Code: user mode

Let us say, 2 threads are trying to modify the state of an event (Handle
is global variable, accessible for both), one sets and other resets AT
THE SAME TIME.
In case of single CPU, the last thread that executes would modify with
its value (set / reset) as only one Thread can run at a time.

But in case of multi CPU, what would ACTUALLY happen?
I guess, there should NOT be any corruption of data.

Thanks,
Sathya

===================================
Knowledge, Skill and desire will lead to SUCCESS.

Hi,Sathyanarayanan Srinivasan

It’s the same as case of single CPU.Because SetEvent(…) function call LOCK instruction.

======= 2003-06-10 15:06:00 You wrote=======

Hi,

OS: Win XP Prof
Code: user mode

Let us say, 2 threads are trying to modify the state of an event (Handle
is global variable, accessible for both), one sets and other resets AT
THE SAME TIME.
In case of single CPU, the last thread that executes would modify with
its value (set / reset) as only one Thread can run at a time.

But in case of multi CPU, what would ACTUALLY happen?
I guess, there should NOT be any corruption of data.

Thanks,
Sathya

===================================
Knowledge, Skill and desire will lead to SUCCESS.


You are currently subscribed to ntdev as: xxxxx@sinfors.com.cn
To unsubscribe send a blank email to xxxxx@lists.osr.com

= = = = = = = = = = = = = = = = = = = =

Crasher Guo
xxxxx@sinfors.com.cn
2003-06-10

There may be more than one CPU, but there is only one memory bus.

Chuck

----- Original Message -----
From: “Sathyanarayanan Srinivasan”

To: “NT Developers Interest List”
Sent: Tuesday, June 10, 2003 4:36 PM
Subject: [ntdev] Set & Reset Event at a time by 2 threads

> Hi,
>
> OS: Win XP Prof
> Code: user mode
>
> Let us say, 2 threads are trying to modify the state of an event
(Handle
> is global variable, accessible for both), one sets and other resets AT
> THE SAME TIME.
> In case of single CPU, the last thread that executes would modify with
> its value (set / reset) as only one Thread can run at a time.
>
> But in case of multi CPU, what would ACTUALLY happen?
> I guess, there should NOT be any corruption of data.
>
> Thanks,
> Sathya
>
> ===================================
> Knowledge, Skill and desire will lead to SUCCESS.
> ===================================

> In case of single CPU, the last thread that executes would modify
with

its value (set / reset) as only one Thread can run at a time.

But in case of multi CPU, what would ACTUALLY happen?

The same as on UP machine. The event states are guarded by dispatcher
spinlock.

Max

Hi,

Thanks a lot for the reply.
This is what I wanted to know.

Thanks,
Sathya

===================================
Knowledge, Skill and desire will lead to SUCCESS.

-----Original Message-----
From: Crasher Guo [mailto:xxxxx@sinfors.com.cn]
Sent: Monday, June 09, 2003 10:30 PM
Subject: Re: Set & Reset Event at a time by 2 threads

Hi,Sathyanarayanan Srinivasan

It’s the same as case of single CPU.Because SetEvent(…) function call
LOCK instruction.

======= 2003-06-10 15:06:00 You wrote=======

Hi,

OS: Win XP Prof
Code: user mode

Let us say, 2 threads are trying to modify the state of an event
(Handle
is global variable, accessible for both), one sets and other resets AT
THE SAME TIME.
In case of single CPU, the last thread that executes would modify with
its value (set / reset) as only one Thread can run at a time.

But in case of multi CPU, what would ACTUALLY happen?
I guess, there should NOT be any corruption of data.

Thanks,
Sathya

===================================
Knowledge, Skill and desire will lead to SUCCESS.


You are currently subscribed to ntdev as: xxxxx@sinfors.com.cn
To unsubscribe send a blank email to xxxxx@lists.osr.com

= = = = = = = = = = = = = = = = = = = =

Crasher Guo
xxxxx@sinfors.com.cn
2003-06-10

Thanks for all who replied for this query.

Thanks,
Sathya

===================================
Knowledge, Skill and desire will lead to SUCCESS.

-----Original Message-----
From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Wednesday, June 11, 2003 12:31 AM
Subject: Re: Set & Reset Event at a time by 2 threads

In case of single CPU, the last thread that executes would modify
with
its value (set / reset) as only one Thread can run at a time.

But in case of multi CPU, what would ACTUALLY happen?

The same as on UP machine. The event states are guarded by dispatcher
spinlock.

Max