Home | Join! | Help | Browse | Forums | NuWorld | NWF | PoPo   
Thought of the Day
Clapping Words
vice
epicure
obstreperous
torpid
matriculate
crescendo
anesthesiologist
enigmatic
repertoire


thecav
Age. 38
Gender. Male
Ethnicity. White
Location Prince George, VA
School. Univ of Virginia
» More info.
Double Your Pleasure, Double Your Fun
Thursday. 8.4.05 9:09 am
Two processors. I mean if one CPU can technologically advance civilization this far, then one more would double everything!! Hell, why stop at just two?! Three, four, seven, just pile them on!!! It'll work... right? No, not really, no.

Oh, it'll work, but if you put a second processor in your system right now your system would not run twice as fast. Sure it'd run faster, but not double the speed. Adding a third will make it run faster than two, but not the same increase in speed as from one to two. Add a forth and the trend continues. Diminishing returns as you add more and more. Why is this?

It has to do with the way computers are structured. Here's any course you may take in computer architecture condensed into a single paragraph.

A computer consists of a CPU (the brains) which isn't really a fair name because the CPU is dumb, I mean a complete idiot. It has to be told to do *everything*. And not vague, add two numbers togethers, instructions. I mean down right anally specific instructions, it wants to know what numbers? Where are they? Integer or floting point addition? Where do you want the answer to go? What if there's an error? When I'm done adding, then what do I do? (The CPU is very inquisitive.) The CPU gets fed these instructions from main memory which in turn get them from a physical storage medium: hard drive, CD, network, etc. The CPU executes the instruction, changes memory, and moves on to the next. Instructions always operate on bits and these instructions include, AND, OR, NOT, NAND, NOR, XOR, and XNOR. All other instructions are just combinations of these operations. However, only NAND and NOT are used extensively in practice.

That's all a computer does. All. Nothing else. It just so happens that performing certain operations in certain order produce useful and meaningful results.

I don't know if you can see the impending problem from adding two CPU's from the above description of computer operation. But it stems from the fact that both operate simultaneously and without knowledge of the other's operations.
Say there's CPU A and CPU B.

A writes a 3 to memory location 100.
A reads memory location 100 expecting a 3, and gets a 3.
A is happy.

This is how things should work. Now let's add CPU B into the mix.

A writes a 3 to memory location 100.
B writes a 5 to memory location 100.
A reads memory location 100 expecting a 3, and gets a 5.
A is sad.
B reads memory location 100 expecting a 5, and gets a 5.
B laughs at A.

The problems exists when each CPU "thinks" that is in total control of the system. With two CPUs, no longer can the default assumption be that everything is the same the last time you left it. Imagine you being alone on a desert island. If you leave you Snickers bar on the beach, leave for a day to hunt and come back you expect your candy bar to still be there. However if you're on the island with Josh Old and you leave your candy bar to go hunt...

This is why you can't just drop a second CPU into any computer and have it work. Both the processor and the motherboard, and the operating system all have to "know" that a dual CPU situation exists and handle it. That includes making memory changes aware to both processors, not letting one read data from a location while the other is trying to write, and other synchronization issues including "deadlock."

In fact, this whole memory fiasco is the reason for the dimishing returns on more and more processors in a normal system. The memory unit can only dish out so many bits a microsecond. And after that bandwidth is full, then no matter how many processors you add there won't be enough to go around. This problem can be solved, and has been, just look at every supercomputer out there today. Hundreds and thousands of CPUs all working in sync and happily. This is because the system was specially designed for it and the actually programs running on it optimized for multiple CPU execution. Modern computers aren't like this, and most software isn't written to take advantage of 2 or more CPUs, hence programming must change to take advantage of this.

That's hard to do. And time consuming. Synchronization being the hardest aspect.

Worst of all, these issues prey on the lives of CPUs halted because another has changed its data... They often get upset and relieve their pain by eating a pint of Hagan Das. Its really quite sad actually.

Later.

Comment! (5) | Recommend!

Curse One More Time, Recurse
Wednesday. 8.3.05 7:13 pm
Hard problems are hard to solve. Duh!

Easy problems are easy to solve. Obviously!

Hard problems can many times be split into smaller easier parts. Hmmm...

This is the guiding principle of recursion. Recursion is a mathematical concept that is a property of a function. Functions are recursive (aka self-referential) if the definition of the function contains a reference to itself.

An example of a recursive function is:

f(x) = f(x - 1) + f(x - 2)

The function's definition is in terms of itself. By the way if the above function looks familiar, it should, and it has a special name. Read on find out its name.

The concept seems easy enough, but in terms of math the practical applications can be obscured (as is many times the case with math).

Actual application:

Let's drop the number mumbo jumbo and look at how recursion works in the real world. I'll bet that you've used a recursively algorithm before. In fact I guarantee that you have. Pick up a book that's nearest to you. For some that will be farther than other's, but I'll wait. Got it? OK, good. Turn to page 73 quick, GO GO GO! Unless you have extraordinary good luck, you used a recursive method (algorithm) to find the page.

Let me tell you how you found the page.

First, you opened to a random page and saw that you didn't get the right page. If you opened to a page higher than 73 then you flipped to a page in the left hand side of the book. If you found a page less than 73 you flipped to a page in the right hand side of the book. You repeated until you found page 73.

That is a recursive agorithm. Written in English/programming psudocode:

findInBook( pages, pageNum )
{
if ( page is pageNum ) exit;

if (page < pageNum)
findInBook( rightHalf( pages ) , pageNum );
else
findInBook( leftHalf( pages ) , pageNum );
}

Recursion, its a beautiful thing. Recursion allow very complex and difficult problem to be solved using small, simple, repeatable smaller problems. I won't go into the details, but sorting lists of numbers and names often times uses recursion. The famous Quicksort being a prime example.

BTW, the above recursive function along with the initial conditions f(1) = 1 and f(2) = 1 is better known as the Fibbonocci Sequence. A mathematical progression that appears throughout nature.

Later.

Comment! (3) | Recommend!

The Wonderous XOR
Monday. 8.1.05 8:33 pm
Programming tricks of the day.

XOR

XOR (exclusive OR) is one main basic logic operations on all computers. Its a binary operator that takes two bit patterns and combines them (hopefully) is a useful manner. Often times XOR is represented by the carrot character, ^

Sample XOR operations:

0 ^ 0 = 0
0 ^ 1 = 1
1 ^ 0 = 1
1 ^ 1 = 0

As you can see from the table, the output of an XOR operation is "0" if both bits are the same, and the output is a "1" if only one if the bits is a "1". If the two oeprands have multiple bits, then each corresponding bits in the two numbers is XOR'ed seperately.

This would just merely seem like logic designer's having too much time on their hands (and in many cases do) however the XOR operation is very usefully in certain situations.

Uses in encryption:

The XOR operation is self repeating. Say you have the number A = 0101 and you wanted to send it secretly. One way to do so if using XOR encryption, the involves picking a key. A key, in this case, is just a sequence of bits the same length as the message you want to encrypt, call this number K.

The encrypted message, E, is A ^ K

To decrypt the message E, XOR it with K again E ^ K = A

As you can see, XORing twice with the same number gives you back what you started. FOr an example let's encrypt our number, A = 0101 with the key, K = 1110

A = 0101
K = 1110 ^
-------------
E = 1011

Send E out to the other person, the other person, knowing E and the secret key, K, simply XORs them together to find the original message.

E = 1011
K = 1110 ^
-------------
A = 0101

Obviously, encrypting 4 bits doesn't serve much practical good, but this method can extend to any number of bits and encrypt any length message. In fact, this basic method is the base behind DES encryption, which in itself the base behind modern RSA encryption techniques.

Quick memory clearing:

A not so obvious result of an XOR is what happens when a number is XORed with itself. A simple test will figure that out

1011
1011 ^
---------
0000

An intersting result. Any number XORed with itself will give all zeros. Besides being useful, this method is extremely fast. Modern processors can perform XORs with upwards of 32 to 64 bits in less than a single clock cycle. This simple fact is the basis behind the fast clearing of memory including most retail hard drive wiping software.

Programming Trick:

If you've taken a programming class, then you've almost certainly had to write a swap function. A function that takes two parameters and returns the two with their values switched. The following is a common C++ implementation.

void swap(int& a, int& b)
{
int temp = a;
a = b;
b = temp;
}

The above works, but at the expense of a temporary variable. You might think it impossible to do the above swap operation without that temporary variable. I'd be willing to guess most programming teachers would agree. However, believe or not there is a way to perform the swap function without a temporary variable. And you do that with the XOR.

void swap(int& a, int& b)
{
a = a ^ b;
b = b ^ a;
a = a ^ b;
}

Don't believe me? Try it.

Later.

Comment! (3) | Recommend!

Start Anew
Wednesday. 7.27.05 9:04 pm
I was watching "The Situation with Tucker Carlson" on MSNBC and that was just too funny. He was going over all these crazy stories..

1) In one middle school a kid hated his teacher so much that while talking with the teacher at her desk he induced himself to vomit. He proceeded to projectile vomit all over the teacher in front of the class. The police, however, have arrested him and he's being charged with assault.

2) Late one night in LA two women left a bar both drunk. They reasoned in their inebriated state that driving their car home would not be a good idea. So the two decided to push their car home. One woman pushed from the driver's door steering the car while the other woman pushed from the back. Along their trek home they hit a parked car. The police, which happened to be nearby, arrested both women for operating a vehicle under the influence. This is spite of the fact that the car's engine was off.

3) In Florida a man recently had to have his foot amputated. The man decided he wanted to keep his foot and took it home with him after the surgery. However, the man stored and kept his foot in formaldahide in a bucket on his front porch. Several weeks later police in the area received tips that a man was showing people a severed foot on his porch. Acting on the tip the police showed up with a warrent and took the foot into evidence. It was later that night that the man returned home to find that his foot was taken. He called the police to report his stolen foot only to find it was the police that had removed the foot on suspicion of foul play. After a DNA test the foot was eventually returned to the man.

Those are just crazy, funny stories. A non-funny, but still crazy story is a grandparent I saw on the news that is suing Rockstar and Take-Two over GTA: San Andreas. The woman claims that she bought the game for her 14 year old grandson only to learn now that the rating has been changed to Adults Only. She is suing for her money back and for damages resulting from the game. My thing with this is the fact *she* bought the game for a 14 year old. The original rating of the game was for 17+ anyway. She doesn't have any reason to complain.

That's like a lady I heard that was mad after taking her 11 year old son to see the movie Titanic, he saw exposed breasts. She apparently forgot to notice that the movie was rated PG-13 and brought an 11 year old. How is that anyone's fault but her own.

I came up with a good idea today for a database system name. Someone should make a DBMS named "Savant". It could go head to head with Oracle. And the theme song for the Savant advertising blitz should be spearheaded by songs from Prodigy. That'd be cool.

---------

Ok. Now to give a recap of my summer, life, everything in general. Right now I'm in Bethesda, Maryland. I'm an intern at a data warehousing and analysis company named EmpowerIT. Its a small little company, but they do business with many big named companies like Coke, Pepsi, Kraft and others.

So, my job has consisted so far of programming a program for RJ Reynolds Tobacco. They want a program that allows them to create reports and analysis functions on their sales data and their competitors sales data in the military sales region worldwide. I'm writing it in Visual Basic 6 (don't get me started on that) and the databases we're using are Access and MySQL. I hate Access. It's slow and it has this arbitrary file size restriction of 2 gig. Which I've never considered a short coming until now, when the data we're working with is a little over 4 gig. Linked tables have been my friends in getting over it.

There are some interesting people that work there. I predict rants in the future about a select few of the people that work there. Especially the gossip queen that sits next to me... gawd. She is annoying and creepy and double crossing. The other day, and I'm not making this up, she was whispering to Chris (another one) and she was like "I know.. Jason doesn't get it at all, it just looks stupid." Then about 5 minutes later Jason walks by and she says to him, "Great flyer you sent out, I really like it." Yeah.. that kind of person.

Later.

Comment! (3) | Recommend!

Story
Monday. 5.16.05 11:29 pm
“Damn do I look good tonight,” I thought to myself as I was straightening my tie. The tux had been passed down to me by my grandfather and I was excited to finally be able to wear it. It was a perfect fit, just the right length. The sleeves slightly shorter than the coat, a bright white pressed tie, and a small handkerchief in the front left pocket to seal the deal. No cufflinks tonight. I always thought they looked too presumptuous. Not that something like that mattered tonight, as I would probably be the least noticed person there. In fact I knew I would be.

I grabbed my reading glasses and slipped them into my inside right pocket and took my wallet. I checked the hotel suite for anything I may have forgotten. Keys, check, invitation, check, phone... Something told me I had forgotten something. I slid my phone into my jacket, grabbed my overcoat, and headed into the hallway.

On the way to the elevator I couldn’t help but feel like a million dollars. All dressed up on a Saturday night, tux, everything. Not to mention I had the hottest ticket in town. I slipped into the gold trimmed elevator and caught my breath as it dropped down to the garage. The doors opened and presented me with a scene far less luxurious than the elevator that sat open, illuminating the nearby cars with a golden sheen. “Why is it that such fancy places can’t make a decent looking garage?” In this town it was all about the appearance I guess. What’s shown on the outside is what matters. The stuff in the basement isn’t important, only that it serves it purpose and doesn’t grab the spotlight.

Beep, beep. The lights flickered as I unlocked and headed toward my nondescript black sedan. I thought it was sad I didn’t even check to see what kind of cars they kept giving me anymore. It was a new one each week. Opening the door I could still catch a whiff of new car smell. The hanging pine tree had done little to mask it.

It was hard to keep myself calm during the drive over. My mind kept running over the night and everything that I had heard would happen. But masking all of that was the fact the Jessie would be there. My high school sweetheart who I’d been with for close to 8 years now. We were assigned to different cities this past month and I’d only gotten to talk with her on the phone once during that time. I couldn’t wait to see her. I couldn’t decide whether to just walk up and say hi, or surprise her from behind. Either way, I still had five minutes to figure that out. The night seemed still as I drove towards the middle of downtown and I was ready for it all to get started.

Comment! (2) | Recommend!

Shuffle Me Baby!
Friday. 4.8.05 10:02 am
I had a probability quiz today. Considering how difficult the homework was I think I did well on it. That class.. I really don't like it. The homework is hard out the shizout and the teacher isn't too good either, but still I manage to do well in there. Kind of like me and writing. I don't like to write, but yet I do well in writing class. Universe's poetic irony I suppose.

I had a meeting today with Yitna, who's my boss I'm making a website for and I stayed up till too late last night finishing a presentation to show him at our meeting today and he emails me about 5 minutes ago and cancels it. Figures. Oh, I got this cool idea for an animation short yesterday. I really should write it down before I forget it. If I only had some software to do 3D animation on I'd fiddle with it. I heard rumors that some of the computers in a lab here had Maya on them, but when I went and checked they didn't. I think I'm going to download the Maya Personal Learning Edition so I can play with it. That is when I have time.

In other news I learned last week of a feature the iPod shuffle has. Apparently you can set it up so when its connected to your computer, it will fill itself with a random assortment of songs from your music library. I really like that feature, though, not wanting to pay for another mp3 player for this feature. I wrote myself a program that does the same thing in C#. It allows you to pick your mp3 player, your music directory, and then click the Shuffle button. Voila! Instant shuffle features without the Shuffle! Haha. If anyone wants that program I'll be happy to send it to you.

In a completely unrelated note, this just has to be one of the most disturbing things I've ever seen.

Comment! (1) | Recommend!

Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
thecav's Weblog Site • NuTang.com

NuTang is the first web site to implement PPGY Technology. This page was generated in 0.042seconds.

  Send to a friend on AIM | Set as Homepage | Bookmark Home | NuTang Collage | Terms of Service & Privacy Policy | Link to Us | Monthly Top 10s
All content � Copyright 2003-2047 NuTang.com and respective members. Contact us at NuTang[AT]gmail.com.