* [Q] Regarding OSF/1 threads
@ 1993-11-18 20:27 George P. Swanton
1993-11-20 1:55 ` Matt Thomas
0 siblings, 1 reply; 2+ messages in thread
From: George P. Swanton @ 1993-11-18 20:27 UTC (permalink / raw)
I've done a very simple 'benchmark' on our Alpha's (3K/400 OSF1 1.2) to
see how pthreads/cmathreads compared to standard processes with regard
to context switching.
Gist of the thing:
create two threads or processes, alternate executing (essentially)
gettimeofday(&start, NULL); /* actually occurs only once */
for(;;) {
if (++count >= 10000)
break;
[cma/pthread/sched]_yield(); /* as appropriate */
}
gettimeofday(&stop, NULL);
dump the equivalent of (stop - start)
Not much to it really.
The results were not what I expected. Basically the processes were
consistently faster:
abstraction avg time (usec) to execute
cmathread 199104
pthread 192272
process 164944
control 976 (single thread executing for loop w/o switching)
(note that the resolution of the timer is 976 usec)
I had expected threads to be the faster. My feeling is that either I've
made an invalid assumption about the benchmark or all three abstractions
somehow map to the same Mach abstraction and processes are more direct
about it.
Comments?
Profiling shows the following (digested, each for 1 thread/process,
BTW: anyway to get statistics for ALL threads?)
cmathreads
cycl/
calls %cycles call sec procedure
5000 36.22 12 .0004 cma_yield (blah/DECthreads/COMMON/cma_thread.c)
5000 9.05 3 .0001 swtch_pri (blah/alpha/usr/include/mach/syscall_sw.h)
2 30.21 50000 .0003 (benchmark procedure)
pthreads
cycl/
calls %cycles call sec procedure
5000 36.85 12 .0004 pthread_yield (blah/DECthreads/COMMON/cma_thread.c)
5000 9.21 3 .0001 swtch_pri (blah/alpha/usr/include/mach/syscall_sw.h)
2 30.73 50038 (benchmark procedure)
unix process
cycl/
calls %cycles call sec procedure
4999 21.34 3 .0001 sched_yield (blah/librt/alpha/schyield.s)
1 78.27 55009 .0004 (benchmark procedure)
swtch_pri apparently traps to the kernel (eg, .../mach/syscall_sw.h)
It makes sense that sched_yield does the same.
I cant decide whether cma/pthread_yield are just simple library
routines or another trap stub.
I thought OSF/1 threads were a user-level implementation, is this incorrect?
Any feedback anyone wishes to offer is appreciated.
Thanks
George P Swanton
swanton@moose.usmcs.maine.edu
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Q] Regarding OSF/1 threads
1993-11-18 20:27 [Q] Regarding OSF/1 threads George P. Swanton
@ 1993-11-20 1:55 ` Matt Thomas
0 siblings, 0 replies; 2+ messages in thread
From: Matt Thomas @ 1993-11-20 1:55 UTC (permalink / raw)
In article <9311182027.AA02358@puffin.usmcs.maine.edu>, swanton@puffin.usmcs.maine.edu (George P. Swanton) writes:
|>
|>I thought OSF/1 threads were a user-level implementation, is this incorrect?
|>
|>Any feedback anyone wishes to offer is appreciated.
thread are kernel-based, not users and are scheduled by the kernel.
--
Matt Thomas Internet: thomas@lkg.dec.com
U*X Networking UUCP: ...!decwrl!thomas
Digital Equipment Corporation Disclaimer: This message reflects my own
Littleton, MA warped views, etc.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1993-11-20 1:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1993-11-18 20:27 [Q] Regarding OSF/1 threads George P. Swanton
1993-11-20 1:55 ` Matt Thomas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox