[comp.sys.amiga] Practical task switch and software interrupt switching speed

dillon@CORY.BERKELEY.EDU (Matt Dillon) (03/26/88)

	Here are some timing tests on the relative speed of message
passing and software interrupt overhead.   The code is included.
(It's too small to bother the moderators).

						-Matt


#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	README
#	softint.c
#	softint.uue
#	taskswitch.c
#	taskswitch.uue
# This archive created: Sat Mar 26 00:56:19 1988
export PATH; PATH=/bin:/usr/bin:$PATH
echo shar: "extracting 'README'" '(1455 characters)'
if test -f 'README'
then
	echo shar: "will not over-write existing file 'README'"
else
cat << \!Funky!Stuff! > 'README'

	This is too small to post to the moderators.  It should interest
those of you who are interested in practical message passing speeds
between two processes and practical software interrupt handler speeds.

TEST 1:
	Given two tasks running at priority 0 (the priority doesn't
	really effect the results) with no other applications running,
	how fast can these two tasks bandy a message back and forth?

	Each cycle is defined by:  A-(msg)->B, B-(msg)->A 

	results:	1000 cycles / second 

TEST 2:
	Given a task running at priority 1 (again, the priority could
	just as well be 0), with no other applications running,
	how fast can this task bandy a message to a software interrupt
	handler (e.g. the port type is SOFTINT and the handler replies
	the message):

	Each cycle is defined by: A-(msg)->SoftHndlr, SoftHndlr-(msg)->A

	results:	1736 cycles / second

TEST Conditions:

	The test programs are written in C.  They use standard calls for
	everything.  NOTE: The software interrupt handler is also written
	in C, and thus has a bit more overhead than one would normally
	associate with a software interrupt.  However, the task-switch
	tester has no more overhead than equivalent assembly.

	All code is placed in public domain.

	The numbers indicated are on a standard A1000 with expansion
	memory (which doesn't really matter all that much), with no
	other applications running during the test.

	The code was compiled under Aztec C.

					-Matt


!Funky!Stuff!
fi  # end of overwriting check
echo shar: "extracting 'softint.c'" '(2220 characters)'
if test -f 'softint.c'
then
	echo shar: "will not over-write existing file 'softint.c'"
else
cat << \!Funky!Stuff! > 'softint.c'

/*
 *  softint [#iterations]
 *
 *  Matthew Dillon
 *
 *  1000 switches/sec.	(taskswitch)
 *  1736 softints/sec.	(softint)
 */

typedef struct MsgPort	PORT;
typedef struct Task	TASK;
typedef struct Message	MSG;
typedef struct Interrupt INTR;

extern TASK *CreateTask();
extern TASK *FindTask();
extern PORT *CreatePort();
extern PORT *CreateSoftPort();
extern MSG  *GetMsg();
extern void *AllocMem();
extern void  subtask();
extern void  softhandler();

int Enable_Abort;
int Iterations;

PORT	*Port;
TASK	*Task;
MSG	Msg;

main(ac,av)
char *av[];
{
    TASK *task;
    MSG  *msg;

    if (ac == 1) {
	puts("softint #iterations");
	exit(1);
    }
    Iterations = atoi(av[1]);
    Task = FindTask(NULL);
    Enable_Abort = 0;
    Port = CreateSoftPort(softhandler);
    puts("go");
    if (task = CreateTask("switchrate.slave", 1, subtask, 2048))
	Wait(SIGBREAKF_CTRL_D);
    puts("stop");
    DeleteSoftPort(Port);
    puts("done");
}

PORT *
CreateSoftPort(handler)
void (*handler)();
{
    register PORT *port = AllocMem(sizeof(PORT), MEMF_PUBLIC|MEMF_CLEAR);
    register INTR *intr = AllocMem(sizeof(INTR), MEMF_PUBLIC|MEMF_CLEAR);

    intr->is_Node.ln_Pri = 0;
    intr->is_Node.ln_Type = NT_INTERRUPT;
    intr->is_Data = NULL;
    intr->is_Code = handler;

    port->mp_Flags = PA_SOFTINT;
    port->mp_SigTask = (TASK *)intr;
    port->mp_Node.ln_Type = NT_MSGPORT;
    NewList(&port->mp_MsgList);
    return(port);
}

DeleteSoftPort(port)
PORT *port;
{
    FreeMem(port->mp_SigTask, sizeof(INTR));
    FreeMem(port, sizeof(PORT));
}

/*
 *  Software interrupt handler.  Called with
 *  D0/D1/A0/A1/A5/A6 scratch as far as we are concerned.
 */

void
softhandler()
{
    MSG *msg;
#asm
    movem.l D2/D3,-(sp)
#endasm
    geta4();
    if (msg = GetMsg(Port)) {
	if (!--Iterations)
	    msg->mn_Length = 1;
	ReplyMsg(msg);
    }
#asm
    movem.l (sp)+,D2/D3
#endasm

}




void
subtask()
{
    geta4();
    Msg.mn_ReplyPort = CreatePort(NULL,0);
    Msg.mn_Length = 0;
    while (Msg.mn_Length == 0) {
	PutMsg(Port, &Msg);
	WaitPort(Msg.mn_ReplyPort);
	GetMsg(Msg.mn_ReplyPort);
    }
    DeletePort(Msg.mn_ReplyPort);
    Forbid();
    Signal(Task, SIGBREAKF_CTRL_D);
    RemTask(NULL);
    /*	No Permit */
}

!Funky!Stuff!
fi  # end of overwriting check
echo shar: "extracting 'softint.uue'" '(6886 characters)'
if test -f 'softint.uue'
then
	echo shar: "will not over-write existing file 'softint.uue'"
else
cat << \!Funky!Stuff! > 'softint.uue'
begin 644 softint
M```#\P`````````#``````````(```10````D@````$```/I```$4$[Z`G1.
M5?_X#*T````!``AF%$AZ`)9.N@8L6$](>``!3KH,,%A/(&T`#"\H``1.N@'B
M6$\I0((F0J=.NA``6$\I0((N0JR"(DAZ`1Y.N@".6$\I0((J2'H`9DZZ!>A8
M3TAX"`!(>@%`2'@``4AZ`%-.N@[H3^\`$"M`__QG"DAX(`!.NA!Z6$](>@!(
M3KH%MEA/+RR"*DZZ`*A83TAZ`#E.N@6B6$].74YU<V]F=&EN="`C:71E<F%T
M:6]N<P!G;P!S=VET8VAR871E+G-L879E`'-T;W``9&]N90!.50``2.<`,$AY
M``$``4AX`").N@Y84$\D0$AY``$``4AX`!9.N@Y&4$\F0$(K``D7?``"``A"
MJP`.)VT`"``2%7P``0`.)4L`$!5\``0`"$AJ`!1.N@]66$\@"DS?#`!.74YU
M3E4``$AX`!8@;0`(+R@`$$ZZ#P903TAX`"(O+0`(3KH.^%!/3EU.=4Y5__Q(
MYS``3KH!=B\L@BI.N@[^6$\K0/_\9QY3K((F9@H@;?_\,7P``0`2+RW__$ZZ
M#S983TS?``Q.74YU3E4``$ZZ`3Q"IT*G3KH,JE!/*4""1$)L@DA*;()(9B1(
M;((V+RR"*DZZ#MI03R\L@D1.N@\P6$\O+()$3KH.E%A/8-8O+()$3KH,^EA/
M3KH.5DAX(``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[^8DY5``!(YP@@2'C__TZZ`-!8
M3R@`L+S_____9@IP`$S?!!!.74YU2'D``0`!2'@`(DZZ`+A03R1`2H!F#"\$
M3KH!SEA/<`!@UB5M``@`"A5M``\`"15\``0`"$(J``X51``/0J=.N@%X6$\E
M0``02JT`"&<*+PI.N@!:6$]@"DAJ`!1.N@&F6$\@"F"23E4``"\*)&T`"$JJ
M``IG""\*3KH!NEA/%7P`_P`()7S_____`!1P`!`J``\O`$ZZ`5)83TAX`"(O
M"DZZ`3)03R1?3EU.=2)O``0L;('F3N[^GB`O``0L;('F3N[^MD[Z``),[P`#
M``0L;('F3N[_.DY5_^!(YP`P("T`%%:`P+S____\*T``%$'M_^!#[(&\<`<@
MV5'(__PK;0`4__Q(;?_@3KH`HEA/)D!*@&8*<`!,WPP`3EU.=21K`!`E:P`8
M`#H@*@`ZT*T`%"5``#XE0``V%7P``0`(%6T`#P`))6T`"``*2&H`2DZZ`+18
M3R\+2&H`2DZZ`"I03T*G+RT`$"\*3KH`*D_O``P@"F"B3E4``"\M``A.N@#"
M6$].74YU3.\#```$+&R!YD[N_Q!(YP`P3.\.```,+&R!YDZN_N9,WPP`3G4@
M;P`$+&R!YD[N_R).^@`"(F\`!"QL@>9.[O[:3OH``BQL@>9.[O]\3OH``B)O
M``0@+P`(+&R!YD[N_RX@+P`$+&R!YD[N_K!.^@`"(&\`!"QL@>9.[OZ,(&\`
M!""(6)!"J``$(4@`"$YU+&R!YB)O``0@+P`(3N[]V$SO`P``!"QL@>9.[OZ2
M(F\`!"QL@>9.[OZ8(F\`!"QL@>9.[O[@3OH``B)O``0L;('F3N[^ADSO``,`
M!"QL@>9.[O[.(F\`!"`O``@L;('F3N[^O"`O``0L;('F3N[^PD[Z``(@;P`$
M+&R!YD[N_H!,[P,```0L;((R3N[_H"!O``0L;((R3N[_IB!O``0L;((R3N[_
ML@```^P````!`````0```NH````````#\@```^H```!W````````````````
M`0`````!``````````````````````$!`````0`````````````````````!
M`@````$`````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````%`````````````````````(``0`!
>````7``!``````````````/R```#ZP````$```/R
`
end
!Funky!Stuff!
fi  # end of overwriting check
echo shar: "extracting 'taskswitch.c'" '(1265 characters)'
if test -f 'taskswitch.c'
then
	echo shar: "will not over-write existing file 'taskswitch.c'"
else
cat << \!Funky!Stuff! > 'taskswitch.c'

/*
 *  taskswitch [#iterations]
 *
 *  Matthew Dillon
 *
 *  1000 switches/sec.	(taskswitch)    rough figures
 *  1736 softints/sec.	(softint)
 */

typedef struct MsgPort	PORT;
typedef struct Task	TASK;
typedef struct Message	MSG;

extern TASK *CreateTask();
extern PORT *CreatePort();
extern MSG  *GetMsg();
extern void  subtask();

int Enable_Abort;

PORT	*Port;
MSG	Msg;

main(ac,av)
char *av[];
{
    int i, n;
    TASK *task;
    MSG  *msg;

    if (ac == 1) {
	puts("taskswitch #iterations");
	exit(1);
    }
    n = atoi(av[1]);
    Enable_Abort = 0;
    if (Port = CreatePort(NULL,0)) {
	if (task = CreateTask("taskswitch.slave", 0, subtask, 2048)) {
	    puts("go");
	    for (i = 0; i < n; ++i) {
		WaitPort(Port);
		ReplyMsg(GetMsg(Port));
	    }
	    puts("stop");
	    WaitPort(Port);
	    msg = GetMsg(Port);
	    msg->mn_Length = 1;
	    ReplyMsg(msg);
	    WaitPort(Port);
	}
	DeletePort(Port);
    }
    puts("done");
}

void
subtask()
{
    geta4();
    Msg.mn_ReplyPort = CreatePort(NULL,0);
    Msg.mn_Length = 0;
    while (Msg.mn_Length == 0) {
	PutMsg(Port, &Msg);
	WaitPort(Msg.mn_ReplyPort);
	GetMsg(Msg.mn_ReplyPort);
    }
    DeletePort(Msg.mn_ReplyPort);
    Forbid();
    PutMsg(Port, &Msg);
    RemTask(NULL);
    /*	No Permit */
}

!Funky!Stuff!
fi  # end of overwriting check
echo shar: "extracting 'taskswitch.uue'" '(6691 characters)'
if test -f 'taskswitch.uue'
then
	echo shar: "will not over-write existing file 'taskswitch.uue'"
else
cat << \!Funky!Stuff! > 'taskswitch.uue'
begin 644 taskswitch
M```#\P`````````#``````````(```0L````D`````$```/I```$+$[Z`@!.
M5?_P#*T````!``AF%$AZ`.A.N@6X6$](>``!3KH+O%A/(&T`#"\H``1.N@%N
M6$\K0/_X0JR"(D*G0J=.N@VH4$\I0((F9P``HDAX"`!(>@#>0J=(>@"Y3KH.
MB$_O`!`K0/_T9WI(>@"X3KH%8%A/0JW__&`@+RR")DZZ#_I83R\L@B9.N@]Z
M6$\O`$ZZ#\I83U*M__P@+?_\L*W_^&W62'H`@4ZZ!2983R\L@B9.N@_&6$\O
M+((F3KH/1EA/*T#_\"!M__`Q?``!`!(O+?_P3KH/AEA/+RR")DZZ#YI83R\L
M@B9.N@V,6$](>@`\3KH$W%A/3EU.=71A<VMS=VET8V@@(VET97)A=&EO;G,`
M=&%S:W-W:71C:"YS;&%V90!G;P!S=&]P`&1O;F4``$Y5``!.N@$\0J="ITZZ
M#*I03RE`@CQ";()`2FR"0&8D2&R"+B\L@B9.N@[:4$\O+((\3KH/%%A/+RR"
M/$ZZ#I183V#6+RR"/$ZZ#/I83TZZ#E9(;((N+RR")DZZ#JA03T*G3KH.NEA/
M3EU.=4Y5``!(YPP@)&T`"'@`>@`,$@`@9@12BF#V#!(`+68$4HIZ`0P2`#!M
M)@P2`#EN("!*4HH0$$B`2,`B!..!T($D!.>"T((H`)B\````,&#42H5G!B`$
M1(!@`B`$3-\$,$Y=3G5A<$/L@=Y%[('>M<EF#C(\`!AK"'0`(L)1R?_\*4^!
MXBQX``0I3H'F2.>`@`@N``0!*6<02_H`"$ZN_^)@!D*G\U].<T/Z`"!.KOYH
M*4"!ZF8,+CP``X`'3J[_E&`$3KH`&E!/3G5D;W,N;&EB<F%R>0!)^0``?_Y.
M=4Y5```O"DA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!16@,"\
M_____"M``!1![?_@0^R!O'`'(-E1R/_\*VT`%/_\2&W_X$ZZ`*)83R9`2H!F
M"G``3-\,`$Y=3G4D:P`0)6L`&``Z("H`.M"M`!0E0``^)4``-A5\``$`"!5M
M``\`"25M``@`"DAJ`$I.N@"T6$\O"TAJ`$I.N@`J4$]"IR\M`!`O"DZZ`"I/
M[P`,(`I@HDY5```O+0`(3KH`PEA/3EU.=4SO`P``!"QL@>9.[O\02.<`,$SO
M#@``#"QL@>9.KO[F3-\,`$YU(&\`!"QL@>9.[O\B3OH``B)O``0L;('F3N[^
MVD[Z``(L;('F3N[_?$[Z``(B;P`$("\`""QL@>9.[O\N("\`!"QL@>9.[OZP
M3OH``B!O``0L;('F3N[^C"!O``0@B%B00J@`!"%(``A.=2QL@>8B;P`$("\`
M"$[N_=A,[P,```0L;('F3N[^DB)O``0L;('F3N[^F")O``0L;('F3N[^X$[Z
M``(B;P`$+&R!YD[N_H9,[P`#``0L;('F3N[^SD[Z``(@;P`$+&R!YD[N_H!,
M[P,```0L;((J3N[_H"!O``0L;((J3N[_IB!O``0L;((J3N[_L@```^P````!
M`````0```G8````````#\@```^H```!W`````````````````0`````!````
M``````````````````$!`````0`````````````````````!`@````$`````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````%`````````````````````(``0`!````7``!````
5``````````/R```#ZP````$```/R
`
end
!Funky!Stuff!
fi  # end of overwriting check
exit 0
#	End of shell archive

haitex@pnet01.cts.com (Wade Bickel) (03/29/88)

dillon@CORY.BERKELEY.EDU (Matt Dillon) writes:
>
>	Here are some timing tests on the relative speed of message
>passing and software interrupt overhead.   The code is included.
>(It's too small to bother the moderators).
>
>						-Matt
>
>
>TEST 1:
>	Given two tasks running at priority 0 (the priority doesn't
>	really effect the results) with no other applications running,
>	how fast can these two tasks bandy a message back and forth?
>
>	Each cycle is defined by:  A-(msg)->B, B-(msg)->A 
>
>	results:	1000 cycles / second 
>
>TEST 2:
>	Given a task running at priority 1 (again, the priority could
>	just as well be 0), with no other applications running,
>	how fast can this task bandy a message to a software interrupt
>	handler (e.g. the port type is SOFTINT and the handler replies
>	the message):
>
>	Each cycle is defined by: A-(msg)->SoftHndlr, SoftHndlr-(msg)->A
>
>	results:	1736 cycles / second
>
>TEST Conditions:
>
>	The test programs are written in C.  They use standard calls for
>	everything.  NOTE: The software interrupt handler is also written
>	in C, and thus has a bit more overhead than one would normally
>	associate with a software interrupt.  However, the task-switch
>	tester has no more overhead than equivalent assembly.

        In my interrupt server I have been useing shared memory with a few
conventions applied to prevent conflicts.  Seems to me that 1700 cycles is
at least two orders of magnitude smaller than the possble communications rate
I can achieve.  Are you sure this is correct?


                                        Thanks,

                                                        Wade.


UUCP: {cbosgd, hplabs!hp-sdd, sdcsvax, nosc}!crash!pnet01!haitex
ARPA: crash!pnet01!haitex@nosc.mil
INET: haitex@pnet01.CTS.COM

dillon@CORY.BERKELEY.EDU (Matt Dillon) (03/30/88)

:>TEST 1:
:>	Each cycle is defined by:  A-(msg)->B, B-(msg)->A 
:>	results:	1000 cycles / second 
:>TEST 2:
:>	Each cycle is defined by: A-(msg)->SoftHndlr, SoftHndlr-(msg)->A
:>	results:	1736 cycles / second

:        In my interrupt server I have been useing shared memory with a few
:conventions applied to prevent conflicts.  Seems to me that 1700 cycles is
:at least two orders of magnitude smaller than the possble communications rate
:I can achieve.  Are you sure this is correct?

	I think you didn't read my test descriptions.  The only type of
interrupt I tested was a SOFTWARE interrupt generated continuously from a 
task.  I did NOT test HARDWARE interrupts.

	Anybody who has traced the code can tell you that CA did a 
slam-bang job on the hardware interrupts.... very little overhead for
a lot of nice features.  Assuming an interrupt handler doesn't have to
PutMsg() or Signal() anybody, it goes extremely fast.... essentially
the standard 68000 interrupt overhead plus a small number of instructions.
Throughput of at least 8000+ interrupts / sec (average), assuming your
interrupt handler doesn't need to do much.  (that is a rough figure, it
is probably even faster!)

	If your hardware interrupt *does* PutMsg() or Signal() something,
we are still talking 2500+ interrupts / sec (average).

						-Matt