User:Justin545/sandbox

From Wikipedia, the free encyclopedia

Using comments to break lines in lists

line spacing tests[edit]

Misc.[edit]

  1. Apple
    1. Baseline
    2. Canada
      1. Description
      2. Employer
    3. Food
      1. Gear
    4. Human
  2. Interpretation
xyz
123
xyz
123
  • 111
  • 222
  • 333
  • {| class="wikitable"|-| aaaa2| bbbb|-| cccc| dddd|}

Lists[edit]

#1 #2 #4: Reason for 'overflow: hidden'. Related reference.

#3 #5: May change the style of the outer table of NumBlk to 'display:inline-table; vertical-align:middle;' to get rid of the 'div'.

Unordered list[edit]

*<math>3x+2y-z=1</math>
*:<math>2x-2y+4z=-2</math>
*::<math>-2x+y-2z=0</math>
*:::<math>-x-y-z=-9</math>
* {{NumBlk||<math>3x+2y-z=1</math>|Eq. 1}}
* {{NumBlk|:|<math>2x-2y+4z=-2</math>|Eq. 2}}
* {{NumBlk|::|<math>-2x+y-2z=0</math>|Eq. 3}}
* {{NumBlk|:::|<math>-x-y-z=-9</math>|Eq. 4}}
[[Image:Bnet_fan2.png|frame|right|Fig.1: Bayesian Network representation of Eq.(6)]]
[[Image:Bnet_fan2.png|frame|left|Fig.1: Bayesian Network representation of Eq.(6)]]
<div style="border: 1px dashed red; overflow: hidden;"><!-- #1 -->
* {{NumBlk||<math>7x+8y-9z=10</math>|Eq. 5}}
</div>
<div style="border: 1px dashed red; overflow: hidden;"><!-- #2 -->
* <div style="background-color: yellow; display: inline-block; vertical-align: middle; width: 100%;">{{NumBlk||<math>7x+8y-9z=10</math>|Eq. 5.5}}</div><!-- #3 -->
</div>
<div style="border: 1px dashed red; overflow: hidden;"><!-- #4 -->
* <div style="background-color: yellow; display: inline-block; vertical-align: middle; width: 100%;">{{NumBlk||<math>7x+8y-9z=10</math>|Eq. 5.75|LnSty=0.37ex dotted gainsboro}}</div><!-- #5 -->
</div>
* <div style="display: block; width: 100%; vertical-align: middle;">{{NumBlk||<math>3x+2y-z=1</math>|Eq. 6}}</div>
* <div style="display: block; width: 100%; vertical-align: middle;">{{NumBlk|:|<math>2x-2y+4z=-2</math>|Eq. 7}}</div>
* <div style="display: block; width: 100%; vertical-align: middle;">{{NumBlk|::|<math>-2x+y-2z=0</math>|Eq. 8}}</div>
* <div style="display: block; width: 100%; vertical-align: middle;">{{NumBlk|:::|<math>-x-y-z=-9</math>|Eq. 9}}</div>
* {{NumBlk||<math>3x+2y-z=1</math>|Eq. 11}}
** {{NumBlk|:|<math>2x-2y+4z=-2</math>|Eq. 12}}
*** {{NumBlk|::|<math>-2x+y-2z=0</math>|Eq. 13}}
**** {{NumBlk|:::|<math>-x-y-z=-9</math>|Eq. 14}}

(Eq. 1)

(Eq. 2)

(Eq. 3)

(Eq. 4)
Fig.1: Bayesian Network representation of Eq.(6)
Fig.1: Bayesian Network representation of Eq.(6)

(Eq. 5)

(Eq. 5.5)

(Eq. 5.75)

(Eq. 6)

(Eq. 7)

(Eq. 8)

(Eq. 9)

(Eq. 11)

(Eq. 12)

(Eq. 13)

(Eq. 14)

Unordered list (2)[edit]

*<math>3x+2y-z=1</math>
*:<math>2x-2y+4z=-2</math>
*::<math>-2x+y-2z=0</math>
*:::<math>-x-y-z=-9</math>
* {{NumBlk||<math>3x+2y-z=1</math>|Eq. 51}}
* {{NumBlk|:|<math>2x-2y+4z=-2</math>|Eq. 52}}
* {{NumBlk|::|<math>-2x+y-2z=0</math>|Eq. 53}}
* {{NumBlk|:::|<math>-x-y-z=-9</math>|Eq. 54}}
[[Image:Bnet_fan2.png|frame|right|Fig.1: Bayesian Network representation of Eq.(7)]]
[[Image:Bnet_fan2.png|frame|left|Fig.1: Bayesian Network representation of Eq.(7)]]
* <div style="border: 1px dashed red; overflow: hidden;">{{NumBlk||<math>7x+8y-9z=10</math>|Eq. 55}}</div>
* <div style="border: 1px dashed red; overflow: hidden;"><div style="background-color: yellow; display: inline-block; vertical-align: middle; width: 100%;">{{NumBlk||<math>7x+8y-9z=10</math>|Eq. 55.5}}</div></div>
* <div style="border: 1px dashed red; overflow: hidden;"><div style="background-color: yellow; display: inline-block; vertical-align: middle; width: 100%;">{{NumBlk||<math>7x+8y-9z=10</math>|Eq. 55.75|LnSty=0.37ex dotted gainsboro}}</div></div>
* <div style="border: 1px dashed red; overflow: hidden;">{{NumBlk||<math>7x+8y-9z=10</math>|Eq. 55.875|LnSty=0.37ex dotted gainsboro}}</div>
* <div style="display: block; width: 100%; vertical-align: middle;">{{NumBlk||<math>3x+2y-z=1</math>|Eq. 56}}</div>
* <div style="display: block; width: 100%; vertical-align: middle;">{{NumBlk|:|<math>2x-2y+4z=-2</math>|Eq. 57}}</div>
* <div style="display: block; width: 100%; vertical-align: middle;">{{NumBlk|::|<math>-2x+y-2z=0</math>|Eq. 58}}</div>
* <div style="display: block; width: 100%; vertical-align: middle;">{{NumBlk|:::|<math>-x-y-z=-9</math>|Eq. 59}}</div>
* {{NumBlk||<math>3x+2y-z=1</math>|Eq. 61}}
** {{NumBlk|:|<math>2x-2y+4z=-2</math>|Eq. 62}}
*** {{NumBlk|::|<math>-2x+y-2z=0</math>|Eq. 63}}
**** {{NumBlk|:::|<math>-x-y-z=-9</math>|Eq. 64}}

(Eq. 51)

(Eq. 52)

(Eq. 53)

(Eq. 54)
Fig.1: Bayesian Network representation of Eq.(7)
Fig.1: Bayesian Network representation of Eq.(7)

(Eq. 55)

(Eq. 55.5)

(Eq. 55.75)

(Eq. 55.875)

(App)

(Bas)

(Can)

(Des)

(Emp)

(Foo)

(Gea)

(Hum)

(Int)

(Eq. 56)

(Eq. 57)

(Eq. 58)

(Eq. 59)

(Eq. 61)

(Eq. 62)

(Eq. 63)

(Eq. 64)

Monolithic indent[edit]

(1)

(2)

(3)

(14)

(15)

(16)

(24)

(25)

(26)

(34)

(35)

(36)

(41)

(42)

(43)

(51)

(52)

(53)

(61)

(62)

(63)

Indentation comparisons[edit]

(70.5)

(71.5)

(72.5)

(73.5)

(79.5)

Proof of hypothetical syllogism by constructive dilemma[edit]

/ / Lemma: Logical equivalences involving conditional statements B

/ / Lemma: Identity laws A

/ / Lemma: Negation laws A

/ / Lemma: Constructive dilemma

/ / Lemma: Logical equivalences involving conditional statements A

.1 / / premise

.11 / .1 / Logical equivalences involving conditional statements B

.12 / .11

.13 / .1 .12

.14 / .13 / Identity laws A

.15 / .14

.16 / .15

.17 / .13 .16

.18 / .17

.19 / .18 / Negation laws A

.2 / .19

.21 / .18 .2

.22 / .21 / Constructive dilemma

.23 / .22

.24 / .23

.25 / .24 / Logical equivalences involving conditional statements A

.26 / .25

.27 / .24 .26

.28 / .2 .27

.29 / .28

.3 / .16 .29

.31 / .12 .3 / conclusion

Getting rid of the daemon & speeding up D-Bus without hacking the kernel?[edit]

Someone pointed out that Dbus is very slow in an e-mail of DBus's mailing list. According to Speeding up D-Bus [LWN.net], the performance issue again has something to do with the "daemon" or "server process", just like the issue X Window is facing. The problem, as my understanding, is DBus daemon and X Server get involved too much so that frequent IPC between server and clients slows down the whole subsystems. Offloading server's job to the clients should somewhat improve the situation.

Diagram 1 demonstrates a DBus flow where Process A sends a message to Process B. (I know very little about DBus, all diagrams here are just to demonstrate the idea only) When message sent by Process A arrives Process B, it calls its message handler to handle the message. Because each message must pass through the DBus daemon, a message sent by a client process must undergo at least two context switches to be propagated to the client process on the other side.

Diagram 1

The Message handler in Diagram 1 may look like this:

void messageHandler(DBusMessage & dBusMessage)
{
   if (dBusMessage == FOO_MESSAGE) {
      ... do something for FOO_MESSAGE ...
   } else if (dBusMessage == BAR_MESSAGE) {
      ... do something for BAR_MESSAGE ...
   } else if (dBusMessage == ...) {
      ...
   }
}

Message Handler is executed in the context of Process B. Normally, the handler need to access variables in address space of Process B in order to do something useful.

The flow in Diagram 1 shows the possible high latency problem (made by context switches) currently DBus has. So I came up with a simple idea to change the design like this:

Diagram 2

Mechanism of shared memory is the foundation in this design. The message handler code and all variables it would access are shared by the message sender process (Process A) and the message receiver process (Process B) (as shown in Diagram 2 where address space of Process A and Process B overlap on the Message handler part). The role of DBus daemon is no longer be a message relay or router. Instead, the daemon is more like a telephone operator whose job is to bind the receiver's message handler to the sender so that when the sender wants to send a message to the receiver, it actually calls the message handler of the receiver directly. Similar to the original design, the message is passed as an argument to the message handler messageHandler(DBusMessage & dBusMessage), but the handler is now called by the message sender rather than by the message receiver, which implies the handler is executed in the context of the sender rather than executed in the context of the receiver. The outcome of the design is that the two context switches in the original design are completely eliminated (the latency is gone) and no kernel hacking is required (required by the solution mentioned in article "Speeding up D-Bus [LWN.net]" above) ... although synchronization would be needed because sender and receiver may share some part of variables.

So I would like to know how do you think about the new design? And is it feasible? Is it really beneficial? Or my description is unclear? --


  • how to make synchronization of receiver variable transparent to programmer is the challenge, choices may be:
    • page fault or SIGSEGV (enforced by mprotect()) to protect shared variables transparently
    • ptrace to set data breakpoint / ptrace to instrument code of client process
    • call mmap() with MAP_SHARED when client process calls library functions to share out its message handler (alt: ptrace to force client process to call mmap() with MAP_SHARED)
    • change DBus interface where programmer must use APIs with sync. to access shared varibles
    • suggest people stop using DBus (inadequate, unfriendly interface & undemocratic policy) and switch to other existing IPC comparable with DBus yet adquate (can do as good as my suggested new design)
    • so many people in need for speed, but DBus can't satisfy them and no existing candidate to use. So we should create one for ourself!
  • link (bind) from message sender to message receiver's event handler dynamically, sender calls receiver's handler directly instead of sending message to receiver
  • multicast
  • maintain shared memory maps? or open mmap() file descriptors? shared mem mapping still in effect after fd is closed?

Is it possible to transfer the handler code (and accessed variables) from Process B to A such that Process A may call the handler directly?

(it's undeniable (isn't it?) there are so many applications depend on such client-server design, e.g. httpd, sshd, ...)


  • what's the difference between KDBus & Alberto Mardegan's [1] [2]?
  • Alberto Mardegan's won't results N^2 connections?
  • DBus spec. says its low-latency, misleading?
  • Don't be afraid to rewrite existing code, otherwise we can only achieve suboptimal. I would rather create my own IPC instead of using DBus
  • What's DBus policy?
  • Moving DBus into kernel isn't portable