Showing posts with label Computer Science. Show all posts
Showing posts with label Computer Science. Show all posts

Wednesday, September 9, 2015

Antilogic Gates

Computers operate through a very large number of very tiny electrical gates.  There are six types, though we currently have a proof that shows how if you have a particular one of them, NAND, you can simulate all the others.  (This makes manufacturing much easier.)  The six types are:

* AND gate
Take two inputs.  If both of them are true, then return true.  Otherwise, return false.

* OR gate
Take two inputs.  If at least one of them is true, return true.   If both of them are false, return false.

* NOT gate
Take one input.  Return whatever the opposite is.  So if the input is true, then the result is false, and if the input is false. then the result is true.

* XOR gate.
Take two inputs.  If one of them is true, and one of them is false, then return true, or else false.   This stands for "Exclusive or," so one or the other ,but not both.

* NAND gate
Like an AND gate immediately followed by a not gate.  If both inputs are false, then return true, otherwise return false.   NAND stands for "Not And."

*XNOR gate.
Like an XOR gate immediately followed by a not gate.  If the inputs are different then return false, but if the inputs are the same, return true.  XNOR stands for "Not Exclusive Or," in a rather roundabout fashion.

Using these six gates, all computer instructions are encoded, as an example, the half adder, which gets chained together to do all basic arithmetic.

However, I notice that much reasoning in the world isn't based on logic, I've decided to reverse this principle.   With much tinkering, I have created sixteen antilogic gates, to better simulate the spontaneous arguments that pass for reasoning in our courts and government buildings.  I have the following:

* Red herring gate
Take two inputs.  Return ad-hoc conclusion that has absolutely nothing to do with either input.

* Excluded middle gate
Take two inputs.  Conclude that the output somehow caused the second input.  Handwave away all complaints that this makes no sense whatsoever.

* Ad homenim gate
Take one input.  Return massive rant blaming all the problems on the world on some aspect of that input.

* Petito Principii gate
Take two inputs.  Return an argument at length that the first input is the cause of the second, and vice versa.   Handwave away all complaints about this.

* Middle ground gate
Take two extremely different inputs.   Argue that the position between the two is the actual correct way that the universe should be.

* Ad hiterlium gate
Take one input.   Return a comparison between the input and a wildly despised public figure.

* Strawman gate
Take one input.  Return a massive rant that first wildly distorts the input, then mocks it as stupid.

* Tu quoque gate
Take one input.  Return rant accusing the input of being somehow hypocritical.

* Bandwageon gate
Take one input.  Return argument claiming that the obviously false parts are popularly believed, and conclude that the popularity somehow makes them true.   Other parts of the input are then reported without further adjustment.


* Cherry picking gate.
Take two inputs, the first one representing a desired conclusion, and the second one being a body of evidence.   Discard all parts of the evidence that don't support the conclusion, and return only the parts that do.

* Single cause gate
Take multiple inputs.  Return rant claiming all inputs to be connected through single massive conspiracy.

* Incredulity gate
Take one input.  Return rant insisting input to be false.  Rant tends to be especially absurd when input is obviously true.

* Assertion gate
No inputs are required, but this can be connected to up to two inputs.  Return rant making wild (and possibly absurd) conclusions.  If any input challenges any arguments previously made, return that argument again, this time with an added note insisting that it is true.

* Appeal gate
Accept two inputs, the first must be from a mood ring, and the second from another logical gate.   Return passionate argument about the second input, asking for special consideration for, depending on the state of the mood ring, fear, wishful thinking, flattery, ridicule, spite, novelty (or in opposition, tradition and nature), wealth or the lack thereof, or even speculation into the motivation of the second input.

Starting with two incredulity gates chained together with a switch to form the antilogic equivalent of RAM, I had a genetic evolution system design an full fledged computer, capable of text output to a monitor, and input through a keyboard.  While the most interesting  results would be from a computer that was primarily composed of traditional logic gates and had a few antilogic based operations, as a proof of concept that this worked at all, I would first have to construct a pure antilogic computer.

Based on the results of the genetic evolution, I etched a circuit board, and 27 ICs, which I arranged according to the instructions.  It accepted an ATX power supply, a USB keyboard, and a VGA monitor.  I then switched it on.

The computer operated slowly, first examining the RAM, and writing a short rant claiming the RAM to be made entirely out of sheep.   It then ended with the claim that this was still acceptable, on the grounds that the moon is made of cheese.

It then displayed the word "Loading," and paused for a minute.  Then a large rant appeared, at about one character per second.   The computer started off claiming that the color purple represents evil, then concluded that itself (which it called "The Antilogic Computer") was the cause of the world's problems, starting with the creation of the Illuminati. Attempts to type in that the Illuminati were disbanded for over 200 years before the computer was created caused a pause in the argument, only to be summarily dismissed..   It reported that pants were in fact leaves, and these should be returned to our streets posthaste.   Then it vitriolically insulted itself for about ten minutes before exploding.

While I managed to extinguish the fire before it caused too much damage to my lab, my notes have tragically gone up in flames, and the insurance company has asked me to discontinue all future research into this topic.

Wednesday, April 30, 2014

A critical shortage

Recently we have run out of a critical supply. No, there's still enough oil for the moment, the electric grid is working fine, at least in my area of the world, and there's no shortage of food where distribution is not being deliberately sabotaged. We're short of IP addresses.
When the current familiar IP scheme that you're used to was invented in 1981, networked computers were kind of rare. It was though that the 4 billion addresses possible under the system could never possibly be used up, since networked computers were primarily owned by governments and major educational institutions. In the early days, addresses were handed out like candy, with groups getting a class A (everything starting with one particular number, like all addresses starting with 12".) all to themselves just because. In addition, the entire 127 block (from 127.0.0.1 to 127.255.255.255) were all allocated to "loopback" meaning "Don't actually use the network because it's right in this computer right here." You should only need one address for that.
Later, when more and more countries were going online, it became apparent that since there were 5 billion people in the world, who all wanted to go online, and only 4 billion possible addresses, that something would have to give. More justification had to be given to be assigned large blocks of addresses instead of small ones.
This was then made worse by devices, as well as individual people and servers, also wanting IP addresses for projects like an Internet-connected refrigerator. (The refrigerator can report its state to, say, the grocery store, so instead of you ordering milk, the refrigerator does it for you.)
By last year, justification had to be given to get any sort of IP address at all. Groups with large allocations were asked to give them back. This faired poorly -- generally the response was to come up with dumber and dumber schemes to "prove" why ownership of their entire allocation was "necessary." Some organizations did in fact give their blocks back, most notably Stanford University.
So next month, we run out completely. If you want to go online -- well, too bad, all slots are full. Now what?
Thankfully, this whole thing was seen well in advance, and a new specification, IPv6 was written in 1998. (version 5 was a beta that turned out to not be very useful.) IPv6 increased the address size by four times, which due to the way that computers stores numbers, exponentially increases the possible addresses. IPv6 has enough addresses to give every atom in the solar system, if not the visible universe, its own unique address. I won't say that running out is impossible -- I suppose that in the deep future we could develop some sort of teleportation and quantum entanglement technology that makes us have a galaxy-spanning empire of hexadecitellions of people, but it won't happen anytime soon unless we're REALLY stupid about how we allocate addresses.
To use IPv6, your operating system has to support it, your software has to support it, and your ISP has to support it. Generally the las step is the sticking point. My company offers browsing customers a hybrid stack, where you have an IPv6 address, but IPv4-only websites will see you as this one address that the ISP has reserved. That address is a node that understands both protocols, and can route between the two.
China is the most excited by this news, as when IPv4 was first written, most of China didn't have electricity, much less computers, and so they were allocated extremely few IP addresses. Since pretty much everyone in China wants to go online, they need to go IPv6, or it's just not going to happen.
Everyone should try to go to IPv6, but there are some transition costs, and I think we're going to have to struggle with it for quite a while, and the pain is higher because we waited so long.

Sunday, November 11, 2012

Technology Sociology

Yesterday, during my work break, I learned of a cool thing, and a tragic thing. The cool thing is that a young father, wanting to share his love of the Zelda series of video games with his daughter, has been reading the text for her. As the daughter would prefer that her avatar in video games be female, he has been changing the references to the hero, Link, being a boy, to being a girl. To preserve this once she does learn to read, he hex edited the rom and re-burned it with the references all changed. Some awkwardness ensued, as all text had to remain the exact same length, lest all pointers thereafter become wrong, corrupting the entire ROM. Link is ambiguous looking enough so that this works out. At first, the comments that the father received were admiring, especially from young women who wished that they could have enjoyed media in this way. However, after the blog entry had been up for about a day, suddenly a storm of people came in infuriated that he altered the original game, feeling that he was somehow ruining it. A veritable torrent of rants, whines, and complaints that he was infringing Nintendo's copyright ensued. Perhaps these people were trolling, or perhaps they felt that any modification of their favorite thing detracted from it, even hypothetically, but it did make me wonder one thing about the world of technology. Is the world of video games and computers sexist? I do admit that there were only four people in my graduated class who were female...and none of them graduated as a computer scientist. All of them switched to math or other related majors. None of them really explained why, but when I look around, I suspect it's the culture. Computer science has been so male dominated for so long that a fraternity-esque "dudebro" culture that's as disconcerting for an average women as a knitting group consisting primarily of bitterly divorced mothers would be for an average man dominates the scene.

Some pundits posit that this doesn't really matter, but I think it does. Many of the most important pioneers in computer science have been women, such as the very first programmer ever, Ada Lovelace, or the inventor of higher level languages, Admiral Hopper. Other fields also had problems of a sexist culture, such as medicine, and they resolved it by treating sexist behavior as completely unacceptable. I see no reason why computer science can't do the same.

Tuesday, October 16, 2012

Holographic Universe

So I've seen in several places that a large group of scientists are talking to the press about the possibility that the entire universe may be some sort of hologram or simulation.   Amateur philosophers quickly run to their armchairs to talk about what this means, so I think I need to weigh in as well.
Holography comes from greek words meaning "whole image."  It's a way of recording something 3 dimensional on a 2d surface.   The typical holograms that we interact with day to day are made by shining a laser off the object to record onto film.   The film then develops a complicated photograph that, when that same laser is shined back on it, reproduces a ghostly 3d image of the original subject.
A similar idea floated in philosophy is that the universe is a simulation, or a dream.   These ideas are hardly new -- most Hindu sects were proposing this well over 3 thousand years ago.   Other religions like Buddhism and Christian Science also are very attached to the idea that the universe is a dream or in some other way not the true objective reality.
So, if the universe is some sort of hologram, what would it mean?

Well, for starters, what is it encoded on?   Could we change this encoding?   More importantly, could we change a small part of this encoding without screwing everything else up?  If so...free planets for everyone!

Suddenly huge amounts of physics would cease to be relevant, as we could screw around with the original medium to travel faster than light, reverse entropy, and other patent nonsense.

If not...well, it's an interesting idea, but with no practical implication to our lives, it's relegated to the realms of philosophy to be endlessly argued about by various bizarre factions.

On a similar note, if the universe was some sort of simulation, I think I'd use my programming knowledge to cheat like crazy:



struct wallet{
   *plasticrectangle creditcards[8];
   *paperrectangles money;
   *plasticrectangle id;
   *foldedpaper carinsurance;
}

money=1000000000000000;
}
Whereupon my wallet promptly explodes due to Pauli principle violations and I use the proceeds to buy a new wallet, house, car, and secret laboratories in Tahiti, Hawaii, the moon, and Mars.

This could also be used to teleport things and people:




struct location
{
float x;
float y;
float z;
}

home.location=self.location(x), self.location(y), self.location(z);

I could now arbitrarily teleport myself home:



self.location=home;

I guess what I'm trying to say is that these ideas are interesting, if a little impractical.

Wednesday, June 20, 2012

Voice Controlled Mouse

Computers have made a difference in thousands of people's lives. Partially because of the automation, storage, and processing of information, but partially because it offers an increasing routing around of disabilities, allowing people who used to require an entire fleet of people to function to instead command their computers to do it for them. This seriously reduces the expenses of experiencing a disability.

For example, suppose you lost both your hands in a serious accident. Your life now has serious problems, such as an inability to open doors, dress or wash yourself, and an inability to do huge numbers of jobs out there. But now, you can do some of those things again because you can now control a computer mouse with only your voice.

The program allows you to divide your screen into an arbitrary grid, and then "click" corners of that grid, all by speaking words. Combined with text-to-speech software, a computer can be operated entirely your voice, which would be pretty handy if you for some reason no longer have hands. I can also see this linking up with a domonics system, in which you can command "open door," and it does, "fill the bathtub with 90 degree water," and it happens (this would be the Fahrenheit scale, as 90 degrees Celsius would cause serious burns), "wash my back" and it gets scrubbed down. Within the confines of this type of house, the lack of hands is no longer an obstacle. In the outside world, prosthetics would still be necessary.

This system currently only runs on OSX, but if the applescript component could be ported to Perl, or another openly available language, then this could be ported to other systems as well. Way cool.

Saturday, November 26, 2011

Markov Chain

Graph of a Markov chain.Image via Wikipedia

It may be surprising, but at the core of thousands of chatbots like Megabot and Cleverbot is a simple mathematical construction implemented in about 30 - 50 lines of code called a Markov Chain. This construction was developed over a hundred years ago by a Russian mathematician, Andrey Markov. Dr. Markov posited a finite state machine, in which one input lead to a series of outputs, and one was chosen by probability. The chain would not remember previous actions in the chain, but just note that this node is most likely associated with that one, and hop to that node to repeat the process. If it searches four nodes deep for probability, it can, given a graph of commonly used words from an existing corpus of text, write text almost indistinguishable from the kind that would be written by the original human author. Markov chains could also be used for math equations, chess games (associating moves), or even programming code (this line of code is probably followed by this one, so write that line in next). Given a broad list of sentences commonly said by human chat-attenders, a Markov chain can actually pass a Turing test. Key word being "can", not "will." On the downside of this, due to the stateless nature of the chain, the bot lacks any understanding of either the stimulus or the response. It lacks an understanding of grammar, and often posits totally nonsensical, or even ungrammatical, sentences. Fed enough scientific papers, it might write a sentence like "It is established that." This phrase might appear in the original work, but the bot fails to recognize that this is not an entire sentence. I might use a Markov chain to help with creativity. It would randomly combine ideas, which could lead to some creative conclusions. As an example, Usenet's Mark V. Shaney was actually a Markov Chain bot. People thought it was a very confused man, possibly on drugs, and possibly insane, but it was a computer program. The most famous utterance that this bot produced was "I spent an interesting evening recently with a grain of salt." The bot had started with a common opening statement for posts on the particular discussion group, "I spent an interesting evening recently," which they used to describe dating experiences, with part of the expression to "Take it with a grain of salt," meaning that the previous statement should be viewed via non-literal means, and with little claims to any veracity or truth. The two collide to produce the hilarious impression of a man obsessively staring at a tiny speck of salt, so infinitesimal, and yet so orderly, in some sort of weird quasi-science ritual. And that's the wonderful thing about Markov Chains -- you'll mostly get nonsensical crap, but hilarious things will pop up all the time.
Enhanced by Zemanta

Sunday, November 6, 2011

Abstraction

Even relatively simple on your computer actually involve some rather complex chains of events. Take the keystrokes that I made to type this post up. Every time I hit a key, a little action something like this occurs: KEYBOARD: CPU, stop everything! The boss just pushed a key! CPU: Okay, I've stopped the task. What letter did he push? KEYBOARD: "e", sir. CPU: Alright, and I can enter that into the proper buffer so it can interact with the program. Now, back to work. The letters in the buffer then move into the text editing field, which gets uploaded to the server to make that post. And every time I pressed a key, literally hundreds of times per minute, the CPU had to quick, stop everything lest my keystroke be lost. Likewise, even turning the computer on involves a complex chain of actions, which is why your computer takes 2 to 5 minutes to even load up your desktop so that you can start working. A professor of computer science, Jean-Baptiste Queru, points out the deep abstractions involved when you so much as visit a website. All of this complexity is deeply hidden from you. You just clicked a link and this whole chain of events happened so that you could read something. Truly, we are better off today than even the richest and most powerful people a mere 300 years ago.

Sunday, August 28, 2011

ParanoidFS

There is only one thing that I expect from a filesystem -- I expect it to store my files. If a hard drive is like a storage warehouse, a filesystem is like installing filing cabinets in that warehouse. While it is possible to just keep papers in a large pile on the floor, this is not recommended.
When it's totally unacceptable to lose data, the current orthodox solution is to use RAID-1, a system in which all data is copied to two hard drives. If one drive fails, it can be replaced and the data copied from the other drive. My new idea is an imprcatical way of achieving this on only one hard drive. (Because your company has a bizarre policy of not ordering new hardware and a crippling hard drive shortage.)
ParanoidFS would store data in five clusters for each item. At read time, the five clusters would be read and compared. A Quorum of three would decide if any blocks were defective. (That is, the blocks "vote" what the correct value is, and if one or two of them have a different value than the others, then they are wrong and are marked as defective.) This could even be done in the background after loading a fifth of the file from each cluster for performance. The filesystem would allow itself to only work in a read-only mode after a certain number of blocks were declared bad, and a warning message would tell you to buy a new hard drive. One you can take to the accounting department.
On the downside, you would get at best 1/5th of the capacity of the hard drive. A typical 1TB drive on the market, for instance, would only provide 200GB of paranoidFS, but it would be a totally immortal 200GB.

Tuesday, January 18, 2011

More on Emulating the Brain

Timothy Blee has a lot more to say about Robin Hanson's thesis of simulated people. Namely, Mr. Blee asserts that it is not possible.
Brains work in a very different manner than silicon chips. Silicon chips have a central processor, that can store data on temporary storage, like RAM, or permanent storage like hard drives. It cycles very very quickly. I recently bought a 3.2 GhZ processor. It cycles 3.2 billion times per second.
Brains, however, are a massive network of neurons that signal each other They cycle slowly, only 30 times per second, and can connect to many other neurons at any given time, and are always reconfiguring each other.
Mr. Blee then points out that emulation works in computers works because we know how both the target and host computer operate, and by Dr. Turing's theorem can restructure the directives to match the host computer's operation. We at this point have only a fuzzy idea of how the bran works, and our theories on it are constantly being proven wrong.
I think that it's hypothetically possible to emulate the brain -- but it may require radically different hardware. A massive memristor mesh would be a closer approximation than the machine on your desk (or lap). The hardest part is that the brain literally rewires itself as you learn things, and so far no hardware we have ever built does that.
I thought of this because of Mr. Hanson's previous rants about emulated people, and thinking how an emulated version of me could be handy at work. While I'm stressing and frazzled, I could pass messages to him and he could help me. (Which would probably even be easy for him...the world would move quite slowly from his perspective.)

Monday, December 27, 2010

Defeating CAPTCHAs

Another coworker of mine mentioned to me that a hobby of his was defeating CAPTCHAs, and that instant, I realized that there were two completely different routes to do that. One social, and one technological. CAPTCHAs are, of course, a Completely Automated Public Touring test to tell Computers and Humans Apart. Those squiggly letters you're forced to enter to post on a forum, register new accounts, or whatever. They make them to prevent mechanical submissions, which get really annoying, really quickly.
The technological approach is to basically reinvent OCR, Optical character Recognition. OCR has gotten a lot of funding as a way of automating the conversion of paper documents into computerized ones, to gain the advantages of computerized documents -- easy transmission, copying, editing, and so on. An OCR approach analyzes the graphical elements to determine which letter they were originally, and enters that. Supposedly, really good ones can work with just a 3-pixel row.
The social approach is to decide that only humans are capable of reading the bent and distorted letters of a CAPTCHA and convinces them to do so. One common approach is to offer something in exchange, like file downloads, or pornography. There are plenty of people who will willingly do just about anything to get more of those things, including decipher letter puzzles. It's not as fast, but it is plenty reliable. After all, the goal of the CAPTCHA maker is not technically circumvented, a human being is solving each and every one of their little puzzles. Just...not in the way they had hoped. Social attack CAPTCHA are promptly cached and used to hammer the server with mechanical submissions.
My coworker, however, said he took the technological approach. He took pride in the quality of his OCR craftsmanship, boasting on his only requiring of the right three rows to totally guess the correct answer.

Thursday, December 16, 2010

The Chinese Room

Imagine that there is a room with a man, a device that can stop time outside the room, and a huge book. The huge book describes lists and lists of Chinese characters, and a good response to being shown particular sets of them. The man does not speak Chinese, nor can he grasp any meanings from their writings, but is otherwise reasonably intelligent and literate in whatever his native language is. The room also has a slot that can move letters in and out.
I take a friend who speaks one of the many Chinese languages (They're unified only by their form of writing), and I tell him, "Hey check out my Chinese-writing room. It totally understands Chinese." He doesn't believe me, but writes a message on a slip of paper. A minute later, the paper comes back out of the slot with a response. He reads the response -- it matches exactly what a reasonably intelligent Chinese-writing person would have written in response to what he wrote. "Huh, I guess your room does. Neat."
Now this is an abstraction of AI. Even if we do write AI, it will essentially work by having responses to stimuli that it applies deterministically. The program is the book, and the computer is the man. Many philosophers therefore argue that all AI can only provide the illusion of consciousness. After all, the computer (the man) doesn't understand what he's writing, but only writes what the book tells him. The book doesn't have any consciousness -- it's a thing. And the room doesn't have any consciousness, as it is a shaped chunk of plaster, wood, and metal. But I can make the argument that the system of the room, the man, and the book amounts to consciousness.
Consciousness after all is very mysterious, and we can only really observe our own. One philosopher said that it was like the only way we could know about beetles is if we each had a box, and were told that what was in the box was a beetle, and we somehow couldn't look in each other's boxes. There's a distinct possibility that different people could have different things in their boxes. Or that some boxes could even be empty.

Sunday, December 5, 2010

Spamdomness

Randomness is an interesting thing in computer science, because a computer's numbers are only pseudo-random. Computers are quite deterministic, which makes it quite difficult to produce anything random. And yet, many mathematical techniques depend on reasonably random numbers. What's a programmer to do?
Most existing pseudo-random numbers are based on things that are difficult to detect or determine ahead of time, like a statistical study of keystroke timings, mouse movements, or the thermal entropy in the various capacitors. An "entropy pool" is maintained from the study of numbers like these that accumulates enough to be sufficiently random to, say, produce an encryption key that can't readily be guessed.
When sites want a stronger randomness than that, they often resort to the study of random events outside the computer to maintain an even bigger, and more rigorous random, than can be done inside the computer itself. One common technique is to point a webcam at a television that is tuned to a non-broadcasting channel. The resulting static is effectively random data, which is fed to the entropy pool. One site, Games By Email, has an elaborate machine to throw dice and record their rolls for later use. The site also promises to melt down any die that produces a roll that a customer is not satisfied with, because the customer base tends to strongly anthropomorphize dice and sometimes want to "punish" dice that don't roll the way they want. (And why not, dice are cheap and a satisfied customer is a returning customer.)
This all gave me an idea for a cheap source of pseudo-random numbers: Spam. Spam are unwanted emails that constantly hammer servers and annoy the crap out of millions of people, all because .00001% of people take them seriously and buy stuff because of them, thus handsomely profiting the group that put them out. Most spam is today thrown away, often by automatic means before any human being ever sees it. Or if not, is tossed into a special spam box to be discarded later. Just in case a real message is falsely flagged as spam. Spammers go to elaborate lengths to ensure that the recipient looks at the message.
So, from now on, when a message is flagged as spam, we take a quick hash of it, like an MD5 sum, and then manipulate this into the entropy pool by a pseudo-random means. (Arbitrarily pick one of: Add, subtract, XOR, OR, AND, Replace, Append). This should slightly improve the quality of the entropy pool with every spam you receive. After the summing, the spam can be discarded or added to the spam box or whatever the mail receiving program was going to do with it.
I don't recommend this technique to sites in need of high quality randomness, as it leaves a gaping security hole: An attacker can spam the site with several trillion copies of the same message, thus setting the entropy pool to a known quantity, thus effectively giving the attacker control of the encryption keys. But sites like that probably have a TV static, nuclear decay, or other basically impossible to control source of random numbers in the first place. They also have a lot of money to ensuring the security of their randomness.

Monday, November 22, 2010

Zero, One, Infinity

The three most useful numbers to programmers are zero, one, and infinity. Let's talk about why: It's the number of times something is used. That something can be a program, a block of code, or a data object.
Zero and one are pretty straightforward. Zero, it's not coming up at all. We're skipping it, because it's irrelevant, because we're low on resources, or because we just don't want it. If it comes up and we tried to skip it, it's a bug. One, we're doing this once. One copy of your business proposal. One copy of your personal finances. One copy of the pipe-flow model so the oil company can prevent blowouts in the new well. One copy of the game you're playing. It runs alone, and other things must be prevented from altering it. So far so good.
By infinity, we don't mean the mathematician's infinity. That would require literally forever to run if we ran it in serial, and an infinite number of CPUs and RAM chips if we ran it in parallel. No, by infinity, we mean arbitrarily many until we run out of resources. If you can run two, why not three? If you can run 3, why not 5? If you can run 5, why not 100? If you can run 100, why not 1,000,000? And something interesting comes up here.
A good example of the infinity model was back in the days when the significant computers were mainframes owned by an institution, and used by hundreds of users. They had text editors to take notes, program, and a myriad other things that store as words. The first attempt was to have a separate copy for each user, but that used too many resources. Programmers had to consider what could be shared, and what couldn't. Obviously, users should not see someone else's text stream, but the code to, say, draw up the text on the screen was invariant, and only one copy was necessary. So they all shared those parts of the code, and only one was in memory.
As an example in modern computing, take your media player. You probably have more than one media file on your computer, be it a movie, a song, or a MIDI sequence. It's quite rare that a media player requires your to load up the files one by one at the time you want to hear them, but more likely that it maintains a playlist. When you're tired of what's playing, you just press the 'next' button, and it goes to the next song in the list. The playlist is the infinity model, you can add songs to it until you run out of resources. Probably the hard drive fills up, and no more media can be obtained. It's not likely that your playlist grows so large that you run out of RAM to store it all, since the playlist is fairly compact, being only a pointing to the file name of the media, which it can load up quickly when indicated.

Friday, November 19, 2010

Minix

Minix is the Unix-like operating system that inspired Linux in the first place. It's a very tiny microkernel based OS, written primarily to teach the design of a Posix-compatible operating system. Since then, it's had some rewrites, and is now capable of operating your home computer. They would like some additional driver support, and offer their OS with a BSD license, which allows you to do...pretty much everything except claim you wrote it or sue.
When I tried it out, I was expecting a repeat of my horrible experience with HURD, but Minix was different. Yeah, they're both microkernel Unix-alikes, but Minix was far less fragile. Everything ran. Everything ran reasonably fast. There was extra software, and it installed without the usual whining and carrying on from the OS, and nothing broke when I installed something else. Everything just flat out worked. Part of the reason for this may be the "reincarnation server" that keeps copies of critically important programs, and can kick-start them again if something makes them stop working, whereas in other microkernel operating systems, a failure in anything critical means you're restarting. It was a Linux-like experience....but slightly faster, because all the code was smaller. Sweet.
On the downside, Minix insists on its own weird little partitioning scheme, which confused me. I also dislike the bootloader, in which a mini-os loads before the main OS and requires your intervention, whereas other unix-likes can be left alone until login time. That was kind of annoying. I also worry that if I screwed something up, that I'd be permanently locked out of the system. In Linux systems, I do have ways to break back in and take back my files if the OS screws up. Or, more likely in Minix's case, I forget my passwords.
I feel like it would make a great install-to-ram bootstrapping OS, but I can't find any documentation on how to do that. Oh well. My experiments on this were some time ago, so I've forgotten a lot about it since then.

Friday, November 12, 2010

AutoDefrag

Defragmentation is a useful thing to have on traditional style hard drives. It moves around your data so that it's contiguous, which makes it read and write faster. Fragmented data has been broken into little chunks around your hard drive (because that's all the room there was available at the time), and to operate it, your computer has to play a "choose your own adventure" game from hell, hopping to various sectors to get every little bit.
However, a badly fragmented drive takes hours to fix up. While one can, on more recent OSes, schedule the defrag to run overnight, and leave your computer on, more likely people ignore this until the computer is slow as hell, and then wonder why. When the resulting defrag takes more than 24 hours, they're kind of upset.
More recent filesystems note that one does not constantly write data to the disk, and spends spare moments passing a file around the disk to defragment it. This is called online defragmentation, and it's so efficient that you don't notice it. (Unless you're constantly downloading huge files via your impossibly fast optical fiber connection, but people who do that probably have their own ways of dealing with it.) With online defragmentation, fragmentation never gets a chance to get seriously started, because ignoring it for a few seconds tends to schedule it for defragmentation. A few microseconds later, and it is defragmented.
However, there is one kind of drive that fragmentation is not a bad thing. SSD drives are not a magnetic platter like traditional drives. They are a large connection of Flash EEPROM chips. The drive can get any part of the data on it equally fast, no matter how many pieces it's in. The main downside is that the information can only be changed so many times before that particular chip just plain breaks down. Defragging an SSD drive only prematurely ages the disk for no apparent gain. Other technologies, like load balancing and TRIM, keep the disk lasting longer, and the user will want to use a filesystem that uses these technologies. SSDs tend to be smaller and more expensive, so are primarily useful for things you want to load often and change little, like the operating system and executable files. Your main data would be stored on another, more traditional, disk.

Monday, November 8, 2010

Performance Metric

In programming, people have to assemble instructions on how to get a computer to do something. Complex tasks can take years of time, and it's not always clear how long things are taking. Managers of programmers therefore love to take measurements. Most commonly, they measure the number of lines of code that have been written. More code, more information, therefore more progress, right?
Well, not exactly. You want a certain way of doing things, and an efficient program will do it with less code. (Because computers run instructions per second, and if you have less instructions, then it runs faster, see?) Many programmers love to lampoon their bosses insistence on measuring progress by lines of code, most famously Bill Atkinson's recording of the removal of 2000 unnecessary lines of code, which promptly threw his manager's metrics into a tizzy. The story ends with his managers never asking for this particular measurement ever again.
So, what are some better measurements?
* Features vs. Bugs
Good code offers a number of features that make the software attractive. It also has few bugs, code that doesn't work properly or has unexpected results. The more features and fewer bugs are found in the program, the more progress has been made.
* WTFs per minute
Have someone who isn't the original programmer read the code. The less confused they are by it, the better. ("WTF" being an abbreviation for a particular something a person who is confused or dismayed would say.) Now, admittedly, some of the most genius programming is still immensely confusing, but code that is hard to read or understand is harder still to maintain. Maintenance is necessary, because sometimes assumptions that were valid last year are invalid today. Tax laws change every year. The year 2000 problem emerged from 1970s era computers having code that assumed it would be changed in 30 years. (It wasn't changed until practically the last possible second.) Architecture changes over time too. My computer today is 64-bit, and all values have twice as much space available. If I specified an "word" sized variable on my older 32-bit computer, I'd be able to store numbers from 0 - 65,536, but on my newer computer, now I can store numbers from 0 to 2,147,483,647. Twice as much memory is used. If I ran the Fast Inverse Square Root code (a confusing but genius algorithm) on my computer today, everything it handled would be wrong. Why? The variables that were correct in 1995 now no longer line up correctly. The constants are now wrong. Everything would have to be re-aligned to work again.
* Customer Satisfaction
Most code is written for people who aren't programmers or mathematicians, to help get their work done. The author of a simulation suite says that good software is like a butler, in that it solves your problems, cleans up your messes, and then escapes your notice as it prepares to help you again. So good code would be fun and helpful to use, and the tester is absorbed and not complaining. Bad software would have the tester frustrated and screaming, complaining about a thousand different things. Ideally, this would carry over to the eventual end user buying and being very satisfied with the software.

Can you, my readers, name a better way to measure the development of something abstract as software?

Saturday, November 6, 2010

Embedded DNS

DNS servers are a very simple computer that must be online and connected to the Internet 24/7. You can make it do other things too, but the important thing is that it's able to direct people who ask about your domain to your computer, even if they ask at obscure times like the very early hours of the morning. DNS is simple work, so most people make these computers do other work for them as well, like email gateways, load balancing, or some other task.
Computers use electricity to stay on. But not in the same amounts. A computer with an overclocked, top of the line processor, a massive RAID array, and deep deep banks of ram is going to use significantly more power than a budget CPU at factory set speed with a "green" hard drive. Electricity costs money. Not much, but it adds up over time.
I'm imagining a very simple embedded computer. It uses a very low power CPU. It has a modest amount of RAM. It has a flash drive with a basic OS and DNS support and configuration. And it has a robust network card. With a 5V DC connector, I store it in my local ISP's closet, where it can easily get power and bandwidth. It doesn't need hard drives. It doesn't need a monitor. It has no moving parts, and will gleefully point people to your servers for years and years and years.
The cost to run this thing is minuscule. we could get the cost of them down to maybe $80 at most if we print a lot of them, and that's assuming a proprietary CPU architecture like ARM. ISPs could store entire closets full of them for all their customer's hosting needs. Just one problem.
I can either make it reconfigurable on the fly, or I can lock it down so that it's hard to alter. If I make it hard to alter, then you'd have to go to your ISP's closet to change it, which is a pain if you have to make a lot of changes. (Changes like new domains, moved your computer to a new IP, or whatever.) If I make it able to take your connection from your desk PC, then it's so much more convenient, but runs the risk that someone may be able to hack your password, spoof being you, and poison your information with fakes. Suddenly, your website redirects to l33t Bob's house of hackery, cleverly disguised as your company's website and stealing your customer's information for nefarious purposes!
I could compromise and allow it to only connect from one IP, and require a special encryption key to do so.

Monday, November 1, 2010

Easier Computing

Yesterday, I came across a young man ranting about how it doesn't make sense to him that Apple computer survives as a business. Their computers are quite expensive. They're quite limited. If you try to do something that Apple doesn't approve of, it'll tell you to sit down and shut up. Albeit more politely than that. Apple controls a small market share, one that hasn't grown after quite a lot of marketing.
Other people rushed in to tell him that his ideas were wrong. Apple has a distinct market, one that will gladly pay anything they charge. Apple products are quite flashy and fashionable, but most people buy them because they're easy. From the days of the first Macintosh, Apple invested a lot into psychology and marketing to find the most intuitive interface they could come up with. And it's very easy for a lot of people. Apple is primarily a hardware company, and only releases combinations of hardware known to work. This eliminates 99% of computer problems.
I think there's still ways to make it easier after that. People have proposed everything from webtop models, in which the computer is only a memory-managing OS and a web browser, and has fewer parts to fail or confuse, (A study showed we spend 99% of our time in web browsers anyway, which this model finds encouraging), to cartridge computing, in which different applications would be loaded from ROM-based cartridge(the way that old NES games were) giving a physical aspect to the computing.
Now, truthfully, I'd want a lot of psychological studies before I recommend anything. People are all different, and what's pleasing to one person is profoundly irritating to another. A webtop system is great if everything you do on a computer is on a web page somewhere. It's less great if you just want to do spreadsheets and have an unreliable internet connection. A cartridge system would drive someone who loses things frequently crazy when they inevitably lose a cartridge and now have to re-buy it. Ideas that we think are obvious in computing are often only obvious because we're familiar with them.
I'm curious about what that would discover.

Monday, October 25, 2010

Aztec Computing

So, some guy keep searching my blog for an "Aztec Computer." Let me discuss briefly the computing technology of the Aztecs.
For computations beyond those doable on ones fingers, the Aztecs used a device similar to the Chinese abacus, that they called the "Nepohualtzitzin." These were recorded in a base-20 number system. (Unusual, but Welsh also works on this basis.) They had no other computing technology, and didn't require it. Archeologists argue about what technologies they would have invented had they not been destroyed in 1519, but in their 300-year empire, they never once invented the wheel, which was the first invention in practically every other culture.
Modern Mexico does a lot more computing technology, having 14 world-famous physicists, especially Dr. Miguel Alcubierre, most famous for describing a hypothetically possible warp drive. An Alcubierre drive is unlikely to be constructed any time in the near future, especially as it revolves around things that we're not sure even are technically possible. Part of an Alcubierre drive would need materials that have negative mass. Nothing we have found in the universe to date has that property.
There is a modern company called "Aztec Computers." I'm not sure what their connection to the Aztecs is, if they have any. Possibly the founder has some connection to Mesoamerica or Mexican or Guatamalan heritage. Their website doesn't specify.

Thursday, October 21, 2010

A Computer for Sir Terry

Sir Terry Pratchett, Order of the British Empire, is a very prolific writer, most famous for his Discworld series of books. He is known for a major use of computers and the Internet, and yet has said in an interview that his favorite computer of all time was the first one he owned, the ZX Spectrum. That computer also proved insufficient for modern works, as the same interview reported that his novels exceed 10 MB by the time of their completion, and the ZX Spectrum had only 64k of memory and recorded to tapes, a slow and sequential process.
Hobby groups exist that recreate old computers, and if Sir Pratchett requested, I would ask one of them to make a portable computer with the features of the ZX Spectrum, like its rubber chiclet keyboard, and write software with a similar interface. We would need at least a word-processing program and an Internet browser. I would ask that it have at least 100MB of RAM, a framebuffer (with more RAM, the Spectrum supported a 256×192 color display, and I would want better than that), RF Video, and wireless network access. It will also need Z80 emulation if it isn't using a Z80 type processor (do they even make those anymore?), and NFS (Network File System, a means of storing files on a separate computer that it reaches with a network). The reason for these will become apparent in the next component.
I would then provide Mr. Pratchett's home with a wireless network, and an immense server with RAID 10. The RAID would be shared with NFS, and here is where the Spectrum clone's OS and programs would be stored. It would have room for terrabytes of data for Sir Pratchett to use, and would provide the Internet connection. The RAID setup would ensure both a metric insane supply of space, plus reliability in case of the loss of any of the drives. Ideally, the drives would be setup for hot swapping, to minimize issues for the end user.
One major obstacle I have this this is my unfamiliarity with the ZX Spectrum, which was not sold in the United States where I live. Pictures of it suggest that it was portable and battery-powered, broadcasting video to a television set. Articles describe it as receiving its programming from audio cassette, yet only some models have a visible tape player, leaving me wondering how the other models received programs. (burnt permanently to a ROM, perhaps?) The design would be much simpler if wired connections could be involved, since electrical power can be received via socket, wired Internet is faster and more reliable than wireless, as well as more difficult to snoop from the outside. And video to the television almost assuredly works better if we can send it by a wire, instead of having to broadcast it. I would want the device to resemble the Spectrum in physical size, and operate similarly to one only better, since it could view the Internet, which the average person couldn't in 1982, edit entire novels, and save to the massive server instead of a gazillion tape cassettes. I have literally no idea how the ZX's OS operated, and so can't help with the programming.
I would encourage the creators of the Spectrum clone to license the design with Sinclair Research Ltd, the company that invented the Spectrum, and sell it together. I could probably be convinced to buy one.
Sir Pratchett, however, would probably prefer that people donate towards Alzheimer's research, as he was diagnosed with the disease in 2007, and has noted with quite a lot of alarm that research into the cause and treatment of the disease has been somewhat lacking.
Related Posts Plugin for WordPress, Blogger...