diff options
Diffstat (limited to 'docs/tutorials/018/page06.html')
-rw-r--r-- | docs/tutorials/018/page06.html | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/docs/tutorials/018/page06.html b/docs/tutorials/018/page06.html deleted file mode 100644 index f26fa5a5452..00000000000 --- a/docs/tutorials/018/page06.html +++ /dev/null @@ -1,79 +0,0 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="Author" CONTENT="James CE Johnson"> - <TITLE>ACE Tutorial 018</TITLE> -</HEAD> -<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#000FFF" VLINK="#FF0F0F"> - -<CENTER><B><FONT SIZE=+2>ACE Tutorial 018</FONT></B></CENTER> - -<CENTER><B><FONT SIZE=+2>The FIFO Nature of ACE_Token</FONT></B></CENTER> - -<P> -<HR WIDTH="100%"> -That's it for the code, now let's take a quick look at some output. -The first set of output is from the Token test, the second is Mutex -test. Notice how the threads are evenly utilized in the Token test. -Each thread gets to see exactly two messages. There's also an -interesting side-effect that the messages are processed in order. (You -can't rely on that, it just happend in this particular run.) -<P> -With the Mutex test, however, we see that the first thread gets no -less than 1/2 of all messages. In fact, if we didn't have the -governor in svc() it might have gotten them all! -<P> -Why does this happen? -<P> -Primarily because of time slicing. Even though each thread takes time -to do work (1 second in our test), it can still own the timeslice when -it gets back to the mutex acquire. Since the other threads are still -switched out, the current thread regets the lock and continues. On -the other hand, the ACE_Token is very careful about the order in which -the acquisition is allowed and more evenly distributes the work. -<P> -Play around with the sleep() call in svc(). You'll find that as you -decrease it, there is more chance that even the Token test will do -most of its work in one thread. You're still at the mercy of the OS -time slicing. In reality, though, it will take a moment or two for -work to be done. The end goal isn't necessarily to distribute the -work evenly over all threads but, rather, to distribute it evenly -among <i>available</i> threads. The distinction is subtle but important. -<HR> -<PRE> -(21386|1024|15:26:32.366520) Test (Token) created -1 (21386|1025|15:26:32.390340) <font color=#008888>Test::svc</font>() Entry -2 (21386|2050|15:26:32.408330) <font color=#008888>Test::svc</font>() Entry -3 (21386|3075|15:26:32.427363) <font color=#008888>Test::svc</font>() Entry -4 (21386|4100|15:26:32.447285) <font color=#008888>Test::svc</font>() Entry -5 (21386|5125|15:26:32.482479) <font color=#008888>Test::svc</font>() Entry -1 (21386|1025|15:26:32.498583) <font color=#008888>Test::svc</font>() received message #1 (Message Number 0) -2 (21386|2050|15:26:33.517770) <font color=#008888>Test::svc</font>() received message #1 (Message Number 1) -3 (21386|3075|15:26:34.537701) <font color=#008888>Test::svc</font>() received message #1 (Message Number 2) -4 (21386|4100|15:26:35.557675) <font color=#008888>Test::svc</font>() received message #1 (Message Number 3) -5 (21386|5125|15:26:36.577650) <font color=#008888>Test::svc</font>() received message #1 (Message Number 4) -1 (21386|1025|15:26:37.597689) <font color=#008888>Test::svc</font>() received message #2 (Message Number 5) -2 (21386|2050|15:26:38.607689) <font color=#008888>Test::svc</font>() received message #2 (Message Number 6) -3 (21386|3075|15:26:39.617675) <font color=#008888>Test::svc</font>() received message #2 (Message Number 7) -4 (21386|4100|15:26:40.637653) <font color=#008888>Test::svc</font>() received message #2 (Message Number 8) -5 (21386|5125|15:26:41.657637) <font color=#008888>Test::svc</font>() received message #2 (Message Number 9) - -(21386|1024|15:26:42.679919) Test (Mutex) created -1 (21386|6150|15:26:42.700301) <font color=#008888>Test::svc</font>() Entry -2 (21386|7175|15:26:42.737413) <font color=#008888>Test::svc</font>() Entry -3 (21386|8200|15:26:42.754241) <font color=#008888>Test::svc</font>() Entry -4 (21386|9225|15:26:42.772122) <font color=#008888>Test::svc</font>() Entry -5 (21386|10250|15:26:42.788867) <font color=#008888>Test::svc</font>() Entry -1 (21386|6150|15:26:42.806260) <font color=#008888>Test::svc</font>() received message #1 (Message Number 0) -1 (21386|6150|15:26:43.807539) <font color=#008888>Test::svc</font>() received message #2 (Message Number 5) -1 (21386|6150|15:26:44.817569) <font color=#008888>Test::svc</font>() received message #3 (Message Number 6) -1 (21386|6150|15:26:45.827571) <font color=#008888>Test::svc</font>() received message #4 (Message Number 7) -1 (21386|6150|15:26:46.837581) <font color=#008888>Test::svc</font>() received message #5 (Message Number 8) -2 (21386|7175|15:26:47.847908) <font color=#008888>Test::svc</font>() received message #1 (Message Number 1) -2 (21386|7175|15:26:48.857555) <font color=#008888>Test::svc</font>() received message #2 (Message Number 9) -4 (21386|9225|15:26:49.867991) <font color=#008888>Test::svc</font>() received message #1 (Message Number 3) -3 (21386|8200|15:26:50.887559) <font color=#008888>Test::svc</font>() received message #1 (Message Number 2) -5 (21386|10250|15:26:51.898275) <font color=#008888>Test::svc</font>() received message #1 (Message Number 4) -</PRE> -<P><HR WIDTH="100%"> -<CENTER>[<A HREF="../online-tutorials.html">Tutorial Index</A>] [<A HREF="page07.html">Continue This Tutorial</A>]</CENTER> |