Wednesday, February 27, 2008

What Is "Load Average" In Top's Output Anyway?


When I started using Unix in 1989, I learned about the "top" command to see how hard the computer was working. There are many numbers in top's output. Some (such as time, uptime, number of users, CPU states, etc.) are easy to understand. However, I never really understood what "load average" means.

Of course, if the computer is doing nothing, the load average would be low, and if the computer is busy, the load average will be large. However, the number can go much higher than 1, so it's not the fraction of the computer's capacity that is being used. I was never curious enough to find out exactly what that number means, and just settled for general feeling of typical numbers that would be "safe" for each computer.

Now, thanks to the magic of the Internet, the exact meaning can easily be found here and here. (Yes, it's easily found, but to really understand it, you need to read till the end.)

To summarize:

So, what have we learned? Those three innocuous looking numbers in the LA triplet have a surprising amount of depth behind them.

The triplet is intended to provide you with some kind of information about how much work has been done on the system in the recent past (1 minute), the past (5 minutes) and the distant past (15 minutes).

and

Those three little numbers tucked away innocently in certain UNIX commands are not so trivial after all. The first point is that load in this context refers to run-queue length (i.e., the sum of the number of processes waiting in the run-queue plus the number currently executing). Therefore, the number is absolute (not relative) and thus it can be unbounded; unlike utilization (AKA ``load'' in queueing theory parlence).

Monday, February 25, 2008

And So It Goes...

ครับ หลังจากหมาอัลเซเชียนวีรบุรุษหางจุกตูด หมาบูลด็อกผู้ดุดันไปเลียมือโจร และหมาโกลเด้นปากจู๋เชิญโจรเข้าบ้าน ก็ถึงตาที่หมาพันทางเฝ้าบ้านทั้งหลายต้องออกมาสู้กับโจรอีกครั้ง

... จากเหตุผลดังกล่าวข้างต้น อดีตแกนนำพันธมิตรประชาชนเพื่อประชาธิปไตย เห็นว่า สถานการณ์ดังกล่าวจะทำให้บ้านเมืองเข้าสู่กลียุคอย่างแน่นอน จึงได้มาร่วมประชุมและกำหนดจุดยืนต่อสถานการณ์ดังต่อไปนี้

ประการแรก อดีตแกนนำพันธมิตรประชาชนเพื่อประชาธิปไตยได้ตัดสินใจมีมติฟื้นสภาพโครงสร้างการบริหารงานพันธมิตรประชาชนเพื่อประชาธิปไตยขึ้นมาอีกครั้งเหมือนดังเดิม เพื่อพร้อมดำเนินการต่อสู้กับพฤติการณ์ของรัฐบาลนายสมัครที่จะทำงานรับใช้ระบอบทักษิณในทุกรูปแบบ

ประการที่สอง พันธมิตรประชาชนเพื่อประชาธิปไตยเรียกร้องให้ คณะกรรมการการเลือกตั้งที่ไม่ได้อยู่ภายใต้ระบอบทักษิณ แสดงความกล้าหาญ ยุติต้นเหตุวิกฤติของชาติด้วยการสะสางลงโทษผู้กระทำความผิดกฎหมายเลือกตั้ง และดำเนินการเสนอศาลรัฐธรรมนูญเพื่อยุบพรรคการเมืองที่เป็นนอมินีให้กับพรรคการเมืองที่ถูกยุบด้วยคำวินิจฉัยของตุลาการรัฐธรรมนูญโดยเร็ว

ประการที่สาม พันธมิตรประชาชนเพื่อประชาธิปไตยเรียกร้องให้นายสมัคร สุนทรเวช แสดงความจงรักภักดีต่อชาติ ศาสนา และพระมหากษัตริย์ ด้วยการกระทำ อย่าให้คนไม่ดีมาปกครองบ้านเมือง ยุติบทบาทการกระทำอันเป็นหุ่นเชิดของ พ.ต.ท.ทักษิณ ชินวัตร และ ประพฤติปฏิบัติเป็นนายกรัฐมนตรีที่เสียสละเพื่อคน 63 ล้านคนอย่างแท้จริง

ประการที่สี่ พันธมิตรประชาชนเพื่อประชาธิปไตยเรียกร้องให้รัฐบาลนายสมัครทบทวนการโยกย้ายข้าราชการเพื่อแก้มลทินให้กับ พ.ต.ท.ทักษิณ ชินวัตรและครอบครัวในกระบวนการยุติธรรม ทั้งนี้ ให้ยุติความพยายามในการแทรกแซงคณะกรรมการตรวจสอบการกระทำที่ก่อให้เกิดความเสียหายแก่รัฐ สำนักงานอัยการสูงสุด สำนักงานป้องกันและปราบปรามการฟอกเงิน และกรมสอบสวนคดีพิเศษ รวมถึงการโยกย้ายตำรวจเพื่อช่วยเหลือคดีความใดๆ ในระบอบทักษิณ

ประการที่ห้า ที่ผ่านมา พันธมิตรประชาชนเพื่อประชาธิปไตย ไม่เคยคัดค้านการกลับเข้าประเทศของ พ.ต.ท.ทักษิณ ชินวัตร หากเข้ามาสู่กระบวนการยุติธรรมที่ไม่ถูกแทรกแซงและเป็นอิสระ แต่เมื่อระบอบทักษิณได้ใช้กระบวนการแทรกแซงและตัดตอนกระบวนการยุติธรรม พ.ต.ท.ทักษิณ ชินวัตร จึงยังคงเป็นปัญหาของแผ่นดินต่อไป พันธมิตรประชาชนเพื่อประชาธิปไตยจึงคัดค้านการกลับประเทศไทยของ พ.ต.ท.ทักษิณ ชินวัตร ในทุกรูปแบบ ตราบใดที่ยังมีความพยายามที่จะครอบงำและแทรกแซงกระบวนการยุติธรรม

ประการที่หก พันธมิตรประชาชนเพื่อประชาธิปไตยเรียกร้องให้รัฐบาลนายสมัครดำเนินการยุติความกำเริบเสิบสานในการลิดรอน ข่มขู่ คุกคามสิทธิเสรีภาพของสื่อสารมวลชน

ประการที่เจ็ด พันธมิตรประชาชนเพื่อประชาธิปไตยเรียกร้องให้พี่น้อง ข้าราชการ ทหาร ตำรวจ และประชาชน ที่รักชาติบ้านเมืองมาร่วมกันลุกขึ้นมาเกาะกลุ่มรวมตัวเพื่อเฝ้าระวังพฤติการณ์ของนักการเมืองและข้าราชการในระบอบทักษิณอย่างใกล้ชิด และจัดตั้งขยายงานเตรียมพร้อมกับการต่อสู้กับความเลวร้ายของระบอบทักษิณในทุกรูปแบบ อันรวมถึงการเตรียมความพร้อมเคลื่อนไหวในทุกรูปแบบ เพื่อสร้างสังคมธรรมาภิบาล โดยไม่หวั่นเกรงว่าอะไรจะเกิดขึ้น เมื่อถึงเวลาอันสมควร ซึ่งพันธมิตรประชาชนเพื่อประชาธิปไตยจะแจ้งให้ทราบโดยทั่วกันอีกครั้งหนึ่ง

ด้วยจิตคารวะ

พันธมิตรประชาชนเพื่อประชาธิปไตย


--- - ---- - ----- ---------
ป.ล.

1. กฏแห่งกรรมเป็น emergent property ของสังคมที่ไม่เลวเกินไป ไม่มีอะไรมาเสกให้ ดังนั้นสมาชิกของสังคมต้องทำงานหน่อย ไม่งั้นกฏแห่งกรรมจะไม่ทำงาน จะไปงมงายรอปาฏิหาริย์ หรือชาติหน้า มันเป็นการขี้เกียจและไม่รับผิดชอบ

2. ผมพบคนอายุมากกว่ามาบอกผมว่าอย่าไปสนใจการเมืองเลย เอาตัวให้รอดก่อนดีกว่า ให้คนรุ่นต่อไปไปทำกันก็แล้วกัน ในใจผมก็คิดว่า "ก็ xxx คิดซะอย่างนี้ ตูถึงอยู่ในสังคมห่วยๆ หน้าเงินไร้ศีลธรรมแบบนี้" แล้วผมก็คิดถึงลูกของผม ว่าเขาจะอยู่ในสังคมแบบไหน


3. ประเทศไทยนั้นจะเป็นประเทศที่เจ๋งมากเมื่อเทียบกับทั้งโลก เพียงถ้าเราสามารถทำให้คนมีอำนาจ เพลาๆในการทำชั่วและเอาเปรียบสังคมได้บ้าง ถ้ากฏหมายพึ่งได้ เราก็มีโอกาสพัฒนา ถ้ากฏหมายพึ่งไม่ได้แล้วสังคมเราจะเป็นสังคมอารยะได้อย่างไร

Sunday, February 24, 2008

Two Laws That More People Should Know About

I knew about them when I was in my early 20's and I wished I had known about them earlier.

The first is Zipf's law, which "...states that given some corpus of natural language utterances, the frequency of any word is inversely proportional to its rank in the frequency table. Thus the most frequent word will occur approximately twice as often as the second most frequent word, which occurs twice as often as the fourth most frequent word, etc."

It's a special case of the general power law distribution which many natural phenomena seem to exhibit.

The other law is Benford's law, which "...states that in lists of numbers from many real-life sources of data, the leading digit is 1 almost one third of the time, and larger numbers occur as the leading digit with less and less frequency as they grow in magnitude, to the point that 9 is the first digit less than one time in twenty. This is based on the observation that real-world measurements are generally distributed logarithmically, thus the logarithm of a set of real-world measurements is generally distributed uniformly."

Benford's law is applicable to "... a wide variety of figures, including electricity bills, street addresses, stock prices, population numbers, death rates, lengths of rivers, physical and mathematical constants, and processes described by power laws (which are very common in nature). "

Benford's law is also used successfully to detect accounting frauds, scientific frauds, electoral frauds, and other types of frauds. Just google for "fraud detection benford" and you will see a lot of examples.

Thursday, February 14, 2008

A Genius' Quotes

Richard Feynman is my scientific hero. I decided to get real science education after reading the first few chapters from these books by him. I found these quotes when I'm ordering another of his books:
--- - ---- - ----- ---------
Perhaps the best example of Feynman's self-understanding lies in his attitude toward money. After some happy years at Cornell, Feynman is lured to Caltech, where he is even happier. But one day the University of Chicago offers him "a tremendous amount of money, three or four times what I was making." He writes back:

"After reading the salary, I've decided that I must refuse. The reasons I have to refuse a salary like that is I would be able to do what I've always wanted to do -- get a wonderful mistress, put her up in an apartment, buy her nice things. . . . With the salary you have offered, I could actually do that, and I know what would happen to me. I'd worry about her, what she's doing; I'd get into arguments when I come home, and so on. All this bother would make me uncomfortable and unhappy. I wouldn't be able to do physics well, and it would be a big mess. What I've always wanted to do would be bad for me, so I've decided that I can't accept your offer."

More choice quotes:

"I learned from her [his mother] that the highest forms of understanding we can achieve are laughter and human compassion."

"That's the way the world was: You worked long hours and got nothing for it, every day."

"Have no respect whatsoever for authority; forget who said it and instead look at what he starts with, where he ends up, and ask yourself, 'Is it reasonable?' "

"Our responsibility is to do what we can, learn what we can, improve the solutions, and pass them on. It is our responsibility to leave the people of the future a free hand. . . . If we suppress all discussion, all criticism, proclaiming 'This is the answer, my friends; man is saved!' we will doom humanity for a long time to the chains of authority, confined to the limits of our present imagination. It has been done so many times before."

How Software Companies Die

Orson Scott Card, one of the great sci-fi writers, the author of Ender's Game and Speaker for the Dead, wrote a pithy essay about How Software Companies Die. It's funny (and sad), and true.

Wednesday, February 13, 2008

Two Things That Made My Day Today

First, Titus' map of our house:



Second, my students' comments from a class I taught at MUIC. And, no, I didn't bribe them :-) :





Friday, February 08, 2008

The Children Of Iraq

I found this collection of children pictures taken in Iraq. It's a reminder of how the record-breaking profits of oil companies are being achieved.

This war is based on a lie, but the suffering (and the profits) are real.

Thursday, February 07, 2008

Harddisk Crash In Tibet

This article describes how a harddisk might crash in high-altitude places, like Tibet.

I try to search for operating altitude for harddisks, and they all seem to be working up to about 3 km from the sea level due to the lower air pressure in high altitude.

I don't know why the computer loaned to the article's author worked though. May be its disk is one of the Endurstar harddisks that operate up to 5 km.

Sunday, February 03, 2008