From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <0d7bea785d989cd275b7ca67cfa6cdeb@yourdomain.dom> To: 9fans@cse.psu.edu Cc: torvalds@osdl.org, sionide@beefed.org, fa1th@beefed.org From: dbailey27@ameritech.net MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] Threads: Sewing badges of honor onto a Kernel Date: Thu, 26 Feb 2004 23:45:50 -0500 Topicbox-Message-UUID: fbf01ba0-eacc-11e9-9e20-41e7f4b1d025 A few of us had a discussion this evening on the state of Linux and bloat in the Operating System development community. This isn't an event isolated to this evening, however tonight had a bit of spice. Andrey gleamed this bit of interesting text on the O'Reilly[1] website. Let's have a look at a snippet, shall we? Under the "Kernel Space and User Space" heading: | ... Another example of this happened in the Plan 9 operating system. | They had this really cool system call to do a better process fork--a | simple way for a program to split itself into two and continue processing | along both forks. This new fork, which Plan 9 called R-Fork (and SGI later | called S-Proc) essentially creates two separate process spaces that share | an address space. This is helpful for threading especially. | Linux does this too with its clone system call, but it was implemented | properly. However, with the SGI and Plan9 routines they decided that | programs with two branches can share the same address space but use | separate stacks. Normally when you use the same address in both threads, | you get the same memory location. But you have a stack segment that is | specific, so if you use a stack-based memory address you actually get | two different memory locations that can share a stack pointer without | overriding the other stack. | While this is a clever feat, the downside is that the overhead in maintaining | the stacks makes this in practice really stupid to do. They found out too | late that the performance went to hell. Since they had programs which used | the interface they could not fix it. Instead they had to introduce an additional | properly-written interface so that they could do what was wise with the stack | space. ... This commentary from Linus Torvalds on rfork[2] proclaims that a single, unified stack space for multiple threads is not only beneficial but imperative for proper thread propagation. What we are wondering is ... why? What scenario would make a unified stack segment beneficial in a multi-threaded execution environment. Is this something that should be an optional parameter on-the-fly in a call to rfork() ? Does clone() in Linux allow you to decide, or, does it enforce the unified stack segment? Doesn't unification create collisions within scopes of process namespaces through recursion and non-leaf code vectors? Since we couldn't figure out the logic behind this Lunix tantra, we thought trolling the public would be a slick idea. Who has an opinion on (or a defense for ;-)) this statement? Also, who is the "They" that "found out too late that the performance went to hell". Curious minds are interested. Don (north_) References: [1] http://www.oreilly.com/catalog/opensources/books/linus.html [2] fork(2)