Back to the month index |
Back to the list index
|
Andre van der Vlies (A.G.van.der.Vlies@cb.hva.nl)
Tue, 8 Apr 1997 10:33:55 +0200 (CDT)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
- Next message: Graeme Merrall: "[mSQL] (B5) Data ranges in Lite?"
- Previous message: Miche BLANC: "Re: [mSQL] n-n query"
- In reply to: Jeanne Gold: "Re: [mSQL] n-n query"
- Next in thread: Doug Salot: "Re: Fw: [mSQL] Locking?"
- Reply: Doug Salot: "Re: Fw: [mSQL] Locking?"
- Reply: Clyde Smith-Stubbs: "Re: Fw: [mSQL] Locking?"
Date: Tue, 8 Apr 1997 10:33:55 +0200 (CDT) From: Andre van der Vlies <A.G.van.der.Vlies@cb.hva.nl> Subject: Re: Fw: [mSQL] Locking? Message-Id: <Pine.SGI.3.94.970408100356.21968H-100000@ice.cb.hva.nl>On Sun, 6 Apr 1997, Mark-Jason Dominus wrote:
> On Sun, 6 Apr 1997, Clyde Smith-Stubbs wrote:
> > Oh, the best way to requery would be to wait a few seconds, then requery.
> > It should not impact performance much if you don't requery too
> > often.
>
> And because your process can tell how far back in the queue it is, it
> can compute a poisson distribution to desice how long to wait. If
> there are 100 other processes ahead of it, it should sleep longer than
> if it is next to go.
>
This is disturbing info. 'INSERT' and 'UPDATE' aren't atomic operations??
What about implementing Dijkstra's semaphores (using SYSV ipc) on this? This
shouldn't be to hard to do ...
#define P(x) work_sema(x, -1)
#define V(x) work_sema(x, 1)
#include <sys/sem.h>
int lock;
mqsl_lock = semget(IPC_PRIVATE, 1, 0600);
semctl(mqsl_lock, 1, SETVAL, 1);
work_sema(int sem, int action) {
struct sembuf semb;
semb.sem_num = sem;
semb.sem_op = action;
semb.sem_flg = 0;
semop(semid, &semb, 1);
}
... find the critical section for 'UPDATE' and 'INSERT' and surround it with
P(msql_lock) and V(msql_lock). There is a drawback; if msql crashes the semaphores
must be removed manualy ... And some code for removal on sigint and such has
to be included.
If got some spare time I will have a look into that.
Greetings,
Andre van der Vlies <A.G.van.der.Vlies@cb.hva.nl>
System Administrator
Hogeschool van Amsterdam
Stadhouderskade 55, Amsterdam
tel: (+31) 20 5702670
fax: (+31) 20 5702510
http://www.cb.hva.nl/~andre
Key fingerprint = 99 DC D6 01 96 C2 48 80 DC 9C D5 D2 34 F6 A6 5D
--------------------------------------------------------------------------
To remove yourself from the Mini SQL mailing list send a message containing
"unsubscribe" to "unsubscribe" to msql-list-request@bunyip.com. Send a message containing
"info msql-list" to majordomo@bunyip.com for info on monthly archives of
the list. For more help, mail owner-msql-list@bunyip.com NOT the msql-list!
- Next message: Graeme Merrall: "[mSQL] (B5) Data ranges in Lite?"
- Previous message: Miche BLANC: "Re: [mSQL] n-n query"
- In reply to: Jeanne Gold: "Re: [mSQL] n-n query"
- Next in thread: Doug Salot: "Re: Fw: [mSQL] Locking?"
- Reply: Doug Salot: "Re: Fw: [mSQL] Locking?"
- Reply: Clyde Smith-Stubbs: "Re: Fw: [mSQL] Locking?"