From: | Jordan Henderson <jordanh(at)ccia(dot)com> |
---|---|
To: | scrappy(at)hub(dot)org, hackers(at)postgreSQL(dot)org |
Subject: | Re: [HACKERS] spin locks |
Date: | 1998-02-16 14:21:34 |
Message-ID: | 199802161421.JAA03346@jaguar.ccia.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Folks,
On the thread in regards to spinlocks and multiple CPU's.
The line of thought appeared to be select a compile
time option to determine behavior, and whether to yield or not.
I am thinking that if it comes to having alternate code, the
system should be able to make the determination at runtime,
not compile time. I don't know if all of the platforms supported
have a version of the sysinfo utility, but here is how, at runtime
it gets the number of CPUS available:
**** EXCERPTED FROM SYSINFO SOURCE 3.3.1 ****
/*
* Use sysconf() to find number of CPU's.
*/
extern char *GetNumCpuSysconf()
{
int Num = -1;
static char *NumStr = NULL;
if (NumStr)
return(NumStr);
#if defined(_SC_NPROCESSORS_CONF)
Num = (int) sysconf(_SC_NPROCESSORS_CONF);
if (Num >= 0) {
NumStr = itoa(Num);
if (NumStr)
NumStr = strdup(NumStr);
}
#endif /* _SC_NPROCESSORS_CONF */
return(NumStr);
}
What I would propose, if the decision is made to yield,
that at initialization time, the number of CPU's available
are determined, and a flag set, or, an indirect jump
changed. This would allow the software to have both
personalities, depending on which system it found it
self running on.
Thoughts?
Jordan Henderson
From | Date | Subject | |
---|---|---|---|
Next Message | Zeugswetter Andreas SARZ | 1998-02-16 14:43:26 | AIX 4.1.5 is OK as of snapshot 16.2.98 |
Previous Message | Kent S. Gordon | 1998-02-16 14:18:31 | Re: DB logging (was: Problem with the numbers I reported yesterday) |