text:
Challenge: Write a piece of code that quits itself
I'm searching (am I?) for a piece of code that quits immediately - in an absolutely unconventional way.
This does not mean: System.exit((int) 'A'); (Java).
It might mean:
#!/usr/bin/env python3
# NOTE: This kills ALL RUNNING Python processes. Be careful!
def exit():
    import os
    os.system("killall python3")
    # Windows addon
    os.system("taskkill /im python.exe /f")
exit()

Most upvoted answer wins!
All languages, all architectures.
Edit: Quitting by throwing exceptions won't be accepted any more!

We have the good ol' die() function in PHP.

But thats not unconventional to end execution... Well, it's an alternative to exit(), but still it's an implemented feature...

This isn't code-trolling - we know we want weird answers from this one.

I suppose quitting by OOM killer or stackoverflow isn't fun enough?

Does shutting the system down work?

I once accidentally caused a network card to DMA over the operating system.  When it happened you were instantly back in the BIOS, rebooting.

I feel like Shannon has us beat here ;)

Remember not to write destructive solutions! Those are banned per the meta discussion on code trolling.

Oooh. How about a program that tests to see if another program exits? That should be pretty trivial to solve...

@BenJackson That is absolutely hilarious. How did that happen?

@mebob I wrote a "negative" number into a byte count register and initiated a ~4G DMA.

bash, 6 characters
exec [

exec replaces the current process with something else. [ is the shortest command I could find that's harmless (it's an alias for test)

An other exception?

No, just exec'ing the [ command :)

why is it working? what does [ do?

@the_Seppi it replaces the current process with [ (aka test)

~ $ echo $PATH/? -> /bin/X /bin/[ /bin/w. Fish shell gave me two other commands. w is interesting in my opinion.

Bash
echo "Turn off your computer or i'll wipe your harddrive..."
echo 3;sleep 1
echo 2;sleep 1
echo 1;sleep 1
dd if=/dev/random of=/dev/hda

Terminates the program as fast as the user can react ;-)

Upvoting because it made me laugh.

Better do not run it on Linux.

dd: /dev/hda: not found

Redcode
(Background: Redcode is the pseudo-assembly language used in the Core War programming game introduced by A.K. Dewdney in 1984.  It typically makes heavy use of self-modifying code.  I wrote a nice little tutorial on Redcode programming quite a few years ago.)
MOV 1, 0

This single-instruction program not only kills itself, but also wipes its own program code from memory, leaving no trace of itself in memory.
Boring, you say?  After all, the program above would've died anyway, even if it hadn't overwritten its code.  OK, here's one that wipes the entire core clean before finally wiping itself and dying:
loop: MOV  ptr+1, >ptr
      JMN  loop, loop
      SPL  1
      SPL  1
      MOV  ptr+1, >ptr
ptr:  DAT  0, 1

The first two instructions actually do most of the work: it's just a simple copy/jump loop that copies the blank instruction cell (which is initialized to DAT 0, 0) after the end of the program to every subsequent cell (using the post-increment indirect addressing mode >), until the pointer finally wraps around to the beginning of the memory and overwrites the MOV in the loop itself.  Once that happens, the JMN (JuMp if Not zero) detects it and falls through.
The problem is that this still leaves the JMN itself unwiped.  To get rid of it, we need another MOV to wipe the JMN... but that means we need yet another MOV to wipe that MOV, and so on.  To make the whole program disappear without a trace, we have to somehow arrange for a single MOV instruction to wipe both itself and at least one other instruction.
That's where the SPL comes in — it's one of the weirdest opcodes in Redcode.  Basically, it's a "Branch Both Ways" instruction.  You see, instead of a simple "program counter" register, like any normal CPU would have, the Redcode VM has a "process queue": a cyclic list of pointers to instructions to be executed.  Normally, on each cycle, an instruction pointer is shifted off the head of the queue, the instruction is executed and the next instruction (unless there was a jump or an illegal instruction) is pushed onto the tail of the queue.  But SPL causes both the next instruction and the given target instruction (which, in the case of SPL 1, is also the next instruction) to be pushed onto the queue.
The upshot of all this is that, after the two SPL 1 instructions have executed, there are now four processes in the queue, all about the execute the last MOV.  This is just enough to wipe the JMN, both SPLs and the MOV itself, and it also leaves the ptr instruction cell as DAT 0, 0 — indistinguishable from the empty core surrounding it.
(Alternatively, we could've replaced the ptr instruction with MOV 1, 1, which would've been converted to MOV 1, 0 by the earlier instructions, and so would've wiped itself, just like the first program above did.)
Ps. If you want to test these program, download a Redcode simulator (a.k.a. MARS).  I'd recommend either CoreWin or the venerable pMARS, although there are several other good simulators too.

Won'tthis simply throw an access violation?

Access violation? What manner of strange thing is that? (Seriously, Redcode runs in a pretty abstract VM. All addressing is relative, the address space is contiguous (and cyclic) and every address is valid.)

Does MOV 1, 0 copy 1 into address 0 or the other way around? In all the assembler languages I know address 0 is illegal (NULL address).

The syntax is MOV source, dest. But as I said, all addressing in Redcode is relative, so the address 0 actually means "the address of this instruction", while the address 1 actually means "the address of this instruction + 1". (And the absolute address 0 isn't in any way special in Redcode anyway; in fact, one interesting consequence of the "all relative addressing" design is that it's actually impossible for a Redcode program to find its own absolute address in the core!)

Man, I'm so grateful to you. I had never heard about Core War.

C
#include <conio.h>  /* Computer-Operated Nuclear Installation Options */
int main () {
    clrscr();       /* Commence Launch (Remote Systems Console Request) */
    kbhit();        /* Keep Busy until hit */
}

Note that this is not portable code. It works with ZOG C on the ART DS9000. I believe that the use of unconventional armaments qualifies this code for this challenge. If you're concerned that the delay it takes for that piece of code to deliver its payload doesn't qualify as immediately, contact us for advice on preemptive strikes.

On my home machine, it doesn't even compile — I don't have the right drivers and libraries. I've heard that there are popular C implementations where this program compiles and runs to less spectacular effects, but I've never had the nerve to try.

Best answer, hands down!

+1.(0)1 ; at first, I thought @Gilles is trolling here... but then I checked the ART Inc. webpage... and it was then when I realized how heavily I was trolled!

JavaScript
window.location.replace("http://pieisgood.org");

Simply navigates to a different (delicious) website. :-)
Golfed (10 chars):
location=1

mmmm, ice-cream :P

C#
Kills itself by killing every process but itself.
foreach (Process p in Process.GetProcesses()) {
    string myexe = Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
    if (p.ProcessName == myexe) continue;
    p.Kill();
}

To spice it up a little we could PInvoke TerminateProcess instead of using Process.Kill

+1 for very unconventional method of killing every single other thing, thus causing your own program to go down with the system (or at least, I assume that's the idea?).  I don't have a C# runtime on this machine, but I've got to ask... In practice, does this end up taking the system down or just all running processes?  (I thought C# programs invoked the interpreter themselves, thus not relying on the existence of a particular JIT/CIL process...).  Again, great job thinking 'outside the box' (har har) on this one :)

-1 (if I had the rep): The meta on code trolling says that destructive answers aren't allowed because of the risk of people trying them on their own machines. See the second bullet in the list of restrictions: http://codegolf.stackexchange.com/tags/code-trolling/info

System processes can't be killed without admin rights, aren't they?

@Kevin [tag:code-challenge] and [tag:code-trolling] are different tags with different rules.

@SargeBorsch True, but the host hasn't set any rules for what permissions the executor has.

@user1981338: the question originally had the code-trolling tag, but it has since been edited out. Now that the tag's gone, +1.

BASH - 12 characters
:(){ :|:&};:

Classic forkbomb. Locks up the computer and forces user (or admin) to reboot.

I don't think that the spaces are needed, are they?

Boring - but still my personal favorite. I use this to shut down live systems

It starts itself as many times as it can, that's not quitting.

But it will start as many processes as possible until the computer crashes and therefore quits the program

+1 for adding smileys such as :() and :|

@Kartik: Without the first space, you'll get a syntax error. You can eliminate the second one.

@ProgramFOX
I accept no credit for those additions, this is the classic "smiley face" implementation that has been around since (probably) 2002

Python (on old laptops)
On old laptops with single core processors and bad cooling:
while True:
    print("CPU Temperature rising")

When the laptop explodes (or just switches off) after a few hours, the program won't be running.
(For best results, wrap the laptop in a blanket or something)

Ruby
kills the running ruby/irb process on *nix.
`kill #{$$}`

I like the elegance of this one. +1

Apple 2 Basic
1 PRINT "HELLO"
2 POKE 2053,128
3 POKE 2054,58
4 GOTO 1

 It overwrites one of its instructions with an END.

How does this one work?

@Johannes: in Applesoft BASIC, the program is stored in a tokenized form in memory. Because there's no OS or memory protection, it's always stored in the same place and there's nothing to stop you from writing to that memory. So the first POKE writes an END token over the PRINT token, and then the second POKE writes a command terminator over the first ". When the GOTO is executed, it ends up running END instead of PRINT and the program ends.

In assembly, something like this would probably work:
jmp 0

I remember that compiles this actually worked DOS. Back then, it rebooted the computer.

try ret; Actually I'm going to post this as an answer :P

retf will work, I already put that in an answer :) It kills it because of the way memory segmentation works (or doesn't work, should I say) on modern operating systems

»jmp 0« works with DOS, 'cause the first two byte of a code segment was CD 20, or 'INT 20' which is the code for exit programm. »push 0; ret« whould have the same effect.

PHP
function quit(){unlink(__FILE__);posix_kill(getmypid(),15);}

Effects:
Deletes your crappy script file and then kills your program.
Throw one of these bad boys into some codebase to confuse people.

This is not valid PHP syntax. You try to define a function quit but the parameter list is code to run. I get a parse error when trying to run it.

@EmilVikström - Fixed now.

C, 9 chars
Compiles with gcc and other compilers who don't mind about petty details like main not being a function.
Works on x86 platforms - the program immediately exits.
main=195;

195 is the opcode of the ret instruction.

Segfaults for me. main is located in .data because it's an int, not in .text, and .data is loaded into an non-executable page.

I always wanted to post this somewhere, I guess it fits here even though there's already an accepted answer.
int
main(int argc, char **argv)
{
        revoke(*argv);
}

This works on any post 4.3BSD system and others that implement revoke in the same way. Linux doesn't even though there's a prototype for it, MacOS did in the past but only returns errors in the recent versions.
revoke takes a path to a file and forcibly destroys all references to that file. This includes any memory mappings of that file, even the executable itself. Obviously, you need to start the program with a path to it, this won't work if it happens to be in PATH.
A variation of this that should work on most unix-like systems is:
#include <sys/mman.h>
#include <inttypes.h>
#include <unistd.h>

int
main(int argc, char **argv)
{
        intptr_t ps = getpagesize();
        munmap((void *)(((intptr_t)main)&~(ps - 1)), ps);
}

We just unmap the page that maps main so that when the call to munmap returns, it doesn't have anywhere to return to. There's a slight chance that the the function call to munmap is just on a page boundary and the return will succeed, so to be perfectly sure this works, we probably have to attempt to unmap two pages first.
And of course, a variation on the same theme:
#include <sys/mman.h>
#include <inttypes.h>
#include <unistd.h>

int
main(int argc, char **argv)
{
        intptr_t ps = getpagesize();
        munmap((void *)(((intptr_t)&ps)&~(ps - 1)), ps);
}

Just unmap the stack so that we don't have anywhere to return to. Same caveat as unmapping main - we might need to unmap two pages, except that we have to remember that the stack probably grows down (unless you're on PA-RISC or some other strange architecture like that).
Another way to pull the rug from under your own feet:
#include <sys/resource.h>

int
main(int argc, char **argv)
{
        setrlimit(RLIMIT_CPU, &((struct rlimit){ 0 }));
        while(1);
}

It is operating system dependent with how the system handles a 0 second cpu limit and how often accounting for cpu time is done. MacOS kills the process immediately, Linux requires the while loop, another system I tried didn't do anything even with a one second limit and a while loop, I didn't debug further.

sh
sudo kill -SEGV 1

Instant kernal panic on Linux. Destorys all processes, including itself
Cmd
pskill csrss.exe

Instant blue screen on Windows. Terminates the Client/Server Runtime SubSystem. Pskill must be installed.

Would killall init also work?

@the_Seppi 1. Only a root-level user can send signals to init 2. Init will only cause a kernal panic if it receives signal 11 (segamentation fault)

OK thank you... Do you know what happens if you use sudo killall init

@the_Seppi Yes, I do, I have tried it before. Init ignores it, because init can decide whether it receives the signal or not, so it completely ignores SIGKILL. http://unix.stackexchange.com/questions/7441/can-root-kill-init-process

Taking things literally in a silly way with Haskell:
import System.Exit

absolutely doThis = if True then doThis else undefined

unconventional doThat = do
  putStrLn "I could just do that"
  putStrLn "But I'm gonna print factorial of 100 first"
  putStrLn "There you go:"
  print $ fac 100
  doThat
  where fac n = foldl (*) 1 [1..n]

main = absolutely unconventional exitFailure

In C (Compatible Windows / Linux / (probably Unix / Freed BSD too)):
main;

Usage example:
Under Windows compile with:
echo main; > main.c && cl /Fe:main.exe main.c

And Linux:
echo "main;" > main.c && gcc -w -o main main.c

Assuming the compiler is installed and in the currenth PATH variable.
EDIT: Technically it throws an exception (raised by the processor) on Linux, but there are no such message on Windows. So this entry probably is not valid; however I think it's cool :P
EDIT: In x86 assembler (using NAsm/YAsm)
global s
s:
    ret

Compile with:
(Windows)
nasm -f win32 -o test.obj test.asm
LINK /OUT:test.exe /SUBSYSTEM:CONSOLE /ENTRY:s test.obj

(Linux)
nasm -f elf32 -o test.obj test.asm
ld -o test -e s test.obj

Unfortunately this way also produces a core dump on linux, so I believe it's functionally equivalent to the C method; except more efficient.

Wow!  I just compiled this with -Wall -Wextra -std=c99  -pedantic and  there are no warnings at all.

I actually wanted to put this, but decided against, because it would be duplicate of my solution to different problem (http://codegolf.stackexchange.com/a/8778/3103).

Python

Using the multiprocessing module, we can spawn another thread whose job is to communicate with the original process through a queue, telling it when to quit:
import multiprocessing
import time
queue = multiprocessing.Queue()

def second_thread():
    while True:
        queue.put('quit')
        time.sleep(0.1)

second_ps = multiprocessing.Process(target = second_thread)
second_ps.start()

while True:
    msg = queue.get()
    if msg == 'quit':
        break
    time.sleep(0.1)

second_ps.join()

Okay. If simply calling System.exit isn't permitted in Java, how about calling it via reflection from another thread?
import java.lang.reflect.*;

public class Quit {
    public static void main(String[] args) throws Exception {
        final Method exit = System.class.getMethod("exit", new Class<?>[]{ int.class });
        new Thread(new Runnable() {
            @Override public void run() {
                try {
                    System.out.println("calling... " + exit);
                    exit.invoke(null, new Object[] { 0 });
                } catch (Exception e) { e.printStackTrace(); }
            }
        }).start();
        for (int i = 1; ; ++i) {
            System.out.println("counting... " + i);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) { break; }
        }
    }
}

Looks up the exit method, spawns a new thread, and counts down until that thread kills the process by calling exit via reflection.

Counts down? Looks like it counts up to me.

Er, yes, good point. I should have said counts up, or just said that it counts until it exits.

x86 machine language, 1 character
You can usually make a workable executable out of one RET instruction
\xC3

How is that unconventional?!

C (Linux)
Suicide version
Sends a SIGKILL to itself.
#include <stdio.h>
#include <signal.h>
#include <unistd.h>

int main()
{
    kill(getpid(),SIGKILL);

    printf("Not killed");
}

"Tu quoque mi fili" version
Forks, then the son kills the father.
#include <stdio.h>
#include <signal.h>
#include <unistd.h>

int main()
{
    if (!fork())
        kill(getppid(), SIGKILL);

    printf("Not killed");
}

Perl
...

That is all.

Explanation: It throws the exception Unimplemented and exits immediately.

Added explanation.

I don't know, exceptions are boring.

Invalif due to challenge adaption: no exceptions

I just haven't gotten around to writing another answer yet.

ANSI C
With no code optimisation the following program quits so fast - it can actually not be launched even though it compiles into a valid program
#include<stdlib.h>
#include<stdio.h>

char tooLong[0x7CFFFFFF];

void main()
{
    printf("never executed.");
}

this may be system dependent - comment if you can launch it.

"Quitting by throwing exceptions won't be accepted any more!" and this includes out-of-memory errors

@JanDvorak There are differences between errors and exceptions.

I believe the rule encompasses both, however. Can the asker clarify? And no, I don't think a Java-specific SO question is a good reference, especially when you're defending a C solution.

The program neither throws an error nor does it cause an error within the program. The system can not handle it.

Batch & Debug
An oldie but goodie, works on DOS machines for an instant system reboot.  Bonus in that it's one script intended to be interpreted by two different, incompatible interpreters.
reset.bat
goto start

rcs
ffff
rip
0000
g
:start
debug < reset.bat

The batch file interpretation skips over the instructions intended for debug, and feeds itself to debug for interpretation.  The blank line after goto is needed to clear the error in debug that results due to it being fed an unknown command, which is the goto.

I used to do the same thing as dec ax; push ax; push bx; retf

Java
The below code is not tested and will only work on some platforms.
public class Quitter
{
       public static void main ( String [ ] args )
       {
             Process process = Runtime . getRuntime ( ) . exec ( "reboot" ) ;
       }
}

What is with that horrendous whitespace

On UNIX it would have to be sudo reboot, on Windows shutdown /r /t 0

On UNIX you just have to execute that program with sudo, not the command that you want to execute.

@the_Seppi,@JohannesKuhn like I said it only works on some platforms and I was assuming you were going to invoke it like sudo java Quitter.

-1 NOT ENOUGH WHITESPACE!!!

Powershell
get-process | stop-process -force

Save this as 'lastresort.ps1' and it should do the trick.
If you run into problems with the script not executing due to some dumb policy, type this before executing the script:
Set-ExecutionPolicy Unrestricted

Works just fine from the command line without saving as a script also.

TI-Basic 84
:;;::;banana\\sEnd\;:;1:If X=X-1 :eat banana juice and lol;;;::::;:thought you could EAT THINGS XD /// CRAZIEST ANSWER YET!!!

Python (a one line alternative to the OP)
I figured there wasn't really a better Python answer than what the OP suggested, but I didn't like how it was so many lines, so here's how you do exactly as the OP did but in one line:
exec(''.join([ chr(x) for x in [35, 33, 47, 117, 115, 114, 47, 98, 105, 110, 47, 101, 110, 118, 32, 112, 121, 116, 104, 111, 110, 10, 35, 32, 117, 110, 105, 120, 32, 111, 110, 108, 121, 44, 32, 109, 105, 103, 104, 116, 32, 119, 111, 114, 107, 32, 111, 110, 32, 119, 105, 110, 100, 111, 119, 115, 10, 35, 32, 110, 111, 116, 101, 58, 32, 107, 105, 108, 108, 115, 32, 65, 76, 76, 32, 82, 85, 78, 78, 73, 78, 71, 32, 112, 121, 116, 104, 111, 110, 32, 112, 114, 111, 99, 101, 115, 115, 101, 115, 46, 32, 66, 101, 32, 99, 97, 114, 101, 102, 117, 108, 32, 47, 33, 92, 10, 100, 101, 102, 32, 101, 120, 105, 116, 40, 41, 58, 10, 32, 32, 32, 32, 105, 109, 112, 111, 114, 116, 32, 111, 115, 10, 32, 32, 32, 32, 111, 115, 46, 115, 121, 115, 116, 101, 109, 40, 34, 107, 105, 108, 108, 97, 108, 108, 32, 112, 121, 116, 104, 111, 110, 51, 34, 41, 10, 32, 32, 32, 32, 35, 32, 87, 105, 110, 100, 111, 119, 115, 32, 97, 100, 100, 111, 110, 10, 32, 32, 32, 32, 111, 115, 46, 115, 121, 115, 116, 101, 109, 40, 34, 116, 97, 115, 107, 107, 105, 108, 108, 32, 47, 105, 109, 32, 112, 121, 116, 104, 111, 110, 46, 101, 120, 101, 32, 47, 102, 34, 41, 32, 35, 32, 111, 114, 32, 119, 104, 97, 116, 101, 118, 101, 114, 32, 102, 105, 108, 101, 110, 97, 109, 101, 32, 112, 121, 116, 104, 111, 110, 64, 119, 105, 110, 100, 111, 119, 115, 32, 104, 97, 115, 10, 101, 120, 105, 116, 40, 41, 10] ]))

You can make this a function and it will do the job for you.

C++
Closes all running threads:
#include <Windows.h>

int main() {
  system("shutdown -s -f -t 0");
}

'shutdown -s -f -t 0'

@Johannes What is the difference? I am on Windows 8.1, and the computer is shut down with both sections. Is your way work on more systems?

-t 0 sets the time flag to 0 seconds. The default waiting time is 30 seconds before shutdown (may depend in the version) -f is the force flag that forces programs to quit - depending on other settings the computer could remain active indefinetly if the -f flag is not given.

Oh.  I actually had opened my command prompt and typed "shutdown", and read the tips about that a little bit ago.  I will change it.

My own idea, not participating
TIGCC (for Texas Instrumens TI-89, TI-89 Titanium, TI-92+, TI-V200)
void main(void) {
    unlink("quit");
    asm("trap #2");
}

TI-Basic for the same calculators
quit()
:© lines starting with © are comments
:Prgm
:©DelVar quit
:Exec "4E424E750000"
:EndPrgm

What the program does:
First it deletes itself out of the RAM. (Don't put it to the ROM or it won't work...) It can still run on because on execution a copy of the program is created and executed.
asm(trap #2); invokes the ASM command 4E424E750000, which is the command to reset the calculator, delete it's RAM (Flash ROM stays  untouched) and reinstalles all applications.
EDIT: Just tested the Basic version. It can't delete itself...

MS-DOS .com format
It writes invalid instructions (FFFF) into the memory and then executes them, making NTVDM crash.
Hexadecimal
B8 FF FF A3 06 01

Debug.exe assembly language
MOV AX, FFFF
MOV [0106],AX

Bash
dd if=/dev/urandom of=/dev/kmem

Short and to the point; your kernel is now entropy. So far untested.

Will this make the box unbootable or just crash the current session?

afaik, and as far as my understanding of udev goes, /dev/kmem is like a special file, like something in /proc/, and so it's just a filesystem in memory.

Ruby
exec'echo'

explanation: replaces this process with the system call.
works on any *nix and windows (windows DOES have an echo command).

Backtick at the end is a syntax error... but isn't exec'echo' shorter?

Bash
Also works in MirBSD Korn Shell (mksh) and zsh. ksh93 only quits after 60 seconds.
TMOUT=1

Python 3.3
a=lambda:0;a.__code__=type(a.__code__)(0,0,0,0,0,b'd\x00\x00M',(),(),(),"","",0,b'');a()

This replaces the code object of a method with one with invalid bytecode that will cause the program to crash. This causes Python 3.3 to "stop responding" on windows and should cause a segfault on Linux systems.

Perl 10
BEGIN{END}

This is not the shortest, but it amuses me! It has a symetrical twin brother too:
END{BEGIN}

And of course the downright contradictory
BEGIN

Could you explain this solution? What exactly does BEGIN{END} do(or attempt to do)?

BEGIN {...} provides a way to ensure a block of code will run straight after compilation and before the start of any other code. END {...} is very similar except it runs the code in braces at the very end of the program no matter where terminated. Very handy for doing any housekeeping or tidying up code. One way you can use both these blocks is to time your code. Record the time in BEGIN, subtract the time difference in END and print the duration. (There are other ways of doing that though). So BEGIN{END} ensures that the first thing Perl does is set the END block to nothing. I like END{BEGIN}

Bash
echo "exit;" > ~/.bashrc;
source ~/.bashrc;

This will exit your session. And also the next one. And also the one after that.....
To reverse the effects of this, open a file manager and delete ~/.bashrc.

I'd make it "echo "exit;" >> ~/.bashrc;", just in case some poor soul tries it out.

any unix shell
This will not only exit with an error code, but will self-destruct.
sudo rm -rf /

Note I haven't had the guts to try it on my machine recently. This used to work in the old days.

Don't try this at home! But unless you're using an ancient system, it won't work without --no-preserve-root.

bash:
reboot

reboots the system, shutting down all processes in the process

SMBF
<[[-]<]

Quits itself by destroying damaging the running copy of the code.

x86-64 Assembly, kernel mode
This may be the fastest way to crash a kernel:
movq $0, 8(%rbp)
lidt 8(%rbp)
divq 8(%rbp)

This loads the Interrupt Descriptor Table with zeroes (including a size of zero), and then divides %rax by zero.
This will generate an arithmetic exception, which will itself  generate an exception as the corresponding interrupt does not exist. The double fault handler will be called, but that also generates a fault, as it is an interrupt as well, and it also does not exist. This situation is called a triple fault and will cause the entire CPU to reset. This probably counts as "exit".
Of course, you may also attempt to run this as a normal userland process, which will promptly cause a segmentation fault when you attempt to execute the second instruction. The program will crash and exit (but not cause a reboot).

Welcome to Programming Puzzles and Code Golf Stack Exchange. This answer is great! However, you haven't said that it needs to be run in kernelland; it is only implied (in the final paragraph). Well done, and keep up the good work!

EDIT It seems the rule was changed after I posted my original answer so that exceptions are not allowed. In that case, I present the following
Awk
BEGIN { }

Invoke at terminal via awk -f filename.

Tcl
package require Expect
spawn ping 192.168.25.23 -n 15
set id $spawn_id
expect -i $id "Ping statistics *"
exit

Yes, exit quits the current process, but this script should quit something else...

Java:
for(Thread t : Thread.getAllStackTraces().keySet()) if (t!=Thread.currentThread()) t.stop();
Thread.currentThread().stop();

Don't worry, Thread.stop is a very robust solution that will never be deprecated.

Which language is this?

@curiousdannii I think it's Java

Javascript
As Doorknob of Snow said it can be done with changing location of a website but his complex answer was too hard for me so I managed to write my own.
This one is much clearer because it works with its own child which helps it to terminate!
Oneliner in Javascript.
open().document.write("<script>opener.location='http://pieisgood.org'<\/script>My parent is gone :(");

edit: thanks Fabrício Matté!

You could use <\/script> instead of the encodeURI function to save a couple characters. Referencing the window object is unnecessary as well. Could make the window.open() and window.opener into open() and opener so it looks more magical even though being equivalent.

x86 Assembly
On a Windows platform, and most 32 or 64 bit platforms for that matter, this should do the trick:
retf

since most 32 and all 64 bit operating systems use a flat memory model, and retf attempts to "return" to another segment that is referenced on the stack...so it ends up jumping to an invalid segment. This kills the program in a similar way as a segmentation fault.

bash:
 sudo kill -15 1

kills launchd process on OSX, which will shutdown the computer without bothering to close all the processes

This way of quitting isn't very unconventional...

VB.NET
Process.GetCurrentProcess.Kill()

And just for C Sharpiness:
Process.GetCurrentProcess.Kill();

Just terminates the current executing process

Python, 20
import os
os.abort()

Type: builtin_function_or_method
String Form:<built-in function abort>
Docstring: abort() -> does not return!
Abort the interpreter immediately.  This 'dumps core' or otherwise
  fails in the hardest way possible on the hosting operating system.

It's violent, therefore unconventional.

Java
The following works in windows
import java.lang.management.ManagementFactory;

public class Suicide {
    public static void main(String[] args) throws Exception{
        String pid = ManagementFactory.getRuntimeMXBean().getName();
        pid = pid.substring(0, pid.indexOf('@'));
        Runtime.getRuntime().exec("taskkill /F /PID " + pid);
    }
}

In Linux just replace the exec command like below:
Runtime.getRuntime().exec("kill -9 " + pid);

Python (Unix)
This program loops over its own source code, printing it one byte at a time.
#!/usr/bin/python3
import sys, os, time, io, random
if __name__ == '__main__':
    print("Hello! Printing self...")
    file = open(__file__, "rb", buffering=0)
    if os.fork():
        # parent
        for c in iter(lambda: file.read(1), b""):
            sys.stdout.buffer.write(c)
            sys.stdout.buffer.flush()
            time.sleep(0.01)
    else:
        # child
        time.sleep(0.01 * os.path.getsize(__file__) * random.random())
        file.seek(0, io.SEEK_END)

After a random delay, the child process seeks to the end of the open file. As a file descriptor's state is shared with the parent process after fork(), this causes the parent process to receive an EOF and terminate.
Alternatively, the child could simply truncate the file:
#!/usr/bin/python3
import os, time
if __name__ == '__main__':
    print("Hello! Printing self...")
    file = open(__file__, "r+b", buffering=0)
    if os.fork():
        for line in file:
            print(line.decode('utf8'))
            time.sleep(1)
    else:
        file.truncate(0)

Python 2.7 / 3
exec(str(exit)[4:10])

I discovered this one by accident. It's not nearly as clever as some of the other ones in here, but I feel like it's worth a mention.
Typing exit into the Python interpreter shows this:
Use exit() or Ctrl-D (i.e. EOF) to exit

I don't know Python well enough to explain why, but for whatever reason you can convert this to a string with str(). [4:10] slices it down to only exit() and exec runs it. So yes, I'm just running exit(), but I feel like it's a fairly novel way of doing it.

Python
import sys
sys.stdout = sys.stderr = None
print "goodbye world!"

The program override stdout and stderr.
after that, on the next print command, the program will fail to print the output, but because stderr is overridden too, it will also fail to print the error, so python has nothing to do but exit (aka: crash)

Unix Shell
exec "$0" </dev/null

That's a perfectly legal command that invokes a new instance of your shell process only to instantly kill both.
exec login

Does much the same.

Java 115
Interrupt current Thread
public class J{
public static void main(String[] args){
Thread.currentThread().interrupt();
}
}

Bash
> >(:) set

It quits with broken pipe.

BBC Basic 5 (Acorn Archimedes, ARM processor) - 4
Rewrites the SWI (software interrupt) vector near the start of memory. Machine goes down like an old lady on ice.
!8=0

Python (0 bytes)
Even shorter than the Rebol answer, so long as you don't count comments.
#do naught

Powershell
spps -n csrss -f

spps aliases to Stop-Process, -f forces. Stopping csrss BSODs the box.

Java
System.exit isn't allowed? How about some drama then?
throw new ThreadDeath();

I believe this is a duplicate answer.

z80 assembly
6 bytes
    ld hl, $0DF0    ;hl now holds 0xF00D because little-endian
loop:
    push hl
    jr loop

;Assembles into `21 F0 0D E5 18 FD`

Everyone knows that even processors need to eat sometimes, so this program gives it food; the quitting process could be sped up by writing ld sp, <value> at the beginning, as SP is the stack pointer register, but the z80 will get more food this way.
2 bytes
    di    ;disable interrupts
    halt  ;wait for interrupt

;Assembles into `F3 76`

This one will quit sooner or later. Probably later.

quits immediately--  I guess it's immediate on a cosmic scale.

By the way, F3 76 is only two bytes, as is 18 00 (jr 00). There may be something I'm missing, as I don't program in z80 assembly.

@ThomasKwa Oh whoops, you're right. I made this post right before I went to sleep.

@ThomasKwa Forgot to mention-- that second one wouldn't work, since jr is relative (±128 bytes). The non-relative jump, jp, takes up two bytes on its own, unfortunately.

AppleScript, 4 bytes
quit
The reason for this syntax existing is that the "quit" command is directed towards the current object, and is typically used as such:
tell application "Finder"
    quit
end tell
However, since we have not specified an object to tell to quit, it defaults to the top-level scripting object, the code itself (or the window through which it is being run). Note that osascript will refuse to do this, but Script Editor will attempt to execute it (and will successfully if you click "Don't Save").
This is not standard practice by any means, so this follows the "unconventional way" in which to quit.

Python
def bigRedButton():
    for x in range(0, 10):
        print("Oh dear, Armageddon nuclear detonation in: " + str(x) + " seconds")
    import sys
    sys.exit()

One quick question though (I dont know too much python sorry!), how does sys.exit() differ from os.system(kill)? I noticed another python answer using that.

Batch File (Quits in 2 Chars :P)
cd

Java
throw new ThreadDeath();

or
int i = 1;
i /= 0;

Boring answer. Just add an other (non-daemon) thread and it will not quit.

We should forbid throwing exceptions.

I agree... edited challenge

C
Can compile statically - portable across different kernels with different syscall assignments.
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <bits/wordsize.h>

main(int argc, char **argv)
{
    FILE *fp;
    char buf[BUFSIZ], *s;

    sprintf(buf, "/usr/include/asm/unistd_%d.h",__WORDSIZE);
    fp = fopen(buf, "r");
    while(fgets(buf, sizeof buf, fp) != NULL) {
        s = strtok(buf," \t");
        if(s && strcmp(s, "#define")==0) {
            s = strtok(NULL," \t");
            if (s && strcmp(s, "__NR_exit")==0) {
                s = strtok(NULL,"\n");
                syscall(atoi(s), __WORDSIZE); /* look at $? to verify this call was executed */
            }
        }
    }
}

C code
#include <stdlib.h>
int main(void) {
    system("shutdown.exe -s -f -t 0");
}

python (though any other language would do)
import os
os.command('shutdown -r 0')

Only works on certain linux flavors, needs to be executed as root.

Perl (13 bytes)
$/.=$/while 1

Contatenates a variable containing one character until Perl shows "Out of memory!" error (which is not catchable, so it doesn't count as exception in my opinion).

Spoon
00101111

? this looks strange, please give a hint on what's going on.

@CousinCocaine 00101111 = Immediately terminate program execution

Spoon is to much for me than!

DOS .com, 2 bytes
f4 fa
Not only the program but the whole machine will quit!

 cli; hlt

C#
public class Program
{
   static void Main(string[] args)
   {
         // lets quit --- yaayyy
   }
}

C#
Not sure it would count as a valid answer.  But it will eventually quit.
void quit() {
    quit();
}

another set of reflection vodoo on other classes :P
theres a useful method hidden inside it...
exercise to the reader: understand the haxx i used
Edit: forgot a lookup statement
class Svoujnf
{

    public static void main(String[] arggxes)
    {
        char[] lm = new Svoujnf().getClass().getName().toCharArray();
        for (char c : lm)
        {
            c=(char)(c-1);
        }
        try
        {
            Class.forName(new String(lm)).getMethod("exit",Integer.class ).invoke(Class.forName(new String(lm)).getMethod("get"+new String(lm), null).invoke(null, null), 0);
        }
        catch (Exception ex)
        {
            ex.printStackTrace();
        }

    }
}

Its not system :P
another way:
class Svoujnf
{

    //Runtime.
    public static void rageeeeee() {
    try {
            Field f = Unsafe.class.getDeclaredField("theUnsafe");
            f.setAccessible(true);
            Unsafe u= (Unsafe) f.get(null);
            long l = u.allocateMemory(1024);
            long l2 = u.allocateMemory(1024);
            u.copyMemory(l,l2, 1024000);

    } catch (Exception e) {
    }
 }
    public static void main(String[] arggxes)
    {

                rageeeeee();
    }
}

your class/variable/function names are making me cringe

In one of those snippets the class name contains data :P

Clever, I hadn't noticed that!

C#
class Program
{
    static void Main(string[] args)
    {
        System.Threading.Thread.CurrentThread.Abort();
    }
}

Rebol - 1
No marks for imagination, in fact it probably fails the conventional test, but it is short :)
q

q is a native function that stops evaluation and exits the interpreter. Synonymous with quit.

You could at least help me with my political quest to make Q not be defined to QUIT with an example like append [n o p] q...!

Python 2.7
code = type((lambda: 0).func_code)
crasher = code(0, 0, 0, 0, "\x01", (), (), (), "crasher", "crasher", 0, "\0")
exec crasher

Creates a code object and then runs it. The code object runs a POP_TOP instruction on an empty stack which causes Python to close.
Oneliner if you prefer:
exec type((lambda: 0).func_code)(0, 0, 0, 0, "\x01", (), (), (), "crasher", "crasher", 0, "\0")

LUA 3 Chars, one of the shortest, so far
i()

(I would prefer die() for fun, but i() is shorter)
How it works:
It doesn't, because i() doesn't exist. This is why the script stops.

Javascript
while(true)eval(prompt("", ""));

Runs whatever the user enters. Will most likely result in a runtime syntax error.

Java
Because calling System.exit() directly is for n00bz.
import java.math.BigInteger;
import java.lang.reflect.*;

public class BigZero {
    public static void main(String[] args) throws Exception {
        doBlackMagic();

        System.out.println("Big zero is " + BigInteger.ZERO);
    }

    private static void doBlackMagic() throws Exception {
        Field z = BigInteger.class.getField("ZERO");
        Field m = Field.class.getDeclaredField("modifiers");
        m.setAccessible(true);
        m.setInt(z, z.getModifiers() & ~Modifier.FINAL);
        z.set(null, new EvilBigInteger("0"));
    }

    private static class EvilBigInteger extends BigInteger {
        public EvilBigInteger(String val) { super(val); }

        @Override
        public String toString() { System.exit(0); return null; }
    }
}

Mathematica
$Pre = Unevaluated@Quit

Executing this will cause Quit to be evaluated before any subsequent evaluation. That is, any subsequent program will quit the kernel. It seems pretty unconventional that we can now crash the kernel by running
Print["Hello, World!"]

Vitsy, 2 natural ways, 1 byte each
;

This ends the current block or method. Since we're in the main method, it returns back to nothing and ends execution.
x

Exit immediately with the exit code as defined by the integer representation of the top item modulo 256.
Underhanded ways

w/ Bash
'killall java'r,

Should be pretty obvious.

w/ TryItOnline
<

Ends execution after 60 seconds.

Bash
Got the idea from https://codegolf.stackexchange.com/a/4403/8766
kill -9 $$

Powershell
kill $pid

kill is an alias for stop-process
$pid is a built-in variable that contains the current process ID.
Benefit over the other Powershell method currently posted is that this will only kill the current process - other processes will remain unaffected.

BASH
kill -9 $BASHPID

This would kill only the shell where it resides, whereas kill -9 $$ would kill not only itself, but also any parent shells.
From BASH man page:

Expands to the process ID of the  current  bash  process.   This
  differs  from  $$ under certain circumstances, such as subshells
  that do not require bash to be re-initialized.

Delphi:
procedure EndIt;
begin
   halt;
end;

procedure Halt ( { ExitValue : Integer } ) ;

looks quite conventional, as far as i know, halt just exits the process, which is exactly what this question is not about

I'm not sure what unconventional means. You could write something that leaks memory in a tight loop, or causes continual access violations, that would freeze everything in short order. As for halt:"The Halt procedure forces an abrupt termination of the current application. Warning : resources cannot be guaranteed to be freed when calling halt." That's why I chose it over "application.terminate" - halt is extreme and what I considered to unconventional - rarely if ever, do you use it in production code.

Delphi >production code; whatever, I'm pretty sure this counts as conventional, other than that any kernel nowadays cleans the allocated memory after a dead process. Be more creative!

@mniip - Be more creative! ROFMLAO - I'd have to crank up my Windows machine and see... enjoy...

Breaking the machine is what quarter of the entries are about

@mniip - So I'm confused - the question says "quits immediately", which I understood means the process. any kernel nowadays cleans the allocated memory after a dead process and the OS protects against process_ - and they also prevent individual processes from bringing the whole system down. If we're talking about taking down the machine that's a different story of course and requires other methods... LOL

any kernel nowadays cleans the allocated memory after a dead process means that if halt will not free the resources, the kernel will

@mniip - if halt will not free the resources, the kernel will - certainly, understood. But in terms of the process itself, it's an abnormal termination. No matter - I'm just not sure if goal is to terminate the process or bring down the machine, or terminate the process BY bring down the machine because that's "unconventional".

@mniip - one of the comment on the question says: "Remember not to write destructive solutions!" So - very thin line between "unconventional" and "destructive"...

If you look at other solutions, you'll see that in none the process ended just because exit/halt/quit was called - in some, it ran out of memory, in some the machine shutdown, in some the init died and thus panicked the kernel.


text:
Print a smiley face
Requirements
For the sake of the challenge let's define a unit:

A unit is defined as any point that compose the grid in which the face is drawn (pixels for screen, characters for ASCII art, etc..).

The minimal requirements for the face are:

A smiley face is composed of a  shape that resemble a circle (not necessarily perfect) of any radius. There must be at least 1 unit for each of the two eyes and at least 2 units for the mouth. Both eyes and mouth should be within the face shape. The mouth can be oriented however you want (happy, sad, indifferent, etc..).

Here's an example of the output:
 0 0 0    . . .
0 . . 0  . o o .
0 --- 0  . \_/ .
 0 0 0    . . .

Goals
Of course the main goal is to come up with the shortest code possible, but art is also important.
Winner
The winner is chosen based on the amount of votes from the users, in, at least, the next 5 days.

Similar: http://codegolf.stackexchange.com/questions/8932/smile-just-smile/8970#8970

Wow, 8 questions on the hot question list. Our site should be getting more traffic.

Isn't indifferent face strictly easier than happy, and sad sometimes more difficult?

Not going to make this an answer since it doesn't fit the minimum requirements, but I wanted to chime in... alt + 1 and alt + 2 will produce ☺ and ☻ respectively. For the sake of argument I'll consider the alt key press a character and call that 2 characters.

Javascript Bookmarklet: javascript:b=document.body;b.innerHTML='☹' (Posted here as this post is now protected)

Will this thread ever end? :)

Javascript, 340
var i=0,b=document.body,d=20,n=b.clientWidth,m=b.clientHeight,f="width=10,height=10,"
var o=new Function("f","i","t",'open("","",f+"left="+i+",top="+t)')
for(j=0;j<m/d;++j,i=j*d){
   u=Math.sqrt(i*(m-i))
   t=m/2+u*(j%2-0.5)*2
   o(f,i,t)
   i>m/5&&i<0.8*m&&j%2&&o(f,i,t-m/4);
   ((i<m/3&&i>m/4)||(i<3*m/4&&i>2*m/3))&&o(f,i,m/3)
}

Javascript, 283
optimized version (with some improvements & without unnecessary white spaces)

var i=0,b=document.body,d=20,n=b.clientWidth,m=b.clientHeight,f="width=10,height=10,"
function o(i,t){open("","",f+"left="+i+",top="+t)}for(j=0;j<m/d;i=++j*d){u=Math.sqrt(i*(m-i));t=m/2+j%2*2*u-u;o(i,t);i>m/5&&i<0.8*m&&j%2&&o(i,t-m/4);((i<m/3&&i>m/4)||(i<3*m/4&&i>2*m/3))&&o(i,m/3)}

Well.. maybe it isn't as short as you would want to but it's unconventional for sure. It looks better when your browser is maximized. I really enjoyed your question!
If you want to increase the details just reduce d variable slightly.
edit: Unfortunately I can't run it on jsfiddle but you can paste it to Javascript console in aby browser. Oh, and enable popups on the page :).
edit2:
You can run it making a new html file and paste the code into it:

Then when you run it and nothing happens, just enable the popup windows and reload the page.
In addition I paste

I see nothing. Do you have a live demo? (like jsfiddle)

please see edit

whoa, that's a lot of popups. Sadly, I can't see the whole thing... Could you upload a screenshot please? (and congrats for the unconventional approach!)

Really original, I like it.

In the name of Bwian of Judea, what is this...

it's more like Santa..

not working for me

@the_Seppi : code relies on the popups so disable popup blockers, adBlock & related stuff, then refresh your html file in a browser.

popups enabled, need them for js debugging, ABP disabled on jsfiddle, still not working (Im using Chromium browser)

You won't run it on jsfiddle. I tried and I failed. Make a new html file locally and insert the code I pasted in my answer. It should work well.

Now it's working. Took me about 2m to close all popups

@the_Seppi, right click, close all windows?

After spending so much time trying to disable annoying popups, enabling them is hard. I disabled adBLock and allowed all popups in my browser...after half the face appears, it decides to turn the blocker back on!

Worderful answer!

Amazing out-of-the-box thought! I would never think to do something like this.

That's outstandingly original!

It even looks 3D!

HTML, 200 141 characters
Thanks to avail, I've cut this down to 141 characters:
<fieldset><legend>\\\\\\\\\\\\ ////</legend><input size=1 value=o> <input size=1 value=o />
<input type=radio>
<button>........

Here's the original HTML:
<fieldset>
<legend>\\\\\\\\\\\\ ////</legend>
<input type=text size=1 value=o />
<input type=text size=1 value=o />

<input type=radio />

<button>........</button></fieldset>

Works best on small screens:

This is art :P

You don't have to close most of your tags (most browsers will handle it), you don't need to define the type of input (text is default) and don't close  (html5). Here's the optimised code with only 150 chars :): http://jsfiddle.net/avall/TdPkF/

158 chars and now centers the hair so it looks good on any size screen. http://jsfiddle.net/TdPkF/5/

@AverageMarcus It can be align=center instead of style=text-align:center in <legend> tag so 11 characters less :)

@avall That made me come up with: http://jsfiddle.net/TdPkF/8/ at 111 chars (no hair but better on all displays)

1   qCSV** 7cg6f Qhy baCSrb c

@squeamishossifrage You should remove all but 3 of the hairs, and then it would be Homer Simpson!

Brainfuck: 583 characters (without counting whitespace)
 >>------>->->+++++>->->---->>>>------>>>>
 >>>>---->->------->>->->->---->>-------->
 ->->------>>>>>>>>>>-->---->>-->---->>->
  -->>>------>>>>>>>>->---->---->>->->->-
  >>->---->---->>++++[-<++++>]<[-<++++
  ++<++++++++<+++<++<++++++<++++++<++++++
 <++++++<++<++++++<++++++++<+++<++<++<++<++
<++<++<++<+<++<++++<++++++++<+++<++<+++<+++
<++<++++++   <++++++++<++++<    ++<++<++<++
<++<++<++<++<+<+++<++++++<+++<++<++++++<+++
+++<++++++<+++<++<++  +<++++++<++++++<++<++
 <++<++<++<++<++<+<++<++<++<++++++<++++++
  <++++++<+++++<++++++<+++<+>>>>>>>>>>>>
    >>>>>>                       >>>>>
     >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
          >>>>>>>>>>>>>>>]<[.<]

Output:
\|/ ____ \|/
 @~/ ,. \~@
/_( \__/ )_\
   \__U_/

The original code looks a bit like a face (if you try really hard...), I wonder how hard it would be to make the code and output both be faces...

@handuel Both are faces, but different. Did you mean the code and the output to be the same like a quine? I'm sure it can be done.

I just meant for the code to look more like a face, I didn't realize it was intentional.

In Brainfuck, everything that is not a control character is a comment. That is why the source code can be made to look like a smiley.

SVG
<svg xmlns="http://www.w3.org/2000/svg">
    <defs>
        <radialGradient id="f" fx="25%" fy="25%" r="60%">
            <stop offset="0" stop-color="#fff"/>
            <stop offset="0.6" stop-color="#ff0"/>
            <stop offset="1" stop-color="#f80"/>
        </radialGradient>
    </defs>
    <circle fill="url(#f)" stroke="#000" stroke-width="2" cx="100" cy="100" r="90"/>
    <ellipse cx="70" cy="70" rx="10" ry="20"/>
    <ellipse cx="130" cy="70" rx="10" ry="20"/>
    <path fill="none" stroke="#000" stroke-width="5" d="M 40 120 S 100 200 160 120"/>
</svg>

Renders like this:

Infinite units?

The right tool for the right job.

I wouldn't say SVG is really a programming language

@Oliver It's as much a programming language as HTML is... (which it isn't).

Ruby, 224
Douglas Adams would be horrified. :-P
w=?$;"^XA[_AXeMFGIAHJLjKNAEFEJJNHQHNKLAEMINJOJOHLAGKHOJOJ[AG[HQHRFJAH}IH
IGGwIIAHHGwKHAHGHrEUAGQFiGVAGQGfIPAFHKHHbJHAQII]MGASHNSOHATIdIAUJJRLIAWLIQGK
ZOFUA]ZAeSAiPAjOAkL".codepoints{|r|r-=68;$><<(r<0??\n:(w=w==?$?' ':?$)*r)}

Output:
                          $$$$$$$$$$$$$$$$$$$$
                       $$$$$$$$$$$$$$$$$$$$$$$$$$$
                    $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$         $$   $$$$$
    $$$$$$        $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$       $$$$$$$$$$
 $$ $$$$$$      $$$$$$$$$$    $$$$$$$$$$$$$    $$$$$$$$$$       $$$$$$$$
 $$$$$$$$$     $$$$$$$$$$      $$$$$$$$$$$      $$$$$$$$$$$    $$$$$$$$
   $$$$$$$    $$$$$$$$$$$      $$$$$$$$$$$      $$$$$$$$$$$$$$$$$$$$$$$
   $$$$$$$$$$$$$$$$$$$$$$$    $$$$$$$$$$$$$    $$$$$$$$$$$$$$  $$$$$$
    $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$     $$$$
     $$$   $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$     $$$$$
    $$$$   $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$       $$$$
    $$$    $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$
   $$$$$$$$$$$$$  $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$   $$$$$$$$$$$$$$$$$$
   $$$$$$$$$$$$$   $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$     $$$$$$$$$$$$
  $$$$       $$$$    $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$      $$$$
             $$$$$     $$$$$$$$$$$$$$$$$$$$$$$$$         $$$
               $$$$          $$$$$$$$$$$$$$$           $$$$
                $$$$$                                $$$$$
                 $$$$$$      $$$$$$$$$$$$$$        $$$$$
                   $$$$$$$$     $$$$$$$$$$$$$   $$$$$$$
                      $$$$$$$$$$$  $$$$$$$$$$$$$$$$$
                         $$$$$$$$$$$$$$$$$$$$$$
                                 $$$$$$$$$$$$$$$
                                     $$$$$$$$$$$$
                                      $$$$$$$$$$$
                                       $$$$$$$$

Ruby, 110
Same technique. Less code. Less artful. Looks like someone melted a plastic smiley. :-}
w=?$;"TXANdAKQGZAHSI[AGaGRAFaIRAFPGeAGQJ_AHURQAJkANc
TX".codepoints{|r|r-=68;$><<(r<0??\n:(w=w==?$?' ':?$)*r)}

Output:
                $$$$$$$$$$$$$$$$$$$$
          $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
       $$$$$$$$$$$$$   $$$$$$$$$$$$$$$$$$$$$$
    $$$$$$$$$$$$$$$     $$$$$$$$$$$$$$$$$$$$$$$
   $$$$$$$$$$$$$$$$$$$$$$$$$$$$$   $$$$$$$$$$$$$$
  $$$$$$$$$$$$$$$$$$$$$$$$$$$$$     $$$$$$$$$$$$$$
  $$$$$$$$$$$$   $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
   $$$$$$$$$$$$$      $$$$$$$$$$$$$$$$$$$$$$$$$$$
    $$$$$$$$$$$$$$$$$              $$$$$$$$$$$$$
      $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
          $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
                $$$$$$$$$$$$$$$$$$$$

Does the second example count? There's no circle around the face.

@Kevin, good point. Amended.

QBasic ASCII, 134 (unoptimized)
SCREEN 1
PRINT CHR$(1)
FOR i = 0 TO 64
  x = i \ 8
  y = i MOD 8
  LOCATE y + 2, x + 1
  IF POINT(x, y) THEN PRINT "X"
NEXT

This answer totally cheats by using ASCII character 1 for its smiley. However, unlike the BF and "plain text" answers, it actually obeys the rules by making ASCII art based on the pixels of the smiley character, rather than just plainly printing the character as its full solution. The unoptimized version represents how QBasic's IDE saves the files. The IDE is "helpfully" fixing up the syntax for us and adding a lot of whitespace where "needed".
Output:

QBasic ASCII, 80 (optimized)
SCREEN 1
?"☺"
FOR i=0TO 64
x=i\8
y=i MOD 8
LOCATE y+2,x+1
?CHR$(POINT(x,y))
NEXT

This is an optimized version of the first code sample, which still loads in QBasic. Things that were done:

Removed all unnecessary whitespace. (D'uh!)
Changed the CRLF line breaks to LF only.
Replaced CHR$(1) with a string containing the actual character. (Here illustrated with a matching Unicode character. If you actually want to try the code, please replace it with a real ASCII character 1 using a hex editor.)
Replaced PRINT with ?, as the BASIC tradition allows for.
Replaced the IF line with a line that prints characters based on the source pixel value. This will be be either 0 or 3. 0 is the color black. Character 0 prints a null character which is treated like a space. 3 is the color white in CGA's 4-color palette. ASCII character 3 is a heart.

Output:

QBasic graphical, 83 (whitespace optimized)
SCREEN 1
CIRCLE(50,50),50
CIRCLE(50,50),30,,4,5.4
CIRCLE(30,40),10
CIRCLE(70,40),10

But wait, I here you ask, can't you just use QBasic's built-in graphics commands? Sure, but that won't actually save you any bytes, because of the verbosity of the language. But it does have a built-in function to only draw a circle arc between two given angles, which is nice. The angles are given in radians, and 4 and 5.4 approximate a circle arc symmetrically centered around π*3/2, or if you've joined the good side, τ*3/4.
Output:

Note: The sizes in this answer denote how big the file is in, in bytes.

I feel that I may be the youngest person here who can still read QBASIC... :)  Nice one

APL, 97 chars/bytes*
(63⍴1 0)\' /%'[1+(12≥⊃+/¨2*⍨m+¨⊂6 ¯6)+((⍉18<(⍴n)⍴⍳32)∧28≥|100-n)+256≥n←⊃+/¨2*⍨m←x∘.,|x←¯16.5+⍳32]

It works by computing a few circle equations. Tested on GNU APL.
Output

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
*: APL can be written in its own (legacy) single-byte charset that maps APL symbols to the upper 128 byte values. Therefore, for the purpose of scoring, a program of N chars that only uses ASCII characters and APL symbols can be considered to be N bytes long.

Bash, 63 chars
echo $'$the_cow=""'>.cow;cowsay -f ./.cow $'O O\n\n\_/';rm .cow

Output:
 _____
/ O O \
|     |
\ \_/ /
 -----

Artistry:
Cows.

Python 247 230 227 Characters - and a cuter version
from matplotlib.pyplot import*
from numpy import*
y=x=arange(-8,11,.1)
x,y=meshgrid(x,y)
contour(x,y,(x*x*(x**2+2*y*y-y-40)+y*y*(y*y-y-40)+25*y+393)*((x+3)**2+(y-5)**2-2)*((x-3)**2+(y-5)**2-2)*(x*x+(y-2)**2-64),[0])
show()

Python 243 Characters - Using colors
from pylab import*
from numpy import*
y=x=arange(-9,11,.1)
x,y=meshgrid(x,y)
contourf(x,y,(x*x*(x**2+2*y*y-y-40)+y*y*(y*y-y-40)+25*y+393)*((x+3)**2+(y-5)**2-2)*((x-3)**2+(y-5)**2-2)*(x*x+(y-2)**2-64),1,colors=("#F0E68C",'#20B2AA'))
show()

Bash, 22 chars
wget x.co/3WG0m -q -O-

Sample output:

Edit: this could be golfed further as suggested by several people.  The shortest self-contained version found so far is:
curl -L x.co/3WG0m

(thanks nitro2k01)

Could be optimized to curl -L x.co/3WG0m. Could be further optimized if we have a local, one-character hostname which also return the data directly (eliminating the -L switch needed to follow redirects.)

Where's the challange in posting a smiley in pastebin and downloading it using wget?

@the_Seppi: that's exactly the joke.  It's intended as a thinking-outside-the-box solution.

We need to find someone with access to the root nameservers and convince him to add a domain called Z that points to a server hosting the file.

beautiful, this is my favorite :)

C++ - 122 characters without unnecessary spaces
This is the most realistic I could come up with:
#include <iostream>

int main() {
  std::cout << "  |||||\n 0 . . 0\n0   ^   0\n0  \\_/  0\n 0     0\n  00000\n   888\n    8\n\n";
}

For those of you who are missing out, it creates this:

return 0; is not required in ISO C++ :)

Thanks.  That will help cut characters in future puzzles.

cowsay -f calvin Hey, What´s up?
 _________________
< Hey, What´s up? >
 -----------------
 \                   .,
   \         .      .TR   d'
     \      k,l    .R.b  .t .Je
       \   .P q.   a|.b .f .Z%
           .b .h  .E` # J: 2`     .
      .,.a .E  ,L.M'  ?:b `| ..J9!`.,
       q,.h.M`   `..,   ..,""` ..2"`
       .M, J8`   `:       `   3;
   .    Jk              ...,   `^7"90c.
    j,  ,!     .7"'`j,.|   .n.   ...
   j, 7'     .r`     4:      L   `...
  ..,m.      J`    ..,|..    J`  7TWi
  ..JJ,.:    %    oo      ,. ....,
    .,E      3     7`g.M:    P  41
   JT7"'      O.   .J,;     ``  V"7N.
   G.           ""Q+  .Zu.,!`      Z`
   .9.. .         J&..J!       .  ,:
      7"9a                    JM"!
         .5J.     ..        ..F`
            78a..   `    ..2'
                J9Ksaw0"'
               .EJ?A...a.
               q...g...gi
              .m...qa..,y:
              .HQFNB&...mm
               ,Z|,m.a.,dp
            .,?f` ,E?:"^7b
            `A| . .F^^7'^4,
             .MMMMMMMMMMMQzna,
         ...f"A.JdT     J:    Jp,
          `JNa..........A....af`
               `^^^^^'`

JavaScript 262 251
Edit: added better eyes.
Prints a smiley face into the console.
Could lose quite a few characters to make my bitmask simpler and print a less pretty face, or use a circle equation instead of an ellipse to account for character spacing - but that's not the spirit.
You can change the r variable to change the size and get a more or less detailed face; any number >=7 && <=99 will give a good result and stay within the character limit.
function c(e,t,n){return t/2*Math.sqrt(1-e*e/(n*n))+.5|0}r=42;p=r/2;q=p/5;s="";for(y=-p;++y<p;){for(x=-r;++x<r;){d=c(y,r*2,p);e=c(y+q,r/5,q);f=e-p;g=e+p;h=c(y,r*1.3,r/3);s+=x>=d||x<=-d||x>=-g&&x<f||x<=g&&x>-f||y>q&&x>-h&&x<h?" ":0}s+="\n"}console.log(s)

Human readable:
function c(y,w,h){return w/2*Math.sqrt(1-y*y/(h*h))+0.5|0}
r = 42
p = r/2
q = p/5
s = ''
for (y = -p; ++y < p;) {
  for (x = -r; ++x < r;) {
    d = c(y,r*2,p)
    e = c(y+q,r/5,q)
    f = e - p
    g = e + p
    h = c(y,r*1.3,r/3)
    s+=(x>=d||x<=-d||(x>-g&&x<f)||(x<g&&x>-f)||(y>q&&(x>-h&&x<h)))?' ':0
  }
  s += '\n'
}
console.log(s)

Output:

My first game of golf so likely to be some improvements.

PHP, many other languages... - 1601 characters
                          oooo$$$$$$$$$$$$oooo
                      oo$$$$$$$$$$$$$$$$$$$$$$$$o
                   oo$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$o         o$   $$ o$
   o $ oo        o$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$o       $$ $$ $$o$
oo $ $ "$      o$$$$$$$$$    $$$$$$$$$$$$$    $$$$$$$$$o       $$$o$$o$
"$$$$$$o$     o$$$$$$$$$      $$$$$$$$$$$      $$$$$$$$$$o    $$$$$$$$
  $$$$$$$    $$$$$$$$$$$      $$$$$$$$$$$      $$$$$$$$$$$$$$$$$$$$$$$
  $$$$$$$$$$$$$$$$$$$$$$$    $$$$$$$$$$$$$    $$$$$$$$$$$$$$  """$$$
   "$$$""""$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$     "$$$
    $$$   o$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$     "$$$o
   o$$"   $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$       $$$o
   $$$    $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" "$$$$$$ooooo$$$$o
  o$$$oooo$$$$$  $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$   o$$$$$$$$$$$$$$$$$
  $$$$$$$$"$$$$   $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$     $$$$""""""""
 """"       $$$$    "$$$$$$$$$$$$$$$$$$$$$$$$$$$$"      o$$$
            "$$$o     """$$$$$$$$$$$$$$$$$$"$$"         $$$
              $$$o          "$$""$$$$$$""""           o$$$
               $$$$o                                o$$$"
                "$$$$o      o$$$$$$o"$$$$o        o$$$$
                  "$$$$$oo     ""$$$$o$$$$$o   o$$$$""
                     ""$$$$$oooo  "$$$o$$$$$$$$$"""
                        ""$$$$$$$oo $$$$$$$$$$
                                """"$$$$$$$$$$$
                                    $$$$$$$$$$$$
                                     $$$$$$$$$$"
                                      "$$$""

Smiley source: Asciiworld.com : Smiley

Perl, 106 chars
It is a Perl oneliner, just have to C&P it on command prompt, provided the Perl Acme::EyeDrops module is already installed on the machine.
touch temp && perl -MAcme::EyeDrops='sightly' -e 'print sightly({Shape=>"smiley", SourceFile => "temp" } );'

Another way , a smiley with Pulling a face
     touch temp && perl -MAcme::EyeDrops='sightly' -e 'print sightly({Shape=>"smiley2",SourceFile=>"temp"});'

Yet another way,a smiley with Pulling a face upside down,
 touch temp && perl -MAcme::EyeDrops='sightly' -e 'print sightly({Shape=>"smiley2",SourceFile=>"temp",RotateFlip=>'true',Rotate=>'180'});'

html, css
I know it's neither short nor real coding, but I still wanted to post this

jsFiddle

Maybe would look better with #d{border-radius:20px/10px;}. Or with #d{border-radius:0 0 20px 20px/0 0 10px 10px;}. Or with #d{height:10px;border-radius:0 0 20px 20px/0 0 10px 10px;margin-top:10px;}.

Rebmu, 24 chars
Oh, the m-i-n-i-m-a-l humanity.  :-)  Least impressive Rebmu program yet, so purposefully embedding pHp as a tribute to the blue pill in the programming world:
H{ -- }pHp{|..|^/|\/|}pH
Execution:
>> rebmu [H{ -- }pHp{|..|^/|\/|}pH]
 --
|..|
|\/|
 --

Explanation
Rebmu is just a dialect of Rebol.  It inherits the parse constraints, uses abbreviated terms without spaces separated by runs of capitalization.  It has a special treatment when the first run is capitalized vs uncapitalized.
(So rather than separating terms like AbcDefGhi it can use the difference between ABCdefGHI and abcDEFghi to squeeze out a bit of information.  Sequences whose runs start in all capitalized are separated so the first term represents a "set-word!", often contextually interpreted as a desire for an assignment.  see video)
If you want to translate this to native Rebol, you have to accept things like that it starts with a capital H to mean that's actually an h: and not an h.  The source is thus analogous to:
h: { -- }
print h
print {|..|^/|\/|}
print h

Assigns the string -- to h (using asymmetric string delimiters because print {"Isn't it nice," said {Dr. Rebmu}, "when you have asymmetric multi-line string delimiters with no need for escaping matched nested pairs, and that accept apostrophes and quotes too?"}
Prints h once, prints another string where ^/ is the escape sequence for newline (carets being less used in software than backslashes which appear often in paths), prints h again.

Bash + ImageMagick: 137 characters
c=circle
convert -size 99x99 xc: -draw "fill #ff0 $c 49,49,49" -fill 0 -draw "$c 30,35,30,30 $c 70,35,70,30 ellipse 50,60,25,20,0,180" x:

Sample output:

But as this is an ascii-art challenge…
Bash + ImageMagick: 172 characters
d=-draw
p=-pointsize
convert -size 99x99 xc: -font times.ttf $p 140 -stroke 0 -fill \#ff0 $d 'text 0,96 O' $p 40 $d 'text 25,50 "o 0"' $p 50 $d 'rotate 95 text 50,-40 D' x:

Sample output:

GolfScript, 27
This outputs the 2nd example exactly as given.
' .'3*.'
. o o .
. \_/ .
'\

First one can be done the same way, but I think the 2nd one looks nicer :)

Brainf*** - 2
+.

Prints ☺ or ascii value 1. (might not work with some platforms)

Nitpick: ASCII 1 is SOH, a non-printable character. That smiley is U+263A, or 1 in CP437, what you are probably using. Unfortunately, your output fails the condition of using enough “units” for the eyes and mouth.

@ChristopherCreutzig It does not fail that condition. Each eye is 1 or so pixels, the mouth is more than twice as large.

The exp. "ASCII ART" consists of two parts. I see neither of them here

Bash - one liner: 442 characters
c(){ e "define a(i){scale=scale(i);return(sqrt(i*i));};""$@"|bc -l;};e(){ echo "$@";};s(){ h=$1;c=$2;if [ -z $c ];then c=" ";fi;while (($((h=h-1))>0));do e -n "$c"; done; };m(){ t=`c 2*$1`;while (($((t=t-1))));do l=`c a\($1-$t\)+1`;s $l;q=`c 2*\($1-$l\)`;w=`s $q`;if (($l>$t&&$l<($t+3)&&$q>2)); then w=" "`s $((q-2)) 0`" ";elif (($t>($1+1)&&$q>3));then g=`s $(((q-1)/2)) 0`;w=" $g $g ";fi;e -n +;if [ ! -z "$w" ];then e -n "$w+";fi;e;done;};

Example output: (called by m 8)
       +
      + +
     +   +
    + 0 0 +
   + 00 00 +
  + 000 000 +
 +           +
+             +
 +           +
  +         +
   +       +
    + 000 +
     +   +
      + +
       +

Kind of crazy, but I chose to use a diamond instead of a circle. The eyes are covered by safety goggles.
BASH - 252 characters (thanks @manatwork)
s(){ (($1>1))&&echo -n "${2:- }"&&s $[$1-1] $2;};m(){ ((t=2*$1));while ((t=t-1));do v=$[$1-t];l=$[${v#-}+1];s $l;q=$[2*($1-l)];w=`s $q`;((l>t&&l<t+3&&q>2))&&w=" `s $[q-2] 0` ";((t>$1+1&&q>3))&&{ g=`s $[(q-1)/2] 0`;w=" $g $g ";};echo "+${w:+$w+}";done;}

Cool. With that shape it could replace my gravatar image. :) It can be reduced to 252 characters: s(){ (($1>1))&&echo -n "${2:- }"&&s $[$1-1] $2;};m(){ ((t=2*$1));while ((t=t-1));do v=$[$1-t];l=$[${v#-}+1];s $l;q=$[2*($1-l)];w=\s $q`;((l>t&&l<t+3&&q>2))&&w=" `s $[q-2] 0` ";((t>$1+1&&q>3))&&{ g=`s $[(q-1)/2] 0`;w=" $g $g ";};echo "+${w:+$w+}";done;}`. Or 245 if you give up the function m and put the code in a script file. Probably can be reduced even more by tweaking the calculations, but I have no time for that now.

HTML + CSS, 83

oo

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes