Synchronizing access to a linked list

Wait a second, wait a second. Stumbling across a disassembly in a kernel
debugger which just happens to show you what you needed to know about how
some piece of the OS works, is just “careful observation”. If Microsoft
ever tried to go after people for “careful observation” then they would have
quite a legal battle on their hands. Especially considering they make the
second best tool which makes “careful observation” possible and easy :slight_smile:
Further, without “careful observation” it is doubtful anyone would ever get
a file system or file system filter driver remotely correct, (sidenote: the
IFS kit is strangely and curiously devoid of modern relavant samples. Did I
say strangely and curiously so? Quite strange indeed for an OS maker worried
about stability and quality issues, but I digress).

Disassembling is quite a different matter and obviously violates the EULA.


Bill McKenzie
Compuware Corporation
Watch your IRPs/IRBs/URBs/SRBs/NDIS pkts with our free WDMSniffer tool:
http://frontline.compuware.com/nashua/patches/utility.htm

“Steve Dispensa” wrote in message
news:xxxxx@ntdev…
>
> On Sat, 2003-12-20 at 13:03, Nick Ryan wrote:
> > Moreira, Alberto wrote:
> > > It used to be a no-no to pry into other people’s machine code. And I
belong
> > > to the old school.
> >
> > Alberto, try to write a filesystem filter driver without having to dive
> > into NTFS and redirector assembly and I promise I will found a new
> > religion with you as chief diety. You can’t bypass the OS since there’s
> > no hardware to talk to here.
>
> Not to take sides in this issue :slight_smile: but it does raise an interesting
> question - my EULA tells me I cannot reverse-engineer Windows (other
> than for an exception relating to my local laws, with which I am
> generally unfamiliar). Lots of people here advocate tracing into the OS
> with WinDbg or SoftICE, but would those same people advocate opening up
> ntoskrnl.exe in IDA and doing a proper disassembly?
>
> I wonder what Microsoft’s position is on this issue - if you’re not
> going to document chunks of code (which is fine by me), you have to let
> people get their jobs done in other ways (i.e. reverse engineering for
> the purpose of understanding).
>
> I wonder how many driver writers are forced to violate the EULA just to
> do their job, hoping that Microsoft will not decide to call them on it.
> I don’t see why Microsoft would make a stink about this, but the fact
> that they can is enough to cause worry.
>
> -sd
>
>
>
>

Alberto,

Knowing that many of the posters here use, and speak highly of, SoftIce and
other Compuware products, I do believe that most, if not all, of our
egregious comments are not directed at any philosophy of Compuware, but
rather directly at Alberto Moreira. It has nothing to do with your
competence, either. Indeed your ability to hold your own in almost any or
all discourses speaks of your competence. I think what most of us find
distressing is your wanton disregard, or should I say disdain, for abiding
by the formats, protocols, structures, and other portions of the framework
of the OS in which we work. Most of us that have found times when we had to
do this, take the more conservative road of at least indicating we had no
other re-course to accomplish the task. You to frequently attempt to get raw
neophytes who have problems spelling “C” let alone working in assembly that
close to the hardware, to do the same thing. That encourages poor
programming practices, period. To many of us have had to pull the chestnuts
of such “I’m king of the world” programming, whether by us or others, out
of the fire to tolerate such wanton willingness to flaunt the OS.

The point here is to play well in the system that exists, not re-write the
system everytime something new comes around. We did that … I did that …
alot back in the 70’s and early 80’s. I can still do that when I have to,
but I would by far rather see a driver I have written playing well in the
200 million systems using it, than running 100% in only 1% of the market and
BSOD’ng in the other 99%.

It’s silly to encourage someone to re-write the basic spinlock used in the
DDK simply because “I don’t trust any API I didn’t write”. The chances are
the newbie will get it wrong, and spend more time than is needed in finally
getting it right, especially when the way you recommend they do it is the
way it is implemented in the OS. That really is silly, my friend.

Gary G. Little
Seagate Technologies, LLC

“Moreira, Alberto” wrote in message
news:xxxxx@ntdev…

Gary, our product’s alive and kicking, lots of people use it. And we’re not
known for dropping the ball that often either, nor are we bashful to bypass
the OS when we need to.

Alberto.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Gary G. Little
Sent: Friday, December 19, 2003 4:30 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

Well, Bubba, lemming is as lemming does. Do I follow Alberto over the cliff,
or follow Jake Ohins, Nathan Obr, Peter Weiland, Walter Oney, Jamey Kirby,
Gary Little (oh that’s me) AWAY from the cliff.

'Nuff said.


Gary G. Little
Seagate Technologies, LLC

“Moreira, Alberto” wrote in message
news:xxxxx@ntdev…

Golly, Mark, I’ve seen lemming behavior before, but this is one step beyond.

I didn’t look inside their code, and I won’t, so, I’ll reverse the charges:
give me one good reason to use a facility I have no clue how it’s
implemented, specially in a performance-sensitive case !

In this case I have many questions: do they or do they not use
test-and-test-and-set ? Do they have exponential backoff after each
test-and-set, if so, which exponent do they use ? Do they use the pause
instruction, how, and where ? Do they use test-and-set, compare-replace,
exchange-add, what ?

And if they do it the most possible effective way, why is Inaki having
performance issues ?

There’s no such a thing as “correctly written” here. There’s a zillion ways
of implementing a lock. No harm done in experimenting and trying to find a
faster one.

Alberto.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Roddy, Mark
Sent: Friday, December 19, 2003 3:16 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] RE: Synchronizing access to a linked list

Alberto, you are a one-trick pony these days. KeAcquireSpinlock is correctly
written, so there is no need to reinvent that particular wheel.

=====================
Mark Roddy

________________________________

From: Moreira, Alberto [mailto:xxxxx@compuware.com]
Sent: Friday, December 19, 2003 2:50 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] RE: Synchronizing access to a linked list

Readers/Writers is a well known problem, get yourself a copy of any
standard OS book and copy the algorithm into your code; the strategy changes
depending on whether you want to give priority to reads, to writes, or no
special priority. You may be able to speed up your spinlocks by using
test-test-and-set instead of plain vanilla test-end-set, and you should
consider inserting a pause instruction into your code, as Intel recommends.
The test-test-and-set works like this:

while (yourlock);
while (testAndSet(yourlock));

It moves much of the testing to the local processor cache and
basically generates no bus traffic and little contention, the reason is, the
first while loop operates on the processor’s cached copy of that “yourlock”
synchronization variable.

Another trick is waiting a little bit before retrying , that again
reduces contention and may reduce latency as well. You can also try to
structure your list as a circular array of dword pointers, for example, use
a ticket algorithm and have it synchornize itself with a lock-exchange-add,
but that’s trickier because of the boundary conditions.

Hope this helps…

Alberto.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Iñaki Castillo
Sent: Friday, December 19, 2003 12:49 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Synchronizing access to a linked list

I have a linked list that grows dinamically. I use this list
to store data that is used in different threads in a kernel driver.

By one side, updating(writing) to the list occurs a few
times (say several times per minute) while reading the list occurs many
times (say thousand of times per minute).

The writing routine works always at passive level, while the
reading routine works always at above passive level (sometimes at DPC level,
sometimes at DISPATCH level).

I have detected that working on multi processor machines
this scheme does not work well. It does work, but it incurs in great
performance penalty.

If I remove the reading synchronization it works much
faster, but removing it is not a solution because the list can be updated at
any time from the writing thread.

I use SpinLocks to synchronize.

Having this picture, what would be the best method to
synchronize access to the list ?
I have been thinking on remove synchronization at reading
and replacing the linked dynamic list by a static list, though it sounds a
little dirty method.

Any suggestions ?


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

The contents of this e-mail are intended for the named addressee
only. It contains information that may be confidential. Unless you are the
named addressee or an authorized designee, you may not copy or use it, or
disclose it to anyone else. If you received it in error please notify us
immediately and then destroy it.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.

“Gary G. Little” wrote in message
news:xxxxx@ntdev…
>

>
> The point here is to play well in the system that exists, not re-write the
> system everytime something new comes around.

> It’s silly to encourage someone to re-write the basic spinlock used in the
> DDK simply because “I don’t trust any API I didn’t write”. The chances are
> the newbie will get it wrong, and spend more time than is needed in
finally
> getting it right, especially when the way you recommend they do it is the
> way it is implemented in the OS. That really is silly, my friend.
>

Now THAT is one of the most thoughtful, well-written, and intelligent
replies to a contenscious issue that I have read on this list in a LONG
time.

Here here! And so say we all!!

Peter
OSR

Gary,

I talk for myself, of course.

And I have no problem shoving the OS out of my way when I feel compelled to
do so.

As far as that spinlock thing went, I had a reason, let me try to explain.
The guy said he had a performance problem with his implementation. My first
reaction was, well, if you have high volume of traffic on one spinlock, you
may be seeing contention at front-side bus level. Now, I suspected that the
implementation of KeAcquireSpinlock( ) did a plain vanilla bts-based test
and set, and although I could not say for sure, it might be the case that a
lot of traffic on a single bts might generate a lot of bus traffic and hence
slow his SMP implementation. It is a simple test to replace a test-and-set
with a better spinlock, which is a test-and-test-and-set: it entails adding
a while loop in front of the bts loop. That takes what, replacing two lines
of code in his critical section with two while loops and one release. That
can be done and tested in less than five minutes, if it increases the
performance he would know one of his bottleneck, of not, just delete it and
go to the next stage.

However, you see, it is not quite possible to convert the Windows
implementation of KeAcquireSpinlock( ) from test-and-set to
test-and-test-and-set, unless one goes down one notch and operates within
the OS. If one would disassemble the code, one might find out that all
that’s needed is to insert the one while loop in front of the call to
KeAcquireSpinlock( ), but that would require disassembly, etc., which takes
time and energy: when all that’s needed is a three-line-of-code change and
test.

So, what do you suggest, that we don’t try it ? Neglect five minutes of
work, and for what, to toe the party line ? I don’t think you’re going to
convince me to suggest that kind of thing.

Alberto.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Gary G. Little
Sent: Monday, December 22, 2003 11:31 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

Alberto,

Knowing that many of the posters here use, and speak highly of, SoftIce and
other Compuware products, I do believe that most, if not all, of our
egregious comments are not directed at any philosophy of Compuware, but
rather directly at Alberto Moreira. It has nothing to do with your
competence, either. Indeed your ability to hold your own in almost any or
all discourses speaks of your competence. I think what most of us find
distressing is your wanton disregard, or should I say disdain, for abiding
by the formats, protocols, structures, and other portions of the framework
of the OS in which we work. Most of us that have found times when we had to
do this, take the more conservative road of at least indicating we had no
other re-course to accomplish the task. You to frequently attempt to get raw
neophytes who have problems spelling “C” let alone working in assembly that
close to the hardware, to do the same thing. That encourages poor
programming practices, period. To many of us have had to pull the chestnuts
of such “I’m king of the world” programming, whether by us or others, out
of the fire to tolerate such wanton willingness to flaunt the OS.

The point here is to play well in the system that exists, not re-write the
system everytime something new comes around. We did that … I did that …
alot back in the 70’s and early 80’s. I can still do that when I have to,
but I would by far rather see a driver I have written playing well in the
200 million systems using it, than running 100% in only 1% of the market and
BSOD’ng in the other 99%.

It’s silly to encourage someone to re-write the basic spinlock used in the
DDK simply because “I don’t trust any API I didn’t write”. The chances are
the newbie will get it wrong, and spend more time than is needed in finally
getting it right, especially when the way you recommend they do it is the
way it is implemented in the OS. That really is silly, my friend.

Gary G. Little
Seagate Technologies, LLC

“Moreira, Alberto” wrote in message
news:xxxxx@ntdev…

Gary, our product’s alive and kicking, lots of people use it. And we’re not
known for dropping the ball that often either, nor are we bashful to bypass
the OS when we need to.

Alberto.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Gary G. Little
Sent: Friday, December 19, 2003 4:30 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

Well, Bubba, lemming is as lemming does. Do I follow Alberto over the cliff,
or follow Jake Ohins, Nathan Obr, Peter Weiland, Walter Oney, Jamey Kirby,
Gary Little (oh that’s me) AWAY from the cliff.

'Nuff said.


Gary G. Little
Seagate Technologies, LLC

“Moreira, Alberto” wrote in message
news:xxxxx@ntdev…

Golly, Mark, I’ve seen lemming behavior before, but this is one step beyond.

I didn’t look inside their code, and I won’t, so, I’ll reverse the charges:
give me one good reason to use a facility I have no clue how it’s
implemented, specially in a performance-sensitive case !

In this case I have many questions: do they or do they not use
test-and-test-and-set ? Do they have exponential backoff after each
test-and-set, if so, which exponent do they use ? Do they use the pause
instruction, how, and where ? Do they use test-and-set, compare-replace,
exchange-add, what ?

And if they do it the most possible effective way, why is Inaki having
performance issues ?

There’s no such a thing as “correctly written” here. There’s a zillion ways
of implementing a lock. No harm done in experimenting and trying to find a
faster one.

Alberto.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Roddy, Mark
Sent: Friday, December 19, 2003 3:16 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] RE: Synchronizing access to a linked list

Alberto, you are a one-trick pony these days. KeAcquireSpinlock is correctly
written, so there is no need to reinvent that particular wheel.

=====================
Mark Roddy

________________________________

From: Moreira, Alberto [mailto:xxxxx@compuware.com]
Sent: Friday, December 19, 2003 2:50 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] RE: Synchronizing access to a linked list

Readers/Writers is a well known problem, get yourself a copy of any
standard OS book and copy the algorithm into your code; the strategy changes
depending on whether you want to give priority to reads, to writes, or no
special priority. You may be able to speed up your spinlocks by using
test-test-and-set instead of plain vanilla test-end-set, and you should
consider inserting a pause instruction into your code, as Intel recommends.
The test-test-and-set works like this:

while (yourlock);
while (testAndSet(yourlock));

It moves much of the testing to the local processor cache and
basically generates no bus traffic and little contention, the reason is, the
first while loop operates on the processor’s cached copy of that “yourlock”
synchronization variable.

Another trick is waiting a little bit before retrying , that again
reduces contention and may reduce latency as well. You can also try to
structure your list as a circular array of dword pointers, for example, use
a ticket algorithm and have it synchornize itself with a lock-exchange-add,
but that’s trickier because of the boundary conditions.

Hope this helps…

Alberto.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Iñaki Castillo
Sent: Friday, December 19, 2003 12:49 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Synchronizing access to a linked list

I have a linked list that grows dinamically. I use this list
to store data that is used in different threads in a kernel driver.

By one side, updating(writing) to the list occurs a few
times (say several times per minute) while reading the list occurs many
times (say thousand of times per minute).

The writing routine works always at passive level, while the
reading routine works always at above passive level (sometimes at DPC level,
sometimes at DISPATCH level).

I have detected that working on multi processor machines
this scheme does not work well. It does work, but it incurs in great
performance penalty.

If I remove the reading synchronization it works much
faster, but removing it is not a solution because the list can be updated at
any time from the writing thread.

I use SpinLocks to synchronize.

Having this picture, what would be the best method to
synchronize access to the list ?
I have been thinking on remove synchronization at reading
and replacing the linked dynamic list by a static list, though it sounds a
little dirty method.

Any suggestions ?


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

The contents of this e-mail are intended for the named addressee
only. It contains information that may be confidential. Unless you are the
named addressee or an authorized designee, you may not copy or use it, or
disclose it to anyone else. If you received it in error please notify us
immediately and then destroy it.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.

At 04:30 PM 12/22/2003, Gary G. Little wrote:

The point here is to play well in the system that exists, not re-write the
system everytime something new comes around. We did that … I did that …
alot back in the 70’s and early 80’s. I can still do that when I have to

Nicely put Gary.

In summary, before you can break the rules, you MUST know why they are
there in the first place. There’s many here qualified to do that, but it’s
not the starting point for newbies.

So can we all be friends for Christmas and wait until the New Year before
the next in depth debate :slight_smile:

Cheers,

Mark.

[in response to the spin-lock thread]

So, what do you suggest, that we don’t try it ?
Neglect five minutes of work, and for what, to
toe the party line ? I don’t think you’re
going to convince me to suggest that kind of
thing.

The original poster asked a performance question. And when it comes to
performance, there is really only one sane path – empirical
measurement. Instead, though, you chose to start with a conclusion, and
then attempt to justify it. This is wrong for an experienced developer,
and it is especially bad advice to give to an inexperienced developer.

When you have a performance problem, you should NEVER assume that
component X or component Y is the problem. Empirical measurement is the
only valid guide – profilers and careful, methodical experiments.
Certain heuristics can inform your search – one heuristic I use is how
young the components in question are, and how many other components have
used the component in question. In the spin-lock case, the OS itself,
along with hundreds (maybe thousands) of device drivers use the NT
implementation of spin-locks, and they work well. Therefore, we know,
empirically, that the OS implementation of spin locks has reasonable
performance.

If you are developing a driver from scratch and you hit a performance
problem, it is wiser to assume that you did something wrong than it is
to assume that a well-known, well-tested existing component is at fault.
The ONLY way to settle the issue is with empirical data.

I rather think that the original poster’s problem was a poorly-chosen
data structure – a linked list! – for performance-critical code. He
probably spent far more time walking down linked lists than he did in
KeAcquireSpinLock. (5000+ queries/sec against a linked list – think of
the horrible cache locality!)

If you can show me performance data that your spin-lock is
*significantly* better than the native NT spin-lock, on a similar range
of hardware that KeAcquire/ReleaseSpinLock runs on, then I’d like to see
it. I would even encourage people to use it, but only for drivers that
truly are hindered by the time it takes to acquire and release
spin-locks. But not until you can prove that it is a better
implementation.

– arlie

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Moreira, Alberto
Sent: Monday, December 22, 2003 12:10 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

Gary,

I talk for myself, of course.

And I have no problem shoving the OS out of my way when I feel compelled
to do so.

As far as that spinlock thing went, I had a reason, let me try to
explain. The guy said he had a performance problem with his
implementation. My first reaction was, well, if you have high volume of
traffic on one spinlock, you may be seeing contention at front-side bus
level. Now, I suspected that the implementation of KeAcquireSpinlock( )
did a plain vanilla bts-based test and set, and although I could not say
for sure, it might be the case that a lot of traffic on a single bts
might generate a lot of bus traffic and hence slow his SMP
implementation. It is a simple test to replace a test-and-set with a
better spinlock, which is a test-and-test-and-set: it entails adding a
while loop in front of the bts loop. That takes what, replacing two
lines of code in his critical section with two while loops and one
release. That can be done and tested in less than five minutes, if it
increases the performance he would know one of his bottleneck, of not,
just delete it and go to the next stage.

However, you see, it is not quite possible to convert the Windows
implementation of KeAcquireSpinlock( ) from test-and-set to
test-and-test-and-set, unless one goes down one notch and operates
within the OS. If one would disassemble the code, one might find out
that all that’s needed is to insert the one while loop in front of the
call to KeAcquireSpinlock( ), but that would require disassembly, etc.,
which takes time and energy: when all that’s needed is a
three-line-of-code change and test.

So, what do you suggest, that we don’t try it ? Neglect five minutes of
work, and for what, to toe the party line ? I don’t think you’re going
to convince me to suggest that kind of thing.

Alberto.

I know this is an absolute waste of time, but I shall say it any
way —

Because if you use the spinlock as defined by the architecture in which we
work, the code you write will work across all platforms in which we run, and
you will only have one source module to maintain. If you write your own
lock, then you limit your driver to that hardware platform, unless you
provide the proper definitions for all the low level hardware functionality
you have decided you can better, for all of the hardware platforms where you
expect to run your code. I really don’t care if its 3 lines of code, or two
lines of code, or even one line of code. It increases the complexity of
source control and the likely hood of a technical support nightmare when the
code becomes cold. why am I wasting my time?

Alberto, why don’t you simply shut all of us up and write and release your
won AHAL&AOAPI (Alberto’s Hardware Abstraction Layer and Any Other
Objectionable API). It should be fairly simple since all it will consist of
is

AHAL&AOAPI ASTATUS myFunctionCall(…) // define any parameters needed

{
ASTATUS status=STATUS_SUCCESS;
_asm {
// add any code needed
}
return status;
}

(Watch, now someone is going to pick apart this tongue in cheek piece of
code for the next 30 iterations of replies.)


Gary G. Little
Seagate Technologies, LLC

“Moreira, Alberto” wrote in message
news:xxxxx@ntdev…
>
> Gary,
>
> I talk for myself, of course.
>
> And I have no problem shoving the OS out of my way when I feel compelled
to
> do so.
>
> As far as that spinlock thing went, I had a reason, let me try to explain.
> The guy said he had a performance problem with his implementation. My
first
> reaction was, well, if you have high volume of traffic on one spinlock,
you
> may be seeing contention at front-side bus level. Now, I suspected that
the
> implementation of KeAcquireSpinlock( ) did a plain vanilla bts-based test
> and set, and although I could not say for sure, it might be the case that
a
> lot of traffic on a single bts might generate a lot of bus traffic and
hence
> slow his SMP implementation. It is a simple test to replace a test-and-set
> with a better spinlock, which is a test-and-test-and-set: it entails
adding
> a while loop in front of the bts loop. That takes what, replacing two
lines
> of code in his critical section with two while loops and one release. That
> can be done and tested in less than five minutes, if it increases the
> performance he would know one of his bottleneck, of not, just delete it
and
> go to the next stage.
>
> However, you see, it is not quite possible to convert the Windows
> implementation of KeAcquireSpinlock( ) from test-and-set to
> test-and-test-and-set, unless one goes down one notch and operates within
> the OS. If one would disassemble the code, one might find out that all
> that’s needed is to insert the one while loop in front of the call to
> KeAcquireSpinlock( ), but that would require disassembly, etc., which
takes
> time and energy: when all that’s needed is a three-line-of-code change and
> test.
>
> So, what do you suggest, that we don’t try it ? Neglect five minutes of
> work, and for what, to toe the party line ? I don’t think you’re going to
> convince me to suggest that kind of thing.
>
>
> Alberto.
>
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Gary G. Little
> Sent: Monday, December 22, 2003 11:31 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> Alberto,
>
> Knowing that many of the posters here use, and speak highly of, SoftIce
and
> other Compuware products, I do believe that most, if not all, of our
> egregious comments are not directed at any philosophy of Compuware, but
> rather directly at Alberto Moreira. It has nothing to do with your
> competence, either. Indeed your ability to hold your own in almost any or
> all discourses speaks of your competence. I think what most of us find
> distressing is your wanton disregard, or should I say disdain, for abiding
> by the formats, protocols, structures, and other portions of the framework
> of the OS in which we work. Most of us that have found times when we had
to
> do this, take the more conservative road of at least indicating we had no
> other re-course to accomplish the task. You to frequently attempt to get
raw
> neophytes who have problems spelling “C” let alone working in assembly
that
> close to the hardware, to do the same thing. That encourages poor
> programming practices, period. To many of us have had to pull the
chestnuts
> of such “I’m king of the world” programming, whether by us or others, out
> of the fire to tolerate such wanton willingness to flaunt the OS.
>
> The point here is to play well in the system that exists, not re-write the
> system everytime something new comes around. We did that … I did that

> alot back in the 70’s and early 80’s. I can still do that when I have to,
> but I would by far rather see a driver I have written playing well in the
> 200 million systems using it, than running 100% in only 1% of the market
and
> BSOD’ng in the other 99%.
>
> It’s silly to encourage someone to re-write the basic spinlock used in the
> DDK simply because “I don’t trust any API I didn’t write”. The chances are
> the newbie will get it wrong, and spend more time than is needed in
finally
> getting it right, especially when the way you recommend they do it is the
> way it is implemented in the OS. That really is silly, my friend.
>
> –
>
> Gary G. Little
> Seagate Technologies, LLC
>
> “Moreira, Alberto” wrote in message
> news:xxxxx@ntdev…
>
> Gary, our product’s alive and kicking, lots of people use it. And we’re
not
> known for dropping the ball that often either, nor are we bashful to
bypass
> the OS when we need to.
>
> Alberto.
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Gary G. Little
> Sent: Friday, December 19, 2003 4:30 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> Well, Bubba, lemming is as lemming does. Do I follow Alberto over the
cliff,
> or follow Jake Ohins, Nathan Obr, Peter Weiland, Walter Oney, Jamey Kirby,
> Gary Little (oh that’s me) AWAY from the cliff.
>
> 'Nuff said.
>
> –
> Gary G. Little
> Seagate Technologies, LLC
>
> “Moreira, Alberto” wrote in message
> news:xxxxx@ntdev…
>
> Golly, Mark, I’ve seen lemming behavior before, but this is one step
beyond.
>
>
> I didn’t look inside their code, and I won’t, so, I’ll reverse the
charges:
> give me one good reason to use a facility I have no clue how it’s
> implemented, specially in a performance-sensitive case !
>
> In this case I have many questions: do they or do they not use
> test-and-test-and-set ? Do they have exponential backoff after each
> test-and-set, if so, which exponent do they use ? Do they use the pause
> instruction, how, and where ? Do they use test-and-set, compare-replace,
> exchange-add, what ?
>
> And if they do it the most possible effective way, why is Inaki having
> performance issues ?
>
> There’s no such a thing as “correctly written” here. There’s a zillion
ways
> of implementing a lock. No harm done in experimenting and trying to find a
> faster one.
>
>
> Alberto.
>
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Roddy, Mark
> Sent: Friday, December 19, 2003 3:16 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] RE: Synchronizing access to a linked list
>
>
> Alberto, you are a one-trick pony these days. KeAcquireSpinlock is
correctly
> written, so there is no need to reinvent that particular wheel.
>
>
> =====================
> Mark Roddy
>
>
>
>
>
> ________________________________
>
> From: Moreira, Alberto [mailto:xxxxx@compuware.com]
> Sent: Friday, December 19, 2003 2:50 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] RE: Synchronizing access to a linked list
>
>
>
> Readers/Writers is a well known problem, get yourself a copy of any
> standard OS book and copy the algorithm into your code; the strategy
changes
> depending on whether you want to give priority to reads, to writes, or no
> special priority. You may be able to speed up your spinlocks by using
> test-test-and-set instead of plain vanilla test-end-set, and you should
> consider inserting a pause instruction into your code, as Intel
recommends.
> The test-test-and-set works like this:
>
> while (yourlock);
> while (testAndSet(yourlock));
>
> It moves much of the testing to the local processor cache and
> basically generates no bus traffic and little contention, the reason is,
the
> first while loop operates on the processor’s cached copy of that
“yourlock”
> synchronization variable.
>
> Another trick is waiting a little bit before retrying , that again
> reduces contention and may reduce latency as well. You can also try to
> structure your list as a circular array of dword pointers, for example,
use
> a ticket algorithm and have it synchornize itself with a
lock-exchange-add,
> but that’s trickier because of the boundary conditions.
>
> Hope this helps…
>
>
> Alberto.
>
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Iñaki Castillo
> Sent: Friday, December 19, 2003 12:49 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Synchronizing access to a linked list
>
>
>
>
> I have a linked list that grows dinamically. I use this list
> to store data that is used in different threads in a kernel driver.
>
> By one side, updating(writing) to the list occurs a few
> times (say several times per minute) while reading the list occurs many
> times (say thousand of times per minute).
>
> The writing routine works always at passive level, while the
> reading routine works always at above passive level (sometimes at DPC
level,
> sometimes at DISPATCH level).
>
> I have detected that working on multi processor machines
> this scheme does not work well. It does work, but it incurs in great
> performance penalty.
>
> If I remove the reading synchronization it works much
> faster, but removing it is not a solution because the list can be updated
at
> any time from the writing thread.
>
> I use SpinLocks to synchronize.
>
> Having this picture, what would be the best method to
> synchronize access to the list ?
> I have been thinking on remove synchronization at reading
> and replacing the linked dynamic list by a static list, though it sounds a
> little dirty method.
>
> Any suggestions ?
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@compuware.com
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@stratus.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
>
> The contents of this e-mail are intended for the named addressee
> only. It contains information that may be confidential. Unless you are the
> named addressee or an authorized designee, you may not copy or use it, or
> disclose it to anyone else. If you received it in error please notify us
> immediately and then destroy it.
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named addressee only. It
> contains information that may be confidential. Unless you are the named
> addressee or an authorized designee, you may not copy or use it, or
disclose
> it to anyone else. If you received it in error please notify us
immediately
> and then destroy it.
>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named addressee only. It
> contains information that may be confidential. Unless you are the named
> addressee or an authorized designee, you may not copy or use it, or
disclose
> it to anyone else. If you received it in error please notify us
immediately
> and then destroy it.
>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named addressee only. It
> contains information that may be confidential. Unless you are the named
> addressee or an authorized designee, you may not copy or use it, or
disclose
> it to anyone else. If you received it in error please notify us
immediately
> and then destroy it.
>
>
>

Sure, what the heck, lets have a retro-60’s love fest. As the kids on south
park say: Merry F’n Christmas :slight_smile:

=====================
Mark Roddy

-----Original Message-----
From: Mark S. Edwards [mailto:xxxxx@muttsnuts.com]
Sent: Monday, December 22, 2003 12:25 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

This message uses a character set that is not supported by
the Internet Service. To view the original message content,
open the attached message. If the text doesn’t display
correctly, save the attachment to disk, and then open it
using a viewer that can display the original character set.

In this case, we’re talking about spinning on a memory location. It’s plain
vanilla standard C, should run on every self-respecting machine.

Alberto.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Gary G. Little
Sent: Monday, December 22, 2003 12:38 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

I know this is an absolute waste of time, but I shall say it any
way —

Because if you use the spinlock as defined by the architecture in which we
work, the code you write will work across all platforms in which we run, and
you will only have one source module to maintain. If you write your own
lock, then you limit your driver to that hardware platform, unless you
provide the proper definitions for all the low level hardware functionality
you have decided you can better, for all of the hardware platforms where you
expect to run your code. I really don’t care if its 3 lines of code, or two
lines of code, or even one line of code. It increases the complexity of
source control and the likely hood of a technical support nightmare when the
code becomes cold. why am I wasting my time?

Alberto, why don’t you simply shut all of us up and write and release your
won AHAL&AOAPI (Alberto’s Hardware Abstraction Layer and Any Other
Objectionable API). It should be fairly simple since all it will consist of
is

AHAL&AOAPI ASTATUS myFunctionCall(…) // define any parameters needed

{
ASTATUS status=STATUS_SUCCESS;
_asm {
// add any code needed
}
return status;
}

(Watch, now someone is going to pick apart this tongue in cheek piece of
code for the next 30 iterations of replies.)


Gary G. Little
Seagate Technologies, LLC

“Moreira, Alberto” wrote in message
news:xxxxx@ntdev…
>
> Gary,
>
> I talk for myself, of course.
>
> And I have no problem shoving the OS out of my way when I feel compelled
to
> do so.
>
> As far as that spinlock thing went, I had a reason, let me try to explain.
> The guy said he had a performance problem with his implementation. My
first
> reaction was, well, if you have high volume of traffic on one spinlock,
you
> may be seeing contention at front-side bus level. Now, I suspected that
the
> implementation of KeAcquireSpinlock( ) did a plain vanilla bts-based test
> and set, and although I could not say for sure, it might be the case that
a
> lot of traffic on a single bts might generate a lot of bus traffic and
hence
> slow his SMP implementation. It is a simple test to replace a test-and-set
> with a better spinlock, which is a test-and-test-and-set: it entails
adding
> a while loop in front of the bts loop. That takes what, replacing two
lines
> of code in his critical section with two while loops and one release. That
> can be done and tested in less than five minutes, if it increases the
> performance he would know one of his bottleneck, of not, just delete it
and
> go to the next stage.
>
> However, you see, it is not quite possible to convert the Windows
> implementation of KeAcquireSpinlock( ) from test-and-set to
> test-and-test-and-set, unless one goes down one notch and operates within
> the OS. If one would disassemble the code, one might find out that all
> that’s needed is to insert the one while loop in front of the call to
> KeAcquireSpinlock( ), but that would require disassembly, etc., which
takes
> time and energy: when all that’s needed is a three-line-of-code change and
> test.
>
> So, what do you suggest, that we don’t try it ? Neglect five minutes of
> work, and for what, to toe the party line ? I don’t think you’re going to
> convince me to suggest that kind of thing.
>
>
> Alberto.
>
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Gary G. Little
> Sent: Monday, December 22, 2003 11:31 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> Alberto,
>
> Knowing that many of the posters here use, and speak highly of, SoftIce
and
> other Compuware products, I do believe that most, if not all, of our
> egregious comments are not directed at any philosophy of Compuware, but
> rather directly at Alberto Moreira. It has nothing to do with your
> competence, either. Indeed your ability to hold your own in almost any or
> all discourses speaks of your competence. I think what most of us find
> distressing is your wanton disregard, or should I say disdain, for abiding
> by the formats, protocols, structures, and other portions of the framework
> of the OS in which we work. Most of us that have found times when we had
to
> do this, take the more conservative road of at least indicating we had no
> other re-course to accomplish the task. You to frequently attempt to get
raw
> neophytes who have problems spelling “C” let alone working in assembly
that
> close to the hardware, to do the same thing. That encourages poor
> programming practices, period. To many of us have had to pull the
chestnuts
> of such “I’m king of the world” programming, whether by us or others, out
> of the fire to tolerate such wanton willingness to flaunt the OS.
>
> The point here is to play well in the system that exists, not re-write the
> system everytime something new comes around. We did that … I did that

> alot back in the 70’s and early 80’s. I can still do that when I have to,
> but I would by far rather see a driver I have written playing well in the
> 200 million systems using it, than running 100% in only 1% of the market
and
> BSOD’ng in the other 99%.
>
> It’s silly to encourage someone to re-write the basic spinlock used in the
> DDK simply because “I don’t trust any API I didn’t write”. The chances are
> the newbie will get it wrong, and spend more time than is needed in
finally
> getting it right, especially when the way you recommend they do it is the
> way it is implemented in the OS. That really is silly, my friend.
>
> –
>
> Gary G. Little
> Seagate Technologies, LLC
>
> “Moreira, Alberto” wrote in message
> news:xxxxx@ntdev…
>
> Gary, our product’s alive and kicking, lots of people use it. And we’re
not
> known for dropping the ball that often either, nor are we bashful to
bypass
> the OS when we need to.
>
> Alberto.
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Gary G. Little
> Sent: Friday, December 19, 2003 4:30 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> Well, Bubba, lemming is as lemming does. Do I follow Alberto over the
cliff,
> or follow Jake Ohins, Nathan Obr, Peter Weiland, Walter Oney, Jamey Kirby,
> Gary Little (oh that’s me) AWAY from the cliff.
>
> 'Nuff said.
>
> –
> Gary G. Little
> Seagate Technologies, LLC
>
> “Moreira, Alberto” wrote in message
> news:xxxxx@ntdev…
>
> Golly, Mark, I’ve seen lemming behavior before, but this is one step
beyond.
>
>
> I didn’t look inside their code, and I won’t, so, I’ll reverse the
charges:
> give me one good reason to use a facility I have no clue how it’s
> implemented, specially in a performance-sensitive case !
>
> In this case I have many questions: do they or do they not use
> test-and-test-and-set ? Do they have exponential backoff after each
> test-and-set, if so, which exponent do they use ? Do they use the pause
> instruction, how, and where ? Do they use test-and-set, compare-replace,
> exchange-add, what ?
>
> And if they do it the most possible effective way, why is Inaki having
> performance issues ?
>
> There’s no such a thing as “correctly written” here. There’s a zillion
ways
> of implementing a lock. No harm done in experimenting and trying to find a
> faster one.
>
>
> Alberto.
>
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Roddy, Mark
> Sent: Friday, December 19, 2003 3:16 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] RE: Synchronizing access to a linked list
>
>
> Alberto, you are a one-trick pony these days. KeAcquireSpinlock is
correctly
> written, so there is no need to reinvent that particular wheel.
>
>
> =====================
> Mark Roddy
>
>
>
>
>
> ________________________________
>
> From: Moreira, Alberto [mailto:xxxxx@compuware.com]
> Sent: Friday, December 19, 2003 2:50 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] RE: Synchronizing access to a linked list
>
>
>
> Readers/Writers is a well known problem, get yourself a copy of any
> standard OS book and copy the algorithm into your code; the strategy
changes
> depending on whether you want to give priority to reads, to writes, or no
> special priority. You may be able to speed up your spinlocks by using
> test-test-and-set instead of plain vanilla test-end-set, and you should
> consider inserting a pause instruction into your code, as Intel
recommends.
> The test-test-and-set works like this:
>
> while (yourlock);
> while (testAndSet(yourlock));
>
> It moves much of the testing to the local processor cache and
> basically generates no bus traffic and little contention, the reason is,
the
> first while loop operates on the processor’s cached copy of that
“yourlock”
> synchronization variable.
>
> Another trick is waiting a little bit before retrying , that again
> reduces contention and may reduce latency as well. You can also try to
> structure your list as a circular array of dword pointers, for example,
use
> a ticket algorithm and have it synchornize itself with a
lock-exchange-add,
> but that’s trickier because of the boundary conditions.
>
> Hope this helps…
>
>
> Alberto.
>
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Iñaki Castillo
> Sent: Friday, December 19, 2003 12:49 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Synchronizing access to a linked list
>
>
>
>
> I have a linked list that grows dinamically. I use this list
> to store data that is used in different threads in a kernel driver.
>
> By one side, updating(writing) to the list occurs a few
> times (say several times per minute) while reading the list occurs many
> times (say thousand of times per minute).
>
> The writing routine works always at passive level, while the
> reading routine works always at above passive level (sometimes at DPC
level,
> sometimes at DISPATCH level).
>
> I have detected that working on multi processor machines
> this scheme does not work well. It does work, but it incurs in great
> performance penalty.
>
> If I remove the reading synchronization it works much
> faster, but removing it is not a solution because the list can be updated
at
> any time from the writing thread.
>
> I use SpinLocks to synchronize.
>
> Having this picture, what would be the best method to
> synchronize access to the list ?
> I have been thinking on remove synchronization at reading
> and replacing the linked dynamic list by a static list, though it sounds a
> little dirty method.
>
> Any suggestions ?
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@compuware.com
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@stratus.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
>
> The contents of this e-mail are intended for the named addressee
> only. It contains information that may be confidential. Unless you are the
> named addressee or an authorized designee, you may not copy or use it, or
> disclose it to anyone else. If you received it in error please notify us
> immediately and then destroy it.
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named addressee only. It
> contains information that may be confidential. Unless you are the named
> addressee or an authorized designee, you may not copy or use it, or
disclose
> it to anyone else. If you received it in error please notify us
immediately
> and then destroy it.
>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named addressee only. It
> contains information that may be confidential. Unless you are the named
> addressee or an authorized designee, you may not copy or use it, or
disclose
> it to anyone else. If you received it in error please notify us
immediately
> and then destroy it.
>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named addressee only. It
> contains information that may be confidential. Unless you are the named
> addressee or an authorized designee, you may not copy or use it, or
disclose
> it to anyone else. If you received it in error please notify us
immediately
> and then destroy it.
>
>
>


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.

Spinlock in NT is not just Spin-and-Lock if I understand correctly. It will
also change the IRQL if it’s acquired at PASSIVE_LEVEL, that’s – the
scheduling/dispatching activities would be affected. There are many chances
could lead to performance penalty if one is not playing nice with the
spinlock.

I used to spend a lot of time in optimizing the lock usage in my ndis
miniport driver, I got significant performance gain.

Calvin Guan, Software Engineer xxxxx@nospam.ati.com
ATI Technologies Inc. Markham ON. Canada
Tel: (905) 882-2600 Ext. 8654

-----Original Message-----
From: Moreira, Alberto [mailto:xxxxx@compuware.com]
Sent: Monday, December 22, 2003 12:10 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

Gary,

I talk for myself, of course.

And I have no problem shoving the OS out of my way when I
feel compelled to
do so.

As far as that spinlock thing went, I had a reason, let me
try to explain.
The guy said he had a performance problem with his
implementation. My first
reaction was, well, if you have high volume of traffic on one
spinlock, you
may be seeing contention at front-side bus level. Now, I
suspected that the
implementation of KeAcquireSpinlock( ) did a plain vanilla
bts-based test
and set, and although I could not say for sure, it might be
the case that a
lot of traffic on a single bts might generate a lot of bus
traffic and hence
slow his SMP implementation. It is a simple test to replace a
test-and-set
with a better spinlock, which is a test-and-test-and-set: it
entails adding
a while loop in front of the bts loop. That takes what,
replacing two lines
of code in his critical section with two while loops and one
release. That
can be done and tested in less than five minutes, if it increases the
performance he would know one of his bottleneck, of not, just
delete it and
go to the next stage.

However, you see, it is not quite possible to convert the Windows
implementation of KeAcquireSpinlock( ) from test-and-set to
test-and-test-and-set, unless one goes down one notch and
operates within
the OS. If one would disassemble the code, one might find out that all
that’s needed is to insert the one while loop in front of the call to
KeAcquireSpinlock( ), but that would require disassembly,
etc., which takes
time and energy: when all that’s needed is a
three-line-of-code change and
test.

So, what do you suggest, that we don’t try it ? Neglect five
minutes of
work, and for what, to toe the party line ? I don’t think
you’re going to
convince me to suggest that kind of thing.

Alberto.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Gary G. Little
Sent: Monday, December 22, 2003 11:31 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

Alberto,

Knowing that many of the posters here use, and speak highly
of, SoftIce and
other Compuware products, I do believe that most, if not all, of our
egregious comments are not directed at any philosophy of
Compuware, but
rather directly at Alberto Moreira. It has nothing to do with your
competence, either. Indeed your ability to hold your own in
almost any or
all discourses speaks of your competence. I think what most of us find
distressing is your wanton disregard, or should I say
disdain, for abiding
by the formats, protocols, structures, and other portions of
the framework
of the OS in which we work. Most of us that have found times
when we had to
do this, take the more conservative road of at least
indicating we had no
other re-course to accomplish the task. You to frequently
attempt to get raw
neophytes who have problems spelling “C” let alone working in
assembly that
close to the hardware, to do the same thing. That encourages poor
programming practices, period. To many of us have had to pull
the chestnuts
of such “I’m king of the world” programming, whether by us
or others, out
of the fire to tolerate such wanton willingness to flaunt the OS.

The point here is to play well in the system that exists, not
re-write the
system everytime something new comes around. We did that …
I did that …
alot back in the 70’s and early 80’s. I can still do that
when I have to,
but I would by far rather see a driver I have written playing
well in the
200 million systems using it, than running 100% in only 1% of
the market and
BSOD’ng in the other 99%.

It’s silly to encourage someone to re-write the basic
spinlock used in the
DDK simply because “I don’t trust any API I didn’t write”.
The chances are
the newbie will get it wrong, and spend more time than is
needed in finally
getting it right, especially when the way you recommend they
do it is the
way it is implemented in the OS. That really is silly, my friend.

Gary G. Little
Seagate Technologies, LLC

“Moreira, Alberto” wrote in message
> news:xxxxx@ntdev…
>
> Gary, our product’s alive and kicking, lots of people use it.
> And we’re not
> known for dropping the ball that often either, nor are we
> bashful to bypass
> the OS when we need to.
>
> Alberto.
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Gary G. Little
> Sent: Friday, December 19, 2003 4:30 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> Well, Bubba, lemming is as lemming does. Do I follow Alberto
> over the cliff,
> or follow Jake Ohins, Nathan Obr, Peter Weiland, Walter Oney,
> Jamey Kirby,
> Gary Little (oh that’s me) AWAY from the cliff.
>
> 'Nuff said.
>
> –
> Gary G. Little
> Seagate Technologies, LLC
>
> “Moreira, Alberto” wrote in message
> news:xxxxx@ntdev…
>
> Golly, Mark, I’ve seen lemming behavior before, but this is
> one step beyond.
>
>
> I didn’t look inside their code, and I won’t, so, I’ll
> reverse the charges:
> give me one good reason to use a facility I have no clue how it’s
> implemented, specially in a performance-sensitive case !
>
> In this case I have many questions: do they or do they not use
> test-and-test-and-set ? Do they have exponential backoff after each
> test-and-set, if so, which exponent do they use ? Do they use
> the pause
> instruction, how, and where ? Do they use test-and-set,
> compare-replace,
> exchange-add, what ?
>
> And if they do it the most possible effective way, why is Inaki having
> performance issues ?
>
> There’s no such a thing as “correctly written” here. There’s
> a zillion ways
> of implementing a lock. No harm done in experimenting and
> trying to find a
> faster one.
>
>
> Alberto.
>
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Roddy, Mark
> Sent: Friday, December 19, 2003 3:16 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] RE: Synchronizing access to a linked list
>
>
> Alberto, you are a one-trick pony these days.
> KeAcquireSpinlock is correctly
> written, so there is no need to reinvent that particular wheel.
>
>
> =====================
> Mark Roddy
>
>
>
>
>
> ________________________________
>
> From: Moreira, Alberto [mailto:xxxxx@compuware.com]
> Sent: Friday, December 19, 2003 2:50 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] RE: Synchronizing access to a linked list
>
>
>
> Readers/Writers is a well known problem, get yourself a copy of any
> standard OS book and copy the algorithm into your code; the
> strategy changes
> depending on whether you want to give priority to reads, to
> writes, or no
> special priority. You may be able to speed up your spinlocks by using
> test-test-and-set instead of plain vanilla test-end-set, and
> you should
> consider inserting a pause instruction into your code, as
> Intel recommends.
> The test-test-and-set works like this:
>
> while (yourlock);
> while (testAndSet(yourlock));
>
> It moves much of the testing to the local processor cache and
> basically generates no bus traffic and little contention, the
> reason is, the
> first while loop operates on the processor’s cached copy of
> that “yourlock”
> synchronization variable.
>
> Another trick is waiting a little bit before retrying , that again
> reduces contention and may reduce latency as well. You can also try to
> structure your list as a circular array of dword pointers,
> for example, use
> a ticket algorithm and have it synchornize itself with a
> lock-exchange-add,
> but that’s trickier because of the boundary conditions.
>
> Hope this helps…
>
>
> Alberto.
>
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of I?aki Castillo
> Sent: Friday, December 19, 2003 12:49 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Synchronizing access to a linked list
>
>
>
>
> I have a linked list that grows dinamically. I use this list
> to store data that is used in different threads in a kernel driver.
>
> By one side, updating(writing) to the list occurs a few
> times (say several times per minute) while reading the list
> occurs many
> times (say thousand of times per minute).
>
> The writing routine works always at passive level, while the
> reading routine works always at above passive level
> (sometimes at DPC level,
> sometimes at DISPATCH level).
>
> I have detected that working on multi processor machines
> this scheme does not work well. It does work, but it incurs in great
> performance penalty.
>
> If I remove the reading synchronization it works much
> faster, but removing it is not a solution because the list
> can be updated at
> any time from the writing thread.
>
> I use SpinLocks to synchronize.
>
> Having this picture, what would be the best method to
> synchronize access to the list ?
> I have been thinking on remove synchronization at reading
> and replacing the linked dynamic list by a static list,
> though it sounds a
> little dirty method.
>
> Any suggestions ?
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@compuware.com
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@stratus.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
>
> The contents of this e-mail are intended for the named addressee
> only. It contains information that may be confidential.
> Unless you are the
> named addressee or an authorized designee, you may not copy
> or use it, or
> disclose it to anyone else. If you received it in error
> please notify us
> immediately and then destroy it.
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named
> addressee only. It
> contains information that may be confidential. Unless you are
> the named
> addressee or an authorized designee, you may not copy or use
> it, or disclose
> it to anyone else. If you received it in error please notify
> us immediately
> and then destroy it.
>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named
> addressee only. It
> contains information that may be confidential. Unless you are
> the named
> addressee or an authorized designee, you may not copy or use
> it, or disclose
> it to anyone else. If you received it in error please notify
> us immediately
> and then destroy it.
>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named
> addressee only. It
> contains information that may be confidential. Unless you are
> the named
> addressee or an authorized designee, you may not copy or use
> it, or disclose
> it to anyone else. If you received it in error please notify
> us immediately
> and then destroy it.
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@ati.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Alberto,

The problem is that you choose to dispense with the OS as your first
course of action rather than as your last recourse. Your approaches are
fine, and there are times when you do have to go outside of the OS, but
these really should be avoided if at all possible.

The real problem is that you are respected and newbies believe your
philosophy. This year I did a phone screen for a customer who was looking
to add a new hire. The canidate spoke adamantly about rolling his own
services and ignoring the OS. He quoted you multiple times. I reported
this back to the hiring manager, who quickly decided that any of the other
candidates would be better.

Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting

----- Original Message -----
From: “Moreira, Alberto”
To: “Windows System Software Devs Interest List”
Sent: Monday, December 22, 2003 12:10 PM
Subject: [ntdev] Re: Synchronizing access to a linked list

> Gary,
>
> I talk for myself, of course.
>
> And I have no problem shoving the OS out of my way when I feel compelled
to
> do so.
>
> As far as that spinlock thing went, I had a reason, let me try to explain.
> The guy said he had a performance problem with his implementation. My
first
> reaction was, well, if you have high volume of traffic on one spinlock,
you
> may be seeing contention at front-side bus level. Now, I suspected that
the
> implementation of KeAcquireSpinlock( ) did a plain vanilla bts-based test
> and set, and although I could not say for sure, it might be the case that
a
> lot of traffic on a single bts might generate a lot of bus traffic and
hence
> slow his SMP implementation. It is a simple test to replace a test-and-set
> with a better spinlock, which is a test-and-test-and-set: it entails
adding
> a while loop in front of the bts loop. That takes what, replacing two
lines
> of code in his critical section with two while loops and one release. That
> can be done and tested in less than five minutes, if it increases the
> performance he would know one of his bottleneck, of not, just delete it
and
> go to the next stage.
>
> However, you see, it is not quite possible to convert the Windows
> implementation of KeAcquireSpinlock( ) from test-and-set to
> test-and-test-and-set, unless one goes down one notch and operates within
> the OS. If one would disassemble the code, one might find out that all
> that’s needed is to insert the one while loop in front of the call to
> KeAcquireSpinlock( ), but that would require disassembly, etc., which
takes
> time and energy: when all that’s needed is a three-line-of-code change and
> test.
>
> So, what do you suggest, that we don’t try it ? Neglect five minutes of
> work, and for what, to toe the party line ? I don’t think you’re going to
> convince me to suggest that kind of thing.
>
>
> Alberto.
>
>

If we were hiring, I would have asked you the name of that newbie. :slight_smile:

Alberto.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Don Burn
Sent: Monday, December 22, 2003 1:09 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

Alberto,

The problem is that you choose to dispense with the OS as your first
course of action rather than as your last recourse. Your approaches are
fine, and there are times when you do have to go outside of the OS, but
these really should be avoided if at all possible.

The real problem is that you are respected and newbies believe your
philosophy. This year I did a phone screen for a customer who was looking
to add a new hire. The canidate spoke adamantly about rolling his own
services and ignoring the OS. He quoted you multiple times. I reported
this back to the hiring manager, who quickly decided that any of the other
candidates would be better.

Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting

----- Original Message -----
From: “Moreira, Alberto”
To: “Windows System Software Devs Interest List”
Sent: Monday, December 22, 2003 12:10 PM
Subject: [ntdev] Re: Synchronizing access to a linked list

> Gary,
>
> I talk for myself, of course.
>
> And I have no problem shoving the OS out of my way when I feel compelled
to
> do so.
>
> As far as that spinlock thing went, I had a reason, let me try to explain.
> The guy said he had a performance problem with his implementation. My
first
> reaction was, well, if you have high volume of traffic on one spinlock,
you
> may be seeing contention at front-side bus level. Now, I suspected that
the
> implementation of KeAcquireSpinlock( ) did a plain vanilla bts-based test
> and set, and although I could not say for sure, it might be the case that
a
> lot of traffic on a single bts might generate a lot of bus traffic and
hence
> slow his SMP implementation. It is a simple test to replace a test-and-set
> with a better spinlock, which is a test-and-test-and-set: it entails
adding
> a while loop in front of the bts loop. That takes what, replacing two
lines
> of code in his critical section with two while loops and one release. That
> can be done and tested in less than five minutes, if it increases the
> performance he would know one of his bottleneck, of not, just delete it
and
> go to the next stage.
>
> However, you see, it is not quite possible to convert the Windows
> implementation of KeAcquireSpinlock( ) from test-and-set to
> test-and-test-and-set, unless one goes down one notch and operates within
> the OS. If one would disassemble the code, one might find out that all
> that’s needed is to insert the one while loop in front of the call to
> KeAcquireSpinlock( ), but that would require disassembly, etc., which
takes
> time and energy: when all that’s needed is a three-line-of-code change and
> test.
>
> So, what do you suggest, that we don’t try it ? Neglect five minutes of
> work, and for what, to toe the party line ? I don’t think you’re going to
> convince me to suggest that kind of thing.
>
>
> Alberto.
>
>


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.

What if Alberto was doing the screening/hiring then? What am I supposed to
say if I was the poor candidate?

Better know to whom I am speaking (Alberto or Don) before answering any
questions in an interview-:slight_smile:

Calvin Guan, Software Engineer xxxxx@nospam.ati.com
ATI Technologies Inc. Markham ON. Canada
Tel: (905) 882-2600 Ext. 8654

-----Original Message-----
From: Moreira, Alberto [mailto:xxxxx@compuware.com]
Sent: Monday, December 22, 2003 1:34 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

If we were hiring, I would have asked you the name of that newbie. :slight_smile:

Alberto.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Don Burn
Sent: Monday, December 22, 2003 1:09 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

Alberto,

The problem is that you choose to dispense with the OS
as your first
course of action rather than as your last recourse. Your
approaches are
fine, and there are times when you do have to go outside of
the OS, but
these really should be avoided if at all possible.

The real problem is that you are respected and newbies
believe your
philosophy. This year I did a phone screen for a customer
who was looking
to add a new hire. The canidate spoke adamantly about rolling his own
services and ignoring the OS. He quoted you multiple times.
I reported
this back to the hiring manager, who quickly decided that any
of the other
candidates would be better.

Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting

----- Original Message -----
From: “Moreira, Alberto”
> To: “Windows System Software Devs Interest List”
> Sent: Monday, December 22, 2003 12:10 PM
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> > Gary,
> >
> > I talk for myself, of course.
> >
> > And I have no problem shoving the OS out of my way when I
> feel compelled
> to
> > do so.
> >
> > As far as that spinlock thing went, I had a reason, let me
> try to explain.
> > The guy said he had a performance problem with his
> implementation. My
> first
> > reaction was, well, if you have high volume of traffic on
> one spinlock,
> you
> > may be seeing contention at front-side bus level. Now, I
> suspected that
> the
> > implementation of KeAcquireSpinlock( ) did a plain vanilla
> bts-based test
> > and set, and although I could not say for sure, it might be
> the case that
> a
> > lot of traffic on a single bts might generate a lot of bus
> traffic and
> hence
> > slow his SMP implementation. It is a simple test to replace
> a test-and-set
> > with a better spinlock, which is a test-and-test-and-set: it entails
> adding
> > a while loop in front of the bts loop. That takes what,
> replacing two
> lines
> > of code in his critical section with two while loops and
> one release. That
> > can be done and tested in less than five minutes, if it
> increases the
> > performance he would know one of his bottleneck, of not,
> just delete it
> and
> > go to the next stage.
> >
> > However, you see, it is not quite possible to convert the Windows
> > implementation of KeAcquireSpinlock( ) from test-and-set to
> > test-and-test-and-set, unless one goes down one notch and
> operates within
> > the OS. If one would disassemble the code, one might find
> out that all
> > that’s needed is to insert the one while loop in front of
> the call to
> > KeAcquireSpinlock( ), but that would require disassembly,
> etc., which
> takes
> > time and energy: when all that’s needed is a
> three-line-of-code change and
> > test.
> >
> > So, what do you suggest, that we don’t try it ? Neglect
> five minutes of
> > work, and for what, to toe the party line ? I don’t think
> you’re going to
> > convince me to suggest that kind of thing.
> >
> >
> > Alberto.
> >
> >
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named
> addressee only. It
> contains information that may be confidential. Unless you are
> the named
> addressee or an authorized designee, you may not copy or use
> it, or disclose
> it to anyone else. If you received it in error please notify
> us immediately
> and then destroy it.
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@ati.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

RE: [ntdev] Re: Synchronizing access to a linked listIf I were around
Alberto’s place, I would definitely apply there, right in his dept. It’s
another thing whether he would
hire me or not, or rather I would pass his test or not -:). But Aberto
please don’t phone screen, then you might hide yourself, and I would not
know how to approach the interview -:).

-prokash
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Calvin Guan
Sent: Monday, December 22, 2003 10:43 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

What if Alberto was doing the screening/hiring then? What am I supposed to
say if I was the poor candidate?

Better know to whom I am speaking (Alberto or Don) before answering any
questions in an interview-:slight_smile:

Calvin Guan, Software Engineer xxxxx@nospam.ati.com
ATI Technologies Inc. Markham ON. Canada
Tel: (905) 882-2600 Ext. 8654

-----Original Message-----
> From: Moreira, Alberto [mailto:xxxxx@compuware.com]
> Sent: Monday, December 22, 2003 1:34 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> If we were hiring, I would have asked you the name of that newbie. :slight_smile:
>
> Alberto.
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Don Burn
> Sent: Monday, December 22, 2003 1:09 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> Alberto,
>
> The problem is that you choose to dispense with the OS
> as your first
> course of action rather than as your last recourse. Your
> approaches are
> fine, and there are times when you do have to go outside of
> the OS, but
> these really should be avoided if at all possible.
>
> The real problem is that you are respected and newbies
> believe your
> philosophy. This year I did a phone screen for a customer
> who was looking
> to add a new hire. The canidate spoke adamantly about rolling his own
> services and ignoring the OS. He quoted you multiple times.
> I reported
> this back to the hiring manager, who quickly decided that any
> of the other
> candidates would be better.
>
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
>
> ----- Original Message -----
> From: “Moreira, Alberto”
> To: “Windows System Software Devs Interest List”
> Sent: Monday, December 22, 2003 12:10 PM
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> > Gary,
> >
> > I talk for myself, of course.
> >
> > And I have no problem shoving the OS out of my way when I
> feel compelled
> to
> > do so.
> >
> > As far as that spinlock thing went, I had a reason, let me
> try to explain.
> > The guy said he had a performance problem with his
> implementation. My
> first
> > reaction was, well, if you have high volume of traffic on
> one spinlock,
> you
> > may be seeing contention at front-side bus level. Now, I
> suspected that
> the
> > implementation of KeAcquireSpinlock( ) did a plain vanilla
> bts-based test
> > and set, and although I could not say for sure, it might be
> the case that
> a
> > lot of traffic on a single bts might generate a lot of bus
> traffic and
> hence
> > slow his SMP implementation. It is a simple test to replace
> a test-and-set
> > with a better spinlock, which is a test-and-test-and-set: it entails
> adding
> > a while loop in front of the bts loop. That takes what,
> replacing two
> lines
> > of code in his critical section with two while loops and
> one release. That
> > can be done and tested in less than five minutes, if it
> increases the
> > performance he would know one of his bottleneck, of not,
> just delete it
> and
> > go to the next stage.
> >
> > However, you see, it is not quite possible to convert the Windows
> > implementation of KeAcquireSpinlock( ) from test-and-set to
> > test-and-test-and-set, unless one goes down one notch and
> operates within
> > the OS. If one would disassemble the code, one might find
> out that all
> > that’s needed is to insert the one while loop in front of
> the call to
> > KeAcquireSpinlock( ), but that would require disassembly,
> etc., which
> takes
> > time and energy: when all that’s needed is a
> three-line-of-code change and
> > test.
> >
> > So, what do you suggest, that we don’t try it ? Neglect
> five minutes of
> > work, and for what, to toe the party line ? I don’t think
> you’re going to
> > convince me to suggest that kind of thing.
> >
> >
> > Alberto.
> >
> >
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named
> addressee only. It
> contains information that may be confidential. Unless you are
> the named
> addressee or an authorized designee, you may not copy or use
> it, or disclose
> it to anyone else. If you received it in error please notify
> us immediately
> and then destroy it.
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@ati.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

Oh, I’m easy to please, but some others around here can be a bit
intimidating. Actually, believe me, it’s the app guys who have the
reputation to tear candidates apart with their questions, if you don’t know
.NET inside out they’ll chew you allright !

I was thinking about it, it may be my video background. I’ve done things
that would make many a Windows developer cringe. Yet we had a great product
(the Number 9 Imagine series, remember ?), and the press loved us.

Alberto.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Prokash Sinha
Sent: Monday, December 22, 2003 3:07 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

If I were around Alberto’s place, I would definitely apply there, right in
his dept. It’s another thing whether he would
hire me or not, or rather I would pass his test or not -:). But Aberto
please don’t phone screen, then you might hide yourself, and I would not
know how to approach the interview -:).

-prokash

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Calvin Guan
Sent: Monday, December 22, 2003 10:43 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

What if Alberto was doing the screening/hiring then? What am I supposed to
say if I was the poor candidate?

Better know to whom I am speaking (Alberto or Don) before answering any
questions in an interview-:slight_smile:

Calvin Guan, Software Engineer xxxxx@nospam.ati.com
ATI Technologies Inc. Markham ON. Canada
Tel: (905) 882-2600 Ext. 8654

-----Original Message-----
From: Moreira, Alberto [ mailto:xxxxx@compuware.com
mailto:xxxxx ]
> Sent: Monday, December 22, 2003 1:34 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> If we were hiring, I would have asked you the name of that newbie. :slight_smile:
>
> Alberto.
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com
mailto:xxxxx]On Behalf Of Don Burn
> Sent: Monday, December 22, 2003 1:09 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> Alberto,
>
> The problem is that you choose to dispense with the OS
> as your first
> course of action rather than as your last recourse. Your
> approaches are
> fine, and there are times when you do have to go outside of
> the OS, but
> these really should be avoided if at all possible.
>
> The real problem is that you are respected and newbies
> believe your
> philosophy. This year I did a phone screen for a customer
> who was looking
> to add a new hire. The canidate spoke adamantly about rolling his own
> services and ignoring the OS. He quoted you multiple times.
> I reported
> this back to the hiring manager, who quickly decided that any
> of the other
> candidates would be better.
>
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
>
> ----- Original Message -----
> From: “Moreira, Alberto”
> To: “Windows System Software Devs Interest List”
> Sent: Monday, December 22, 2003 12:10 PM
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> > Gary,
> >
> > I talk for myself, of course.
> >
> > And I have no problem shoving the OS out of my way when I
> feel compelled
> to
> > do so.
> >
> > As far as that spinlock thing went, I had a reason, let me
> try to explain.
> > The guy said he had a performance problem with his
> implementation. My
> first
> > reaction was, well, if you have high volume of traffic on
> one spinlock,
> you
> > may be seeing contention at front-side bus level. Now, I
> suspected that
> the
> > implementation of KeAcquireSpinlock( ) did a plain vanilla
> bts-based test
> > and set, and although I could not say for sure, it might be
> the case that
> a
> > lot of traffic on a single bts might generate a lot of bus
> traffic and
> hence
> > slow his SMP implementation. It is a simple test to replace
> a test-and-set
> > with a better spinlock, which is a test-and-test-and-set: it entails
> adding
> > a while loop in front of the bts loop. That takes what,
> replacing two
> lines
> > of code in his critical section with two while loops and
> one release. That
> > can be done and tested in less than five minutes, if it
> increases the
> > performance he would know one of his bottleneck, of not,
> just delete it
> and
> > go to the next stage.
> >
> > However, you see, it is not quite possible to convert the Windows
> > implementation of KeAcquireSpinlock( ) from test-and-set to
> > test-and-test-and-set, unless one goes down one notch and
> operates within
> > the OS. If one would disassemble the code, one might find
> out that all
> > that’s needed is to insert the one while loop in front of
> the call to
> > KeAcquireSpinlock( ), but that would require disassembly,
> etc., which
> takes
> > time and energy: when all that’s needed is a
> three-line-of-code change and
> > test.
> >
> > So, what do you suggest, that we don’t try it ? Neglect
> five minutes of
> > work, and for what, to toe the party line ? I don’t think
> you’re going to
> > convince me to suggest that kind of thing.
> >
> >
> > Alberto.
> >
> >
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
http:
>
> You are currently subscribed to ntdev as:
> xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named
> addressee only. It
> contains information that may be confidential. Unless you are
> the named
> addressee or an authorized designee, you may not copy or use
> it, or disclose
> it to anyone else. If you received it in error please notify
> us immediately
> and then destroy it.
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
http:
>
> You are currently subscribed to ntdev as: xxxxx@ati.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.</http:></http:></mailto:xxxxx></mailto:xxxxx>

RE: [ntdev] Re: Synchronizing access to a linked listGlad to hear that
Number 9, I’ve been using it both for windows and Linux. Dont remember
having anyproblem using for last 5 or so years … Yes interview is a tricky
thing, and I’ve faced enough of my share during my life. From finding the
address of the current instruction, to find a cycle in a link list without
any other storage use, to reverse a singly linked list without any extra
storage, to most of the calling proglogue to epilog, and bunch of riddles
that only Martine Gardner could possibly have on his list of preparation. By
the time I get out those interviews, I feel like I had a nice high for free.
I did not spend a penny, did not have to damage the kidney or heart and I’m
still feeling really high -:slight_smile:

-prokash
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Moreira, Alberto
Sent: Monday, December 22, 2003 12:23 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

Oh, I’m easy to please, but some others around here can be a bit
intimidating. Actually, believe me, it’s the app guys who have the
reputation to tear candidates apart with their questions, if you don’t know
.NET inside out they’ll chew you allright !

I was thinking about it, it may be my video background. I’ve done things
that would make many a Windows developer cringe. Yet we had a great product
(the Number 9 Imagine series, remember ?), and the press loved us.

Alberto.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Prokash Sinha
Sent: Monday, December 22, 2003 3:07 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

If I were around Alberto’s place, I would definitely apply there, right
in his dept. It’s another thing whether he would
hire me or not, or rather I would pass his test or not -:). But Aberto
please don’t phone screen, then you might hide yourself, and I would not
know how to approach the interview -:).

-prokash
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Calvin Guan
Sent: Monday, December 22, 2003 10:43 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

What if Alberto was doing the screening/hiring then? What am I
supposed to say if I was the poor candidate?

Better know to whom I am speaking (Alberto or Don) before answering
any questions in an interview-:slight_smile:

Calvin Guan, Software Engineer xxxxx@nospam.ati.com
ATI Technologies Inc. Markham ON. Canada
Tel: (905) 882-2600 Ext. 8654

-----Original Message-----
> From: Moreira, Alberto [mailto:xxxxx@compuware.com]
> Sent: Monday, December 22, 2003 1:34 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> If we were hiring, I would have asked you the name of that newbie.
:slight_smile:
>
> Alberto.
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Don Burn
> Sent: Monday, December 22, 2003 1:09 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> Alberto,
>
> The problem is that you choose to dispense with the OS
> as your first
> course of action rather than as your last recourse. Your
> approaches are
> fine, and there are times when you do have to go outside of
> the OS, but
> these really should be avoided if at all possible.
>
> The real problem is that you are respected and newbies
> believe your
> philosophy. This year I did a phone screen for a customer
> who was looking
> to add a new hire. The canidate spoke adamantly about rolling his
own
> services and ignoring the OS. He quoted you multiple times.
> I reported
> this back to the hiring manager, who quickly decided that any
> of the other
> candidates would be better.
>
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
>
> ----- Original Message -----
> From: “Moreira, Alberto”
> To: “Windows System Software Devs Interest List”

> Sent: Monday, December 22, 2003 12:10 PM
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> > Gary,
> >
> > I talk for myself, of course.
> >
> > And I have no problem shoving the OS out of my way when I
> feel compelled
> to
> > do so.
> >
> > As far as that spinlock thing went, I had a reason, let me
> try to explain.
> > The guy said he had a performance problem with his
> implementation. My
> first
> > reaction was, well, if you have high volume of traffic on
> one spinlock,
> you
> > may be seeing contention at front-side bus level. Now, I
> suspected that
> the
> > implementation of KeAcquireSpinlock( ) did a plain vanilla
> bts-based test
> > and set, and although I could not say for sure, it might be
> the case that
> a
> > lot of traffic on a single bts might generate a lot of bus
> traffic and
> hence
> > slow his SMP implementation. It is a simple test to replace
> a test-and-set
> > with a better spinlock, which is a test-and-test-and-set: it
entails
> adding
> > a while loop in front of the bts loop. That takes what,
> replacing two
> lines
> > of code in his critical section with two while loops and
> one release. That
> > can be done and tested in less than five minutes, if it
> increases the
> > performance he would know one of his bottleneck, of not,
> just delete it
> and
> > go to the next stage.
> >
> > However, you see, it is not quite possible to convert the Windows
> > implementation of KeAcquireSpinlock( ) from test-and-set to
> > test-and-test-and-set, unless one goes down one notch and
> operates within
> > the OS. If one would disassemble the code, one might find
> out that all
> > that’s needed is to insert the one while loop in front of
> the call to
> > KeAcquireSpinlock( ), but that would require disassembly,
> etc., which
> takes
> > time and energy: when all that’s needed is a
> three-line-of-code change and
> > test.
> >
> > So, what do you suggest, that we don’t try it ? Neglect
> five minutes of
> > work, and for what, to toe the party line ? I don’t think
> you’re going to
> > convince me to suggest that kind of thing.
> >
> >
> > Alberto.
> >
> >
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named
> addressee only. It
> contains information that may be confidential. Unless you are
> the named
> addressee or an authorized designee, you may not copy or use
> it, or disclose
> it to anyone else. If you received it in error please notify
> us immediately
> and then destroy it.
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@ati.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.

I still use a Number 9 T2R4 at home, because I have that big beautiful SGI
1920x1600 TFT panel, and the T2R4 is probably the only consumer level board
that still supports it. Unless of course you want to buy that SGI converter
box, but I’m not even sure whether they’re selling it any longer. So, I have
a small stash of T2R4 boards in my basement, and I’m going to use them until
I get a decent replacement for my SGI panel ! Sometimes I miss a GPU, but
them I take it to my workstation at college where I have an ATI 9800 board
with gobs of megabytes of memory.

Alberto.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Prokash Sinha
Sent: Monday, December 22, 2003 3:38 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

Glad to hear that Number 9, I’ve been using it both for windows and Linux.
Dont remember having anyproblem using for last 5 or so years … Yes
interview is a tricky thing, and I’ve faced enough of my share during my
life. From finding the address of the current instruction, to find a cycle
in a link list without any other storage use, to reverse a singly linked
list without any extra storage, to most of the calling proglogue to epilog,
and bunch of riddles that only Martine Gardner could possibly have on his
list of preparation. By the time I get out those interviews, I feel like I
had a nice high for free. I did not spend a penny, did not have to damage
the kidney or heart and I’m still feeling really high -:slight_smile:

-prokash

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Moreira, Alberto
Sent: Monday, December 22, 2003 12:23 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

Oh, I’m easy to please, but some others around here can be a bit
intimidating. Actually, believe me, it’s the app guys who have the
reputation to tear candidates apart with their questions, if you don’t know
.NET inside out they’ll chew you allright !

I was thinking about it, it may be my video background. I’ve done things
that would make many a Windows developer cringe. Yet we had a great product
(the Number 9 Imagine series, remember ?), and the press loved us.

Alberto.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Prokash Sinha
Sent: Monday, December 22, 2003 3:07 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

If I were around Alberto’s place, I would definitely apply there, right in
his dept. It’s another thing whether he would
hire me or not, or rather I would pass his test or not -:). But Aberto
please don’t phone screen, then you might hide yourself, and I would not
know how to approach the interview -:).

-prokash

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Calvin Guan
Sent: Monday, December 22, 2003 10:43 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

What if Alberto was doing the screening/hiring then? What am I supposed to
say if I was the poor candidate?

Better know to whom I am speaking (Alberto or Don) before answering any
questions in an interview-:slight_smile:

Calvin Guan, Software Engineer xxxxx@nospam.ati.com
ATI Technologies Inc. Markham ON. Canada
Tel: (905) 882-2600 Ext. 8654

-----Original Message-----
From: Moreira, Alberto [ mailto:xxxxx@compuware.com
mailto:xxxxx ]
> Sent: Monday, December 22, 2003 1:34 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> If we were hiring, I would have asked you the name of that newbie. :slight_smile:
>
> Alberto.
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com
mailto:xxxxx]On Behalf Of Don Burn
> Sent: Monday, December 22, 2003 1:09 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> Alberto,
>
> The problem is that you choose to dispense with the OS
> as your first
> course of action rather than as your last recourse. Your
> approaches are
> fine, and there are times when you do have to go outside of
> the OS, but
> these really should be avoided if at all possible.
>
> The real problem is that you are respected and newbies
> believe your
> philosophy. This year I did a phone screen for a customer
> who was looking
> to add a new hire. The canidate spoke adamantly about rolling his own
> services and ignoring the OS. He quoted you multiple times.
> I reported
> this back to the hiring manager, who quickly decided that any
> of the other
> candidates would be better.
>
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
>
> ----- Original Message -----
> From: “Moreira, Alberto”
> To: “Windows System Software Devs Interest List”
> Sent: Monday, December 22, 2003 12:10 PM
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> > Gary,
> >
> > I talk for myself, of course.
> >
> > And I have no problem shoving the OS out of my way when I
> feel compelled
> to
> > do so.
> >
> > As far as that spinlock thing went, I had a reason, let me
> try to explain.
> > The guy said he had a performance problem with his
> implementation. My
> first
> > reaction was, well, if you have high volume of traffic on
> one spinlock,
> you
> > may be seeing contention at front-side bus level. Now, I
> suspected that
> the
> > implementation of KeAcquireSpinlock( ) did a plain vanilla
> bts-based test
> > and set, and although I could not say for sure, it might be
> the case that
> a
> > lot of traffic on a single bts might generate a lot of bus
> traffic and
> hence
> > slow his SMP implementation. It is a simple test to replace
> a test-and-set
> > with a better spinlock, which is a test-and-test-and-set: it entails
> adding
> > a while loop in front of the bts loop. That takes what,
> replacing two
> lines
> > of code in his critical section with two while loops and
> one release. That
> > can be done and tested in less than five minutes, if it
> increases the
> > performance he would know one of his bottleneck, of not,
> just delete it
> and
> > go to the next stage.
> >
> > However, you see, it is not quite possible to convert the Windows
> > implementation of KeAcquireSpinlock( ) from test-and-set to
> > test-and-test-and-set, unless one goes down one notch and
> operates within
> > the OS. If one would disassemble the code, one might find
> out that all
> > that’s needed is to insert the one while loop in front of
> the call to
> > KeAcquireSpinlock( ), but that would require disassembly,
> etc., which
> takes
> > time and energy: when all that’s needed is a
> three-line-of-code change and
> > test.
> >
> > So, what do you suggest, that we don’t try it ? Neglect
> five minutes of
> > work, and for what, to toe the party line ? I don’t think
> you’re going to
> > convince me to suggest that kind of thing.
> >
> >
> > Alberto.
> >
> >
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
http:
>
> You are currently subscribed to ntdev as:
> xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named
> addressee only. It
> contains information that may be confidential. Unless you are
> the named
> addressee or an authorized designee, you may not copy or use
> it, or disclose
> it to anyone else. If you received it in error please notify
> us immediately
> and then destroy it.
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
http:
>
> You are currently subscribed to ntdev as: xxxxx@ati.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.</http:></http:></mailto:xxxxx></mailto:xxxxx>

RE: [ntdev] Re: Synchronizing access to a linked listWell, I would say U r
one of the luckiest guy to have an SGI workstation. Couple years back, when
SGI went on a huge cutback, lots of workstation(s), fairly new at that time
were on sale for $200 ( yes it was two hundred ), I didnot get one, and what
a terrible mistake. BTW, the card I’ve been using might be T2R4 PCI based,
did not look at the bios param for awhile since it does work fine even with
one of the mitsubishi flat pannel…

Ending this thd from my side …

-prokash
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Moreira, Alberto
Sent: Monday, December 22, 2003 12:59 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

I still use a Number 9 T2R4 at home, because I have that big beautiful SGI
1920x1600 TFT panel, and the T2R4 is probably the only consumer level board
that still supports it. Unless of course you want to buy that SGI converter
box, but I’m not even sure whether they’re selling it any longer. So, I have
a small stash of T2R4 boards in my basement, and I’m going to use them until
I get a decent replacement for my SGI panel ! Sometimes I miss a GPU, but
them I take it to my workstation at college where I have an ATI 9800 board
with gobs of megabytes of memory.

Alberto.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Prokash Sinha
Sent: Monday, December 22, 2003 3:38 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

Glad to hear that Number 9, I’ve been using it both for windows and
Linux. Dont remember having anyproblem using for last 5 or so years … Yes
interview is a tricky thing, and I’ve faced enough of my share during my
life. From finding the address of the current instruction, to find a cycle
in a link list without any other storage use, to reverse a singly linked
list without any extra storage, to most of the calling proglogue to epilog,
and bunch of riddles that only Martine Gardner could possibly have on his
list of preparation. By the time I get out those interviews, I feel like I
had a nice high for free. I did not spend a penny, did not have to damage
the kidney or heart and I’m still feeling really high -:slight_smile:

-prokash
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Moreira, Alberto
Sent: Monday, December 22, 2003 12:23 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

Oh, I’m easy to please, but some others around here can be a bit
intimidating. Actually, believe me, it’s the app guys who have the
reputation to tear candidates apart with their questions, if you don’t know
.NET inside out they’ll chew you allright !

I was thinking about it, it may be my video background. I’ve done
things that would make many a Windows developer cringe. Yet we had a great
product (the Number 9 Imagine series, remember ?), and the press loved us.

Alberto.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Prokash Sinha
Sent: Monday, December 22, 2003 3:07 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

If I were around Alberto’s place, I would definitely apply there,
right in his dept. It’s another thing whether he would
hire me or not, or rather I would pass his test or not -:). But
Aberto please don’t phone screen, then you might hide yourself, and I would
not know how to approach the interview -:).

-prokash
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Calvin Guan
Sent: Monday, December 22, 2003 10:43 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

What if Alberto was doing the screening/hiring then? What am I
supposed to say if I was the poor candidate?

Better know to whom I am speaking (Alberto or Don) before
answering any questions in an interview-:slight_smile:

Calvin Guan, Software Engineer xxxxx@nospam.ati.com
ATI Technologies Inc. Markham ON. Canada
Tel: (905) 882-2600 Ext. 8654

-----Original Message-----
> From: Moreira, Alberto [mailto:xxxxx@compuware.com]
> Sent: Monday, December 22, 2003 1:34 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> If we were hiring, I would have asked you the name of that
newbie. :slight_smile:
>
> Alberto.
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Don Burn
> Sent: Monday, December 22, 2003 1:09 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> Alberto,
>
> The problem is that you choose to dispense with the OS
> as your first
> course of action rather than as your last recourse. Your
> approaches are
> fine, and there are times when you do have to go outside of
> the OS, but
> these really should be avoided if at all possible.
>
> The real problem is that you are respected and newbies
> believe your
> philosophy. This year I did a phone screen for a customer
> who was looking
> to add a new hire. The canidate spoke adamantly about rolling
his own
> services and ignoring the OS. He quoted you multiple times.
> I reported
> this back to the hiring manager, who quickly decided that any
> of the other
> candidates would be better.
>
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
>
> ----- Original Message -----
> From: “Moreira, Alberto”
> To: “Windows System Software Devs Interest List”

> Sent: Monday, December 22, 2003 12:10 PM
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> > Gary,
> >
> > I talk for myself, of course.
> >
> > And I have no problem shoving the OS out of my way when I
> feel compelled
> to
> > do so.
> >
> > As far as that spinlock thing went, I had a reason, let me
> try to explain.
> > The guy said he had a performance problem with his
> implementation. My
> first
> > reaction was, well, if you have high volume of traffic on
> one spinlock,
> you
> > may be seeing contention at front-side bus level. Now, I
> suspected that
> the
> > implementation of KeAcquireSpinlock( ) did a plain vanilla
> bts-based test
> > and set, and although I could not say for sure, it might be
> the case that
> a
> > lot of traffic on a single bts might generate a lot of bus
> traffic and
> hence
> > slow his SMP implementation. It is a simple test to replace
> a test-and-set
> > with a better spinlock, which is a test-and-test-and-set: it
entails
> adding
> > a while loop in front of the bts loop. That takes what,
> replacing two
> lines
> > of code in his critical section with two while loops and
> one release. That
> > can be done and tested in less than five minutes, if it
> increases the
> > performance he would know one of his bottleneck, of not,
> just delete it
> and
> > go to the next stage.
> >
> > However, you see, it is not quite possible to convert the
Windows
> > implementation of KeAcquireSpinlock( ) from test-and-set to
> > test-and-test-and-set, unless one goes down one notch and
> operates within
> > the OS. If one would disassemble the code, one might find
> out that all
> > that’s needed is to insert the one while loop in front of
> the call to
> > KeAcquireSpinlock( ), but that would require disassembly,
> etc., which
> takes
> > time and energy: when all that’s needed is a
> three-line-of-code change and
> > test.
> >
> > So, what do you suggest, that we don’t try it ? Neglect
> five minutes of
> > work, and for what, to toe the party line ? I don’t think
> you’re going to
> > convince me to suggest that kind of thing.
> >
> >
> > Alberto.
> >
> >
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@compuware.com
> To unsubscribe send a blank email to
xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named
> addressee only. It
> contains information that may be confidential. Unless you are
> the named
> addressee or an authorized designee, you may not copy or use
> it, or disclose
> it to anyone else. If you received it in error please notify
> us immediately
> and then destroy it.
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@ati.com
> To unsubscribe send a blank email to
xxxxx@lists.osr.com
>


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

The contents of this e-mail are intended for the named addressee only.
It contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.

>From finding the address of the current instruction

call next_one
next_one: mov eax,[esp]
;… did something to makeup eax.
mov [Interested_EIP],eax
add esp,4

to reverse a singly linked list without any extra storage
Maybe traverse the singly list recursively?

-:slight_smile:

Calvin Guan, Software Engineer xxxxx@nospam.ati.com
ATI Technologies Inc. Tel: (905) 882-2600 Ext. 8654

-----Original Message-----
From: Prokash Sinha [mailto:xxxxx@garlic.com]
Sent: Monday, December 22, 2003 3:38 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

Glad to hear that Number 9, I’ve been using it both for windows and Linux.
Dont remember having anyproblem using for last 5 or so years … Yes
interview is a tricky thing, and I’ve faced enough of my share during my
life. From finding the address of the current instruction, to find a cycle
in a link list without any other storage use, to reverse a singly linked
list without any extra storage, to most of the calling proglogue to epilog,
and bunch of riddles that only Martine Gardner could possibly have on his
list of preparation. By the time I get out those interviews, I feel like I
had a nice high for free. I did not spend a penny, did not have to damage
the kidney or heart and I’m still feeling really high -:slight_smile:

-prokash
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Moreira, Alberto
Sent: Monday, December 22, 2003 12:23 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

Oh, I’m easy to please, but some others around here can be a bit
intimidating. Actually, believe me, it’s the app guys who have the
reputation to tear candidates apart with their questions, if you don’t know
.NET inside out they’ll chew you allright !

I was thinking about it, it may be my video background. I’ve done things
that would make many a Windows developer cringe. Yet we had a great product
(the Number 9 Imagine series, remember ?), and the press loved us.

Alberto.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Prokash Sinha
Sent: Monday, December 22, 2003 3:07 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

If I were around Alberto’s place, I would definitely apply there, right in
his dept. It’s another thing whether he would
hire me or not, or rather I would pass his test or not -:). But Aberto
please don’t phone screen, then you might hide yourself, and I would not
know how to approach the interview -:).

-prokash
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Calvin Guan
Sent: Monday, December 22, 2003 10:43 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

What if Alberto was doing the screening/hiring then? What am I supposed to
say if I was the poor candidate?
Better know to whom I am speaking (Alberto or Don) before answering any
questions in an interview-:slight_smile:
Calvin Guan, Software Engineer xxxxx@nospam.ati.com
ATI Technologies Inc. Markham ON. Canada
Tel: (905) 882-2600 Ext. 8654

-----Original Message-----
From: Moreira, Alberto [mailto:xxxxx@compuware.com]
Sent: Monday, December 22, 2003 1:34 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

If we were hiring, I would have asked you the name of that newbie. :slight_smile:

Alberto.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Don Burn
Sent: Monday, December 22, 2003 1:09 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

Alberto,

The problem is that you choose to dispense with the OS
as your first
course of action rather than as your last recourse. Your
approaches are
fine, and there are times when you do have to go outside of
the OS, but
these really should be avoided if at all possible.

The real problem is that you are respected and newbies
believe your
philosophy. This year I did a phone screen for a customer
who was looking
to add a new hire. The canidate spoke adamantly about rolling his own
services and ignoring the OS. He quoted you multiple times.
I reported
this back to the hiring manager, who quickly decided that any
of the other
candidates would be better.

Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting

----- Original Message -----
From: “Moreira, Alberto”
> To: “Windows System Software Devs Interest List”
> Sent: Monday, December 22, 2003 12:10 PM
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> > Gary,
> >
> > I talk for myself, of course.
> >
> > And I have no problem shoving the OS out of my way when I
> feel compelled
> to
> > do so.
> >
> > As far as that spinlock thing went, I had a reason, let me
> try to explain.
> > The guy said he had a performance problem with his
> implementation. My
> first
> > reaction was, well, if you have high volume of traffic on
> one spinlock,
> you
> > may be seeing contention at front-side bus level. Now, I
> suspected that
> the
> > implementation of KeAcquireSpinlock( ) did a plain vanilla
> bts-based test
> > and set, and although I could not say for sure, it might be
> the case that
> a
> > lot of traffic on a single bts might generate a lot of bus
> traffic and
> hence
> > slow his SMP implementation. It is a simple test to replace
> a test-and-set
> > with a better spinlock, which is a test-and-test-and-set: it entails
> adding
> > a while loop in front of the bts loop. That takes what,
> replacing two
> lines
> > of code in his critical section with two while loops and
> one release. That
> > can be done and tested in less than five minutes, if it
> increases the
> > performance he would know one of his bottleneck, of not,
> just delete it
> and
> > go to the next stage.
> >
> > However, you see, it is not quite possible to convert the Windows
> > implementation of KeAcquireSpinlock( ) from test-and-set to
> > test-and-test-and-set, unless one goes down one notch and
> operates within
> > the OS. If one would disassemble the code, one might find
> out that all
> > that’s needed is to insert the one while loop in front of
> the call to
> > KeAcquireSpinlock( ), but that would require disassembly,
> etc., which
> takes
> > time and energy: when all that’s needed is a
> three-line-of-code change and
> > test.
> >
> > So, what do you suggest, that we don’t try it ? Neglect
> five minutes of
> > work, and for what, to toe the party line ? I don’t think
> you’re going to
> > convince me to suggest that kind of thing.
> >
> >
> > Alberto.
> >
> >
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named
> addressee only. It
> contains information that may be confidential. Unless you are
> the named
> addressee or an authorized designee, you may not copy or use
> it, or disclose
> it to anyone else. If you received it in error please notify
> us immediately
> and then destroy it.
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@ati.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

RE: [ntdev] Re: Synchronizing access to a linked listWell, as usual, I did
not put succintly, w/the assumption that noone would care about them, except
the fact that sometime it is better to assume that the job one is
interviewing for is the worst job in his/her life so just dont worry about
being intimidated, just go do the best one can …

Now for the first one, it was to get the instruction addr of any
instruction, and it was to test that eip is funny in the sense very limited
operations can be done using eip is an operand ( x86 is the domain of
discussion).

prevInst: lea ebx, previnst ;any genral purpose register would do
; now add inst legth to get the addr of current instruction
current instruction

for the list reverse (singly linked list …), it was allowed to have little
storage, may be a pointer to a node, ( U know how bitchy an interviewer
could be -:), and the output would be exactly the samelist but in reverse
order. Recursion is definitely one option, but interation is much more
intuitive …

HOW ABOUT GETTING AN ADT OF DUBLY LINKED LIST USING ONLY ONE POINTER ?
Usually we all use a forward and a backword pointer !!!. It is really a
killer question -:). But needed on embedded devices (when memory is on short
supply)…

-prokash
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Calvin Guan
Sent: Monday, December 22, 2003 5:15 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

From finding the address of the current instruction

call next_one
next_one: mov eax,[esp]
;… did something to makeup eax.
mov [Interested_EIP],eax
add esp,4

>to reverse a singly linked list without any extra storage
Maybe traverse the singly list recursively?

-:slight_smile:

Calvin Guan, Software Engineer xxxxx@nospam.ati.com
ATI Technologies Inc. Tel: (905) 882-2600 Ext. 8654

-----Original Message-----
From: Prokash Sinha [mailto:xxxxx@garlic.com]
Sent: Monday, December 22, 2003 3:38 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

Glad to hear that Number 9, I’ve been using it both for windows and Linux.
Dont remember having anyproblem using for last 5 or so years … Yes
interview is a tricky thing, and I’ve faced enough of my share during my
life. From finding the address of the current instruction, to find a cycle
in a link list without any other storage use, to reverse a singly linked
list without any extra storage, to most of the calling proglogue to epilog,
and bunch of riddles that only Martine Gardner could possibly have on his
list of preparation. By the time I get out those interviews, I feel like I
had a nice high for free. I did not spend a penny, did not have to damage
the kidney or heart and I’m still feeling really high -:slight_smile:

-prokash
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Moreira, Alberto
Sent: Monday, December 22, 2003 12:23 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

Oh, I’m easy to please, but some others around here can be a bit
intimidating. Actually, believe me, it’s the app guys who have the
reputation to tear candidates apart with their questions, if you don’t know
.NET inside out they’ll chew you allright !

I was thinking about it, it may be my video background. I’ve done things
that would make many a Windows developer cringe. Yet we had a great product
(the Number 9 Imagine series, remember ?), and the press loved us.

Alberto.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Prokash Sinha
Sent: Monday, December 22, 2003 3:07 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

If I were around Alberto’s place, I would definitely apply there, right in
his dept. It’s another thing whether he would

hire me or not, or rather I would pass his test or not -:). But Aberto
please don’t phone screen, then you might hide yourself, and I would not
know how to approach the interview -:).

-prokash
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Calvin Guan
Sent: Monday, December 22, 2003 10:43 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Synchronizing access to a linked list

What if Alberto was doing the screening/hiring then? What am I supposed to
say if I was the poor candidate?
Better know to whom I am speaking (Alberto or Don) before answering any
questions in an interview-:slight_smile:
Calvin Guan, Software Engineer xxxxx@nospam.ati.com
ATI Technologies Inc. Markham ON. Canada
Tel: (905) 882-2600 Ext. 8654

-----Original Message-----
> From: Moreira, Alberto [mailto:xxxxx@compuware.com]
> Sent: Monday, December 22, 2003 1:34 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> If we were hiring, I would have asked you the name of that newbie. :slight_smile:
>
> Alberto.
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Don Burn
> Sent: Monday, December 22, 2003 1:09 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> Alberto,
>
> The problem is that you choose to dispense with the OS
> as your first
> course of action rather than as your last recourse. Your
> approaches are
> fine, and there are times when you do have to go outside of
> the OS, but
> these really should be avoided if at all possible.
>
> The real problem is that you are respected and newbies
> believe your
> philosophy. This year I did a phone screen for a customer
> who was looking
> to add a new hire. The canidate spoke adamantly about rolling his own
> services and ignoring the OS. He quoted you multiple times.
> I reported
> this back to the hiring manager, who quickly decided that any
> of the other
> candidates would be better.
>
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
>
> ----- Original Message -----
> From: “Moreira, Alberto”
> To: “Windows System Software Devs Interest List”
> Sent: Monday, December 22, 2003 12:10 PM
> Subject: [ntdev] Re: Synchronizing access to a linked list
>
>
> > Gary,
> >
> > I talk for myself, of course.
> >
> > And I have no problem shoving the OS out of my way when I
> feel compelled
> to
> > do so.
> >
> > As far as that spinlock thing went, I had a reason, let me
> try to explain.
> > The guy said he had a performance problem with his
> implementation. My
> first
> > reaction was, well, if you have high volume of traffic on
> one spinlock,
> you
> > may be seeing contention at front-side bus level. Now, I
> suspected that
> the
> > implementation of KeAcquireSpinlock( ) did a plain vanilla
> bts-based test
> > and set, and although I could not say for sure, it might be
> the case that
> a
> > lot of traffic on a single bts might generate a lot of bus
> traffic and
> hence
> > slow his SMP implementation. It is a simple test to replace
> a test-and-set
> > with a better spinlock, which is a test-and-test-and-set: it entails
> adding
> > a while loop in front of the bts loop. That takes what,
> replacing two
> lines
> > of code in his critical section with two while loops and
> one release. That
> > can be done and tested in less than five minutes, if it
> increases the
> > performance he would know one of his bottleneck, of not,
> just delete it
> and
> > go to the next stage.
> >
> > However, you see, it is not quite possible to convert the Windows
> > implementation of KeAcquireSpinlock( ) from test-and-set to
> > test-and-test-and-set, unless one goes down one notch and
> operates within
> > the OS. If one would disassemble the code, one might find
> out that all
> > that’s needed is to insert the one while loop in front of
> the call to
> > KeAcquireSpinlock( ), but that would require disassembly,
> etc., which
> takes
> > time and energy: when all that’s needed is a
> three-line-of-code change and
> > test.
> >
> > So, what do you suggest, that we don’t try it ? Neglect
> five minutes of
> > work, and for what, to toe the party line ? I don’t think
> you’re going to
> > convince me to suggest that kind of thing.
> >
> >
> > Alberto.
> >
> >
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named
> addressee only. It
> contains information that may be confidential. Unless you are
> the named
> addressee or an authorized designee, you may not copy or use
> it, or disclose
> it to anyone else. If you received it in error please notify
> us immediately
> and then destroy it.
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@ati.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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