Saturday, March 28, 2009

Earth Day?

http://www.google.com/intl/en/earthhour/2009/

Heh this is pretty funny, they want us to turn off our lights for an hour? What for?

I'm all for cleaner sources of energy and a cleaner planet earth, however we need new technology that's more efficient, we shouldn't have to use technology less just because its inefficient.

Probably ~40% of the energy in the things we use daily is wasted due to inefficient technology (just my guess).

PSU's iirc are at-most like 80% efficient, and standard lightbulbs waste like 50% of their energy as heat (i've totally forgotten the exact statistics of these things, so they might be off).

But the point is, we don't need to use technology less to conserve energy, we need to make technology better!

Wednesday, March 25, 2009

Discrete Mathematics Sucks

I've taken Discrete Mathematics 3 times, and I'm on my 4th try ><
I feel pretty retarded taking the same class 4 times, and it especially hurts when I see people that are dumber than me passing the class :/

I'm one of those people that are only good at stuff they enjoy. If I don't enjoy doing something, or if I see no real-benefit from it, I won't apply myself and just half-ass it (or in the case of discrete math, just procrastinate and not study till the-day-of the test :o)

The class is basically a bunch of different advanced math courses/theories combined into 1 class. It needed for all Computer Science majors at my school, so it *should* have something to do with computers, but it really doesn't :/

Seriously, I spend most my days programming shit, and I really don't see much practical use for discrete mathematics. There may be some cases where you can use graph theory to help with stuff like shortest path algorithms, but there's a big difference between programming 'graph theory', and math graph theory.

Basically 'graph theory' or any other aspect of discrete mathematics to a mathematician is all about proving or showing something is true for all possible cases, regardless of the practicallity of actually implementing the algorithm. To a programmer its just "does this work good enough for what I need, and is it fast?"... See the difference? :p

Now, what good is an algorithm if its not practical to actually use? Or if you'll never use it? I love programming because I can create and view my creation. With mathematics you theorize and.... wait I guess that's it!? oO

Its funny, because back in high school I took Honors and Advanced Placement math courses, and got very good grades. I used to think math was pretty fun and easy... but then when I got to college I realized that the math in high school was "bullshit fake math."

College math was a punch in the face, I actually had to study!? wtf! The bullshit fake high school math courses only 'taught' me that I didn't have to study for math courses because they were easy... I got pretty pissed when I learned what 'real math' was after taking some university math classes :/

Anyways, the point of this blog-post is:
1) Discrete Mathematics is pretty useless, and shouldn't be mandatory for Computer Science Majors.
2) High School mathematics 'prepares' you badly for college-level math, by giving you false expectations that it will be easy.

Monday, March 23, 2009

Hmm

I realized that the default option for comments is that you need an account to leave them. So I just changed it so that anyone can leave a comment, and I also disabled the word verification since those things are so annoying!

The worst part about word verification is that the text they make you type in is usually sooo warped that it takes a couple tries to type in the correct word ><

Programming != Math

There's a big misconception a lot of people have where they think in order to be a programmer, you have to be excellent at math or be a mathematician. This is absolutely false for most types of programming, or at least very misleading.

Rather than saying you have to be good at math, its more correct to say you have to be good at thinking logically or procedurally. When you program you have to think about the goal you want to accomplish within the program you're writing, and then think of the step-by-step way to achieve that goal using the 'instructions' made accessible to you by the programming language.

But notice that 'thinking logically' and 'mathematics' aren't the same thing. Of course being good at math is definitely a benefit to programming; if you know certain mathematical rules you might be able to simplify or optimize parts of your program, but its not a necessity for most types of programming.

Now there are some fields of programming where math is more crucially used, a 3d game programmer for instance is going to use more math than a programmer developing a word processor. But if you take all the types of programmers in the world, most programmers rarely have need for any advanced-math in their applications.

Personally I believe programming is more practical than mathematics anyways. Programmers create things that are useful to people, whereas mathematicians come up with theories that 95% of the time don't have any practical value.

I always wonder why people want to be mathematicians, what the hell are they going to do with that mathematical knowledge? I guess that's why most of them just go on to be professors or teachers, since they can't find a real job that practically applies that knowledge :p

So bottom line is:
1) You don't have to be a mathematician to be a programmer.
2) Knowledge is useless if its not put to a practical use.

Saturday, March 21, 2009

What is microVU?

Well earlier today on the pcsx2 forums someone asked this question, and I guess I could go further into detail here as well as give a nice overview on PCSX2 and the Sony Playstation 2 (it should be an interesting way to kick-start this blog).

Well as I mentioned in my first post, the main project I work on is a PS2 emulator called "PCSX2".
For those of you unfamiliar with emulation, it's basically the idea to mimic or 'emulate' one system on another system.
In the case of PCSX2, we are emulating the Playstation 2 system on a PC. So basically it lets you play ps2 games on your PC! :)

The ps2 is a powerful beast, and I don't think much people understand how difficult properly emulating the system is. Its not uncommon for people to belittle the project or to flame it with hateful remarks (but I guess I can talk about that in another post :p)

Basically to make an emulator, you need to have a solid understanding of how the system you're emulating works at a low level. In the case of the ps2, it has multiple different processors and units that need to be emulated correctly, and it also has to be programed in a way so that the components can sync and 'talk' to each other nicely.

The PS2's main component is the Emotion Engine (EE), this is the 'heart' of the system which also includes 2 co-processors: COP1 (FPU), and COP2 (VU0 in macro-mode).
In terms of PCSX2, we currently use dynamic recompilers to emulate the EE.
A 'dynamic recompiler' is an emulation approach in contrast to an 'interpreter' (which is generally alot slower and easier to code).

The idea of a recompiler is to take the ps2's native language or 'instructions' and to translate it into something your PC understands. After it translates alot of instructions, it saves them in memory in 'blocks'. A block is basically a bunch of instructions that have been translated.
Later on when a game wants to 'read' an instruction, the recompiler would look-up a compatible block, and start 'executing' that block of code.

This approach is alot faster than an interpreter because it only has to translate the code once, and then can read the saved translated code as much times as needed.
An interpreter however doesn't 'save' any translated code, but instead just calls a function whenever an opcode needs to be executed (the overhead for the function calling, as well as the lack of optimizations that can be made, are some of the reasons interpreters are so slow).

Well to get back to what I was saying, PCSX2 currently uses recompilers for its EE emulation (it also has interpreters for the EE, but they're really slow). Our current implementation of the EE recompiler is really a mess quite-frankly. Most of the pcsx2 team agrees we need a complete rewrite of the recompilers eventually, and hopefully next-time around it'll be cleaner and faster :)

To get back to describing the PS2, in addition to the EE, it also has 2 Vertex Unit Processors (VU0 and VU1), a Graphic Synthesizer (GS), various DMA units (vif, sif, gif, ...), 2 Sound Processing Units (SPUs), an Input/Output unit (IOP), a MPEG-decoding unit (IPU), and various other components I didn't mention.
Emulating all these units is alot of work, and syncing them so they work 'together' is ridiculously complex (many of pcsx2's problems is incorrectly syncing these units).

Well now I guess I can finally get to the original question: "What is microVU?"
microVU is what I named the new VU recompilers I'm working on.
Currently PCSX2 uses the VU recompilers named "Super VU" a.k.a. "zerorecs", but they're incorrect when it comes to properly following the VU's pipeline rules, also they're coded in a way that makes them un-threadable.
The goal for microVU is to properly emulate the VU's pipeline and possibly be even faster than Super VU. Additionally, microVU is coded with threading in mind, and eventually it should be threadable which would enable big speed-gains for quad-core CPU users, and possibly nice speed-gains for dual-core users as well.

Since this post is already a Wall of Text, I guess I'll stop here for now, and possibly go over some more stuff in future posts :p

Starting this blog.

Well this is my new blog.

Here I'll post random things dealing with the projects I work on, as well as any other stuff I feel like talking about =D

I guess I should post a bit of background info about myself for those that don't know me.

Well I go by the nick 'cottonvibes', I'm a 20 year old university student living somewhere in the USA (exact location is hidden to prevent my privacy ;p)

Mostly I spend my time coding for a well-known project called PCSX2 (the world's most advanced ps2 emulator! :p). I've been working on PCSX2 for about a year, but 'officially' I've only been coding for the project about a few months.

Before that I was one of the founders of PCSX2 Playground, which was a PCSX2 branch project that quickly gained popularity, and eventually got merged into the official PCSX2 project (and thats how the rest of the playground team and I got on the official PCSX2 team).

Aside from PCSX2, I've worked on various other random private coding projects, mostly just for fun by myself.

I'm halfway done with my own NES emulator called "cottonNES", but due to PCSX2 taking up most my time, I've had to put that project on hold.

...well this probably is enough writing for my first blog post, so I guess I'll just stop here and write some more random gibberish later :D