UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

#1 2012-04-18 07:12 AM

Maslin
Member
From: Bangalore
Registered: 2012-04-18
Posts: 5

Lock implementation

Hi everyone, what is this spin lock?? why is it used ??? Is there any option where i could implement a lock on my server which is running on Solaris Unix operating system, without adding those lock coding in my program, so that it wont be visible to the user.

Offline

#2 2012-04-18 02:00 PM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,230

Re: Lock implementation

A spin lock is a lock that on contention does not sleep, but keeps trying to get a hold on the lock until it succeeds.
This burns CPU cycles, but if it doesn't have to wait long it's faster than a sleeping lock. It's also used where
sleeping isn't allowed, like in interrupt handlers.

It's mostly used in kernel programming, for user space you usually don't want to use them.

Just use regular Pthread mutex locks if you need locking.

Offline

#3 2012-04-19 06:31 AM

Maslin
Member
From: Bangalore
Registered: 2012-04-18
Posts: 5

Re: Lock implementation

Thanks for the reply Sir, Is there any option to lock my application to a particular system ???... To be precise the application which i created should work only in the system which i need. Is there any techniques to implement it?

Offline

#4 2012-04-19 10:03 AM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,230

Re: Lock implementation

Rob and I read all posts, so there is no need to send a PM. We prefer to handle
everything on the forum, as others with similar problems can read it too then.

Anyway, what you are talking about is not a lock at all, and has even less to do
with spinlocks. You seem to be looking for some DRM (digital right management)
method.

It is very easy to implement, all you need is to look for something that is unique
and unchangeable for that specific system. The MAC address is often used for
this kind of thing, but you could dig for serial numbers elsewhere too, like the
HD serial number. Another way is to give each install a key and the program
uses that key at start-up to authenticate with your server. But then the program
won't work without internet or when your server is down.

However, it's impossible to create a DRM that can't be broken and bypassed,
it will never be watertight. But if your users aren't technical enough to break
it then it's good enough though.

Offline

#5 2012-04-19 10:45 AM

Maslin
Member
From: Bangalore
Registered: 2012-04-18
Posts: 5

Re: Lock implementation

Thank alot sir,

Offline

#6 2012-04-19 12:30 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,826
Website

Re: Lock implementation

i3839 wrote:

However, it's impossible to create a DRM that can't be broken and bypassed,
it will never be watertight. But if your users aren't technical enough to break
it then it's good enough though.

And, you'll more than likely simply end up pissing off your legit customers with it than you ever will prevent piracy of your product or whatever else you're trying to accomplish with such a scheme...  If my software refused to run when I slapped in a new NIC or hard drive, I'd be demanding a full refund!

Offline

#7 2012-04-19 01:09 PM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,230

Re: Lock implementation

Very true. In the end people that want to steal your software will do so one way
or the other, while your paying customers will get annoyed by crappy DRM. This
is true for any DRM scheme.

The problem is that how hard it is to break a DRM is proportional to how
complicated it is. And as we all know, the more complicated software is, the
more buggy it will be. So if it's hard to break it will be an endless source of
trouble for users that don't do anything wrong.

Offline

Board footer

Powered by FluxBB