Slashdot Mirror


Smallest Possible ELF Executable?

taviso writes "I recently stumbled across this paper (google cache), where the author investigates the smallest possible ELF executable on linux, some interesting stuff, and well worth a read. The author concludes, 'every single byte in this executable file can be accounted for and justified. How many executables have you created lately that you can say that about?'

451 comments

  1. Not good enough by mesocyclone · · Score: 5, Funny

    It isn't amazing until its also palindromic!

    --

    The only good weather is bad weather.

    1. Re:Not good enough by Anonymous Coward · · Score: 5, Funny

      aibohphobia-the fear of palindromes. get it?

    2. Re:Not good enough by mesocyclone · · Score: 1, Troll

      Mod that guy up!

      I love it.

      To quote him again: "aibohphobia-the fear of palindromes. get it?"

      --

      The only good weather is bad weather.

    3. Re:Not good enough by red_dragon · · Score: 5, Funny

      Weird... I read that as "aibophobia", and thought it was the fear of electronic pets.

      --
      In Soviet Russia, Jesus asks: "What Would You Do?"
    4. Re:Not good enough by Anonymous Coward · · Score: 0

      I still think he should have returned a 45 instead of 42. Would have made for better reading and at the end he could have said, "Thus, our program returns it's smallest size"

    5. Re:Not good enough by Anonymous Coward · · Score: 0

      It's a hitchhikers guide to the universe reference.

  2. smallest elf execution by Anonymous Coward · · Score: 5, Funny

    I just heard the news on slashdot -- Frodo Baggins, the smallest elf, was just executed! No other details were available.

    1. Re:smallest elf execution by kevcol · · Score: 0, Offtopic

      No wonder you were modded down:

      Bilbo is a hobbit.

    2. Re: smallest elf execution by Black+Parrot · · Score: 5, Funny


      > I just heard the news on slashdot -- Frodo Baggins, the smallest elf, was just executed! No other details were available.

      In my own research I have discovered that the average Hobbit executable is barely half the size of the average Elf executable.

      They're faster to run in a tight spot, too!

      --
      Sheesh, evil *and* a jerk. -- Jade
    3. Re:smallest elf execution by mbogosian · · Score: 5, Funny

      Frodo Baggins, the smallest elf, was just executed!

      Unfortunately, the article was incorrect then. Frodo is a hobbit. Furthermore, he is far from the smallest hobbit.

      However, he was executed. By two elves. By way of trampling.

      Does that mean we can assume that ELF binaries run on Hobbits?

      (Sorry, I couldn't resist.)

    4. Re:smallest elf execution by skaffen42 · · Score: 2, Funny

      I'm confused. Is this a troll or not?

      --
      People couldn't type. We realized: Death would eventually take care of this.
    5. Re:smallest elf execution by mbogosian · · Score: 5, Funny

      I'm confused. Is this a troll or not?

      No. Trolls are completely different creatures from hobbits and elves.

    6. Re:smallest elf execution by cosyne · · Score: 1

      Unfortunately, the article was incorrect then.

      You should be used to that by now....

    7. Re:smallest elf execution by Isle · · Score: 2

      I thought he was made honourary elf like Bilbo.

  3. No law on repeat articles? by ebuck · · Score: 4, Interesting

    Last time I read this on slash dot was less than a year ago. I imagine in 4 or 5 months we'll see it again.

    The article is great. It really is a good intro to refresh that assembly / understand ELF / do neat stuff. I still have the tiny assembler installed on my machine from the last go round.

    I've heard of a guy who is trying to make the world's smallest 'cat' program. I wonder how many other utilities have been similiarly "optimized"

    1. Re:No law on repeat articles? by Anonymous Coward · · Score: 0

      i cant see it been post before - post a link.

    2. Re:No law on repeat articles? by vikasgp · · Score: 1

      The article is ofcourse very good. Infact, anything written by that guy is good. But, I'm surprised. People didn't know about this ? The article was written on July 2, 1999. There are many references to it on the net. I thought /. was a news site ?

  4. Turbo Pascal by DNS-and-BIND · · Score: 2, Interesting

    I seem to remember making some damn small Turbo Pascal .COM files. Under 4096 bytes, IIRC.

    --
    Shutting down free speech with violence isn't fighting fascism. It IS fascism!
    1. Re:Turbo Pascal by compwizrd · · Score: 5, Interesting

      Some of the old-time Demo groups (and warez groups) would put very nice VGA demos in 4k as well.

    2. Re:Turbo Pascal by dknj · · Score: 3, Interesting

      They still do pack some nice effects into 40k windows binaries now.. I'm still amazed

      -dk

    3. Re:Turbo Pascal by Anonymous Coward · · Score: 0

      4K? That's HUGE. This is in 50odd bytes or so.

    4. Re:Turbo Pascal by Anonymous Coward · · Score: 0

      http://www.theproduct.de has some very nice "videos" squeezed into 64 KB Windows executables. I haven't watched an entire video, but they're reported to be around 15 minutes each.

    5. Re:Turbo Pascal by irc.goatse.cx+troll · · Score: 3, Interesting

      40k? luxury!
      try 256 bytes ;)

      --
      Pain lasts, kid. Its how you know you're alive. Sometimes I think this growing up thing is just pain management-TheMaxx
    6. Re:Turbo Pascal by cvore · · Score: 5, Informative

      A dos .com file does not have a lower limit. .COM files are without headers, so having a realy tiny .com file is not very hard ;) It sais more about the crap turbo pascal puts in the .com file.. a .com file that returns correctly can just have one byte in it: 0xc3 (RET)

    7. Re:Turbo Pascal by Anonymous Coward · · Score: 3, Informative

      - I seem to remember making some damn small Turbo Pascal .COM files. Under 4096 bytes, IIRC.

      The Amiga E language (sort of a Pascal+C+whatever like beast) compiler stuffed a hello world program in 80 bytes or so. Pure executable, no external libraries needed.
      The author's list of self-designed languages is definitely worth a look.

    8. Re:Turbo Pascal by p3d0 · · Score: 2

      4k is "damn small"? Methinks you have not read the article. He ended up with a 45-byte executable.

      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
    9. Re:Turbo Pascal by asobala · · Score: 1

      You were lucky. When I was young, we had to write a utility that could open, recompile and optimise itself in 4 bytes of code.

    10. Re:Turbo Pascal by Al+Al+Cool+J · · Score: 1

      Back in the days of my 486, I even wrote a single-byte DOS program that was functional: reboot.com I leave it to the reader to figure out what it did :-)

    11. Re:Turbo Pascal by phiwum · · Score: 1
      A dos .com file does not have a lower limit.

      You can't fool me. Since the set

      {n in Z| there is a .com program of size n}

      is a subset of the natural numbers, and the natural numbers are well-ordered, there is a least element of this set. In fact, you indicated that the least such n is 1.

      And people laughed at me for studying logic and philosophy in order to do computer science. Who's laughing now?

      --
      Phiwum's law: anyone that names an obvious law after himself and then puts it in his own sig is just pathetic.
    12. Re:Turbo Pascal by Anonymous Coward · · Score: 0

      I guess I'm laughing a little because you think that being able to outsmart someone in a comment on slashdot is justification for your education.

    13. Re:Turbo Pascal by Pointer80 · · Score: 1

      It was in interupt call to 19h, IIRC.
      I wrote a little password program with Quick C (*shudder*) using inline asm back in the day.
      It would reboot the machine if you entered the wrong password.

      --
      [%- PROCESS life -%]
    14. Re:Turbo Pascal by Anonymous Coward · · Score: 0

      > > A dos .com file does not have a lower limit.
      > ... In fact, you indicated that the least such n is 1.

      Not really. The *size* of a .com file may have a lower limit, but there's no limit to how low a .com file can go. Windows was written as a .com, so you can see it can get pretty low.

    15. Re:Turbo Pascal by Anonymous Coward · · Score: 0

      hmm. wasn't int19 2 bytes (CD19) and rather unsafe compared to JMP FFFF:0000 ito interrupt handlers not being cleared or am I missing something?

    16. Re:Turbo Pascal by taliver · · Score: 3, Funny

      4 bytes! My family would dream of 4 bytes. We had to get up in the morning, defrag the file system, decrypt RSA-65 for 23 hours and then go back to the boot sector where we would be erased. And we had to do it all in 4 bits of space!

      4 bytes. Hmph.

      --

      I demand a million helicopters and a DOLLAR!

    17. Re:Turbo Pascal by Al+Al+Cool+J · · Score: 1
      You're right, it was 2 bytes. The program is still sitting in my old dos partition, dated January 6, 1994.

      And I never said it was safe. I wish I could remember more about why I did it that way, but unfortunately the source code is not well documented :-)

    18. Re:Turbo Pascal by cvore · · Score: 1

      No: A .com file can be empty.. So there ;) (It wont return correcty though, but its a correct .COM file.)

    19. Re:Turbo Pascal by phiwum · · Score: 1

      Okay, so a .com file can be empty. That's still a limit.

      I'll be impressed if you show that there is a .com file with length strictly less than zero. Mightily impressed, in fact.

      --
      Phiwum's law: anyone that names an obvious law after himself and then puts it in his own sig is just pathetic.
    20. Re:Turbo Pascal by Anonymous Coward · · Score: 0

      It works, that's why :-)

    21. Re:Turbo Pascal by Anonymous Coward · · Score: 0

      Perhaps, but how many gigabytes of internet traffic did you just use explaining that? :-)

    22. Re:Turbo Pascal by Sir+Tristam · · Score: 2
      Right! Our programs had to finish in the morning, at ten o'clock at night, half an hour before they were submitted, solve NP-complete problems, leave more memory free than the computer had, and when we'd go to the computer room the operator would kill us and dance around on our graves, singing Hallelujah!

      And you try and tell the young people of today that, and they won't believe you!

    23. Re:Turbo Pascal by iamacat · · Score: 1

      You mean, there are no 1-byte illegal instructions on 8086 that would cause a reboot. Hmm...

  5. google cache by IIRCAFAIKIANAL · · Score: 1

    I was gonna post the google cache and make a lame joke, but fuck it, that's just not funny.

    In any case, it is very cool too see a google cache link in the article brief - let's see more of that! :)

    --
    Robots are everywhere, and they eat old people's medicine for fuel.
  6. Largest? by Trusty+Penfold · · Score: 0, Flamebait



    What's the largest? Windows.exe?

    1. Re:Largest? by tomstdenis · · Score: 1

      hahaha funny. Did you think of that yourself?

      Tom

      --
      Someday, I'll have a real sig.
    2. Re:Largest? by FreeLinux · · Score: 2

      WIN2KSP3.exe 124.68MB
      GW6SP2M.EXE 302.10MB
      Favorite_ISO.zip.exe 700MB

    3. Re:Largest? by Trusty+Penfold · · Score: 1

      Donation drives for the Heart and Lung Association

      "Just lie back, this won't hurt. When it's done you can have a cup of tea and a biscuit and then go home. Don't do any strenuous exercise or fall in love for the next 24 hours."

    4. Re:Largest? by Anonymous Coward · · Score: 0

      My windows 'distribution' doesn't include a file called windows.exe. What are you, an idiot?

  7. the question is by Anonymous Coward · · Score: 0

    is it as efficient as the linux kernel? every byte in there is so efficient because it was made by linus torvaldos

  8. You disgust me... by tuxedo-steve · · Score: 5, Funny

    ... wanting to execute the smallest possible elf. You Americans and your bloodsports. Barbarians.

    If you guys go ahead with your cold-hearted plan to execute this elf, the Olsen twins better watch their backs next time they're in Ireland, if you catch my drift.

    --
    - SMJ - (It's not just a name: it's a bad aftertaste.)
    1. Re:You disgust me... by jdkincad · · Score: 3, Funny

      And you think we would care if something happened to the Olsen twins?

      --
      The great advantage of having a reputation for being stupid: People are less suspicious of you.
    2. Re:You disgust me... by Anonymous Coward · · Score: 0

      the Olsen twins better watch their backs next time they're in Ireland

      Go for it. Hell, go back in time and take them out when they were at their most disgusting.

    3. Re:You disgust me... by FTL · · Score: 1, Redundant
      >... wanting to execute the smallest possible elf. You Americans and your bloodsports. Barbarians.

      And for those who don't know what ELF is, and are too afraid to ask...

      The Linux ELF HOWTO

      --
      Slashdot monitor for your Mozilla sidebar or Active Desktop.
    4. Re:You disgust me... by Universal+Nerd · · Score: 1

      funniest. post. ever.

      I know, a stupid waste of a post on my part but I wanna go down in /. history as having read the funniest post ever to this site... :)

      Tuxedo-steve, those who are about to be born, salute you.

      --
      Ash nazg durbatuluk, ash nazg gimbatul Ash nazg thrakatuluk agh burzum-ishi krimpatul
    5. Re:You disgust me... by whereiswaldo · · Score: 1, Informative

      *cough* Karma whore *cough cough*

    6. Re:You disgust me... by UranusReallyHertz · · Score: 0, Troll

      Fuck yes, I at least would like a crack at em first, if know what I mean. They are hot, man!Sweet Sixteen indeed!

      --
      Smoking is an expensive, slow, and unreliable method of suicide.
    7. Re:You disgust me... by Anonymous Coward · · Score: 0

      so far, his whoring has been ineffective.

    8. Re:You disgust me... by Anonymous Coward · · Score: 0

      hey, screw you. i think it was a funny post and this dude made a nice reply.

    9. Re:You disgust me... by DNS-and-BIND · · Score: 0, Offtopic

      I can't wait until they pose nude, like Drew Barrymore, or the chick from Labyrinth.

      --
      Shutting down free speech with violence isn't fighting fascism. It IS fascism!
  9. Ummm by Anonymous Coward · · Score: 0

    Does this guy have too much free time, or what?

  10. Small virus catcher (for DOS) by Fuzzums · · Score: 5, Interesting

    in assembly: RET

    All this one byte program does is terminate execution. If it's infected by a virus you'll see soon enough if the size has increased.

    ofcourse with todays macroviruses this doesn't work anymore :(

    --
    Privacy is terrorism.
    1. Re:Small virus catcher (for DOS) by Trusty+Penfold · · Score: 2, Funny

      Some viruses wouldn't infect suspected goat files; files with 'obvious' sizes. AV researchers would get the virus to infect the files - since the contents were known beforehand any changes were due to the infection.

      Of course this AV avoidance didn't work, as evidenced by the fact that viruses are now extinct and a footnote in the history of computer security.

    2. Re:Small virus catcher (for DOS) by RinkSpringer · · Score: 4, Insightful

      Uhrm, not really. Almost any COM file infecting virus will read the first 3 bytes and check whether it's a JMP instruction (0xEB and 0xE9 opcode). If they are not, they usually refuse to infect the file.

      Therefore, this file wouldn't be infected by like 99% of all COM infecting virii...

    3. Re:Small virus catcher (for DOS) by reynaert · · Score: 2

      Not to mention that most viruses hide their modifications when active.

    4. Re:Small virus catcher (for DOS) by Doppleganger · · Score: 1

      Viruses are extinct? Tell that to the people who regularly use the computer lab at my old college. I am so glad I never had reason to move a disk or executeable file between those computers and my home computer...

    5. Re:Small virus catcher (for DOS) by robbyjo · · Score: 1

      Well, I also caught viruses in DOS days. What I use is just a 1024 byte of code. The first one contains a long jump to the end of the code (which is simply mov ax,4c00; int 21h; that's 5 bytes). The middle 1019 bytes are pure junk. Most viruses can be caught this way.

      For hiding itself when we read the file: That's very easy. I used PCTools to examine the file slack. Usually, the viruses put themselves right after the file and the file slack sometimes one or two extra blocks than necessary so that it's easily identifiable from the FAT table.

      The hard part is when the virus also garbles your catcher program. However, since you have the catcher, you can always compare the files and look for differences.

      --

      --
      Error 500: Internal sig error
    6. Re:Small virus catcher (for DOS) by Fuzzums · · Score: 1

      actualli, I caught a virus with it, but never mind. the topic was small programs with every byte accounted for.

      I used that 1 byte program together with a 4K .com and .exe file. filling up the extra space with 0's, also making is visible when a file is infected.

      It goes without saying that I prefere a real AV program, but for detection viruses it was interesting. not perfect ;)

      --
      Privacy is terrorism.
    7. Re:Small virus catcher (for DOS) by Dr.+A.+van+Code · · Score: 1

      Well, under DOS the shortest .com program would be INT 20h, which assembles to CD 20 (hex), which is two bytes.

      --
      Good mfences make good neighbors.
    8. Re:Small virus catcher (for DOS) by Fuzzums · · Score: 1

      INT 20 - CD 20 would be terminate program
      RET really workt. try it.
      http://www.fuzzums.nl/~joost/div/tech-stuff/v irus- trap/
      see for your selve.

      --
      Privacy is terrorism.
  11. Ban IP laws and this is easier qjkx by Anonymous Coward · · Score: 0

    You have to worry about hitting a copyright now with such a short program. And software patents are preventing something more elegant. Am I right?

  12. good, bloat sucks by Anonymous Coward · · Score: 3, Funny

    Linux software is horribly bloated, like even "ls" is above 30k, thats just insane for a program thats supposed to just list files in a directory. About time someone did something about it.

    1. Re:good, bloat sucks by mickwd · · Score: 3, Funny

      Well it still manages to list files faster than my eyes can read them.

      So don't expect me to do anything about it.

    2. Re:good, bloat sucks by Anonymous Coward · · Score: 0

      My "ls" (statically linked, stripped, fileutils 4.1) is 341296 (three hundred and forty-one thousand two hundred and ninety-six) bytes! How does GNU justify this theft of magnetic resources? Why is the -g option still recognised? Who uses the -i (--inode) option? Surely removal of the less-used options, or providing a smaller utility with a different name and only essential functions (not -v, for instance) would surely save disk. (GNU "cat" is as bad, taking 216964 bytes (statically linked, stripped, GNU textutils 2.0) just to blast files to standard output, with many options (like -E, --show-ends) which have their uses but are rarely needed just to blast files. And GNU "true", at 209556 bytes, is over 4656 times as large as it needs to be, with the GNU --version and --help options just wasting everyone's disk!) (When I compiled these programs in the first place, they were statically linked - I have left them like that for emergencies.)

      As for the kernel, the download size for Linux 2.4.19 is 24.8 MB! (And that's in .tar.bz2 format!) Even Microsoft struggles to fill disks that quickly! (Microsoft also charges more for its (slightly) optimised software, which is why we use GNU/Linux (a few people use Linux on its own - when I say a "Linux system", I mean a system using the kernel and those tools that are required to get a system to boot and were written primarily for the Linux kernel (but not the GNU tools)).)

    3. Re:good, bloat sucks by peter · · Score: 2

      > Who uses the -i (--inode) option?

      You can use it to identify hard links.

      > Linux 2.4.19 is 24.8 MB!

      They could probably shrink that a bit if they looked for multiple implementations of the same thing. Rumour has it that Linux used to include four copies of zlib :) Farming out some of the /proc stuff to user space might help too. (and might reduce the amount of unpageable memory needed by the kernel.) Most of the space is in the source tree (as opposed to a compiled binary) is architecture and hardware specific code, though. (There are 16 subdirs in linux/arch, and 16 corresponding include/asm-* directories.)

      llama]~$ du -s /usr/src/linux/*
      6076 /usr/src/linux/Documentation
      31176 /usr/src/linux/arch
      83420 /usr/src/linux/drivers
      14208 /usr/src/linux/fs
      29304 /usr/src/linux/include [19MB of this is arch-specific include/asm-*]
      48 /usr/src/linux/init
      96 /usr/src/linux/ipc
      520 /usr/src/linux/kernel
      128 /usr/src/linux/lib
      436 /usr/src/linux/mm
      7604 /usr/src/linux/net
      560 /usr/src/linux/scripts

      (This is 2.4.19 with RML's preempt patch, after compiling on my PIII.)

      Having all the drivers included with the kernel source is kind of a mixed blessing. It makes the kernel source really big, but you don't have to worry about driver-vs.-kernel version compatibility. Linux's monolithic kernel design would make that a serious problem otherwise.

      --
      #define X(x,y) x##y
      Peter Cordes ; e-mail: X(peter@cordes , .ca)
    4. Re:good, bloat sucks by mcrbids · · Score: 2

      ls is 45k!

      -rwxr-xr-x 1 root root 45948 Aug 9 2001 /bin/ls

      --
      I have no problem with your religion until you decide it's reason to deprive others of the truth.
  13. I feel guilty by Anonymous Coward · · Score: 5, Funny

    This makes my new 100-gig hard drive seem WAY too big.

    1. Re:I feel guilty by Kenshin · · Score: 3, Funny

      Don't feel so bad, you could alays fill it up with porn. That's why they keep boosting the capacity.

      --

      Does it make you happy you're so strange?

    2. Re:I feel guilty by digitalpork · · Score: 0

      This makes my new 180-gig hard drive seem even more WAY too big.

    3. Re:I feel guilty by agdv · · Score: 1

      Now that'd be something interesting:

      The best 256-byte porn image file.

    4. Re:I feel guilty by p3d0 · · Score: 3, Funny

      Porn jokes are the "imagine a beowulf cluster" for the 21st century.

      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
    5. Re:I feel guilty by Alien+Being · · Score: 2

      In other words, nothing but the "naughty bits"?

  14. Glibc is the thief! by Goodbyte · · Score: 2, Informative

    I've always wondered what all the glibc overhead (compared to f.i. uClibc) does. I've never noticed any functional difference when setting up a initrd image by using uClibc instead of glibc.

    1. Re:Glibc is the thief! by looxix · · Score: 1

      Almost all programs should run a bit (10%) faster when linked with smalls C library (dietlibc, uClibc). Somes are even more twice faster.

  15. worlds smallest shellscript by Anonymous Coward · · Score: 0

    #!/bin/bash
    ls

  16. Interesting topic... by AtariDatacenter · · Score: 2

    There isn't much practical here more than it is an ELF education. But it was a very interesting read... and being able to stuff a payload into the header. Nicely done. But given that, in most cases, disk space is vast, and memory is plentiful, there isn't much in the way of usefulness. Maybe in some niche' applications running on tight hardware... but running Linux.

    1. Re:Interesting topic... by Blkdeath · · Score: 3, Interesting
      But given that, in most cases, disk space is vast, and memory is plentiful, there isn't much in the way of usefulness. Maybe in some niche' applications running on tight hardware... but running Linux.
      Consider for a moment what the GNU world would be like if every byte, primarily of our base system, was accounted for. Imagine a Linux distribution on the shelf with a "Zero Overhead" label on it - and be able to mean it!

      Consider Linux 2.4.x running on a 486 with 16MB of RAM - and having 14 of it free for applications even with init and Bash running.

      Now expand the concept to GUI applications, XFree86, etc. and think of how blazingly FAST the entire Linux experience would be, even on the most mediocre hardware. People would get a CPU upgrade and their systems would boot to KDM as if it was already loaded.

      Considering too the fact that every (assuming based on my own HDDs and limited knowledge of IDE transfer code) 8KB of program code requires a separate disk read operation to load to cache. Every 8KB that's shaved off an application's startup routines is one less disk read, which means those dusty old ATA33 hard drives would suddenly seem a lot more worthwhile to keep around (not to mention they'd be big enough, what with reduced size constraints) - an especially Good Thing<TM> considering recent changes in manufacturer policy where new drives are concerned.

      The excuse that CPU/RAM/HDD is inexpensive is a lousy one at best. It's cheap because bloated programs and operating systems have driven up demand, which has caused a surge in supply, which has dropped the prices. Imagine a world though where it was only the Windows weenies who had to trundle out to their resident computer store every other month to accomodate their latest cabre of software updates? We'd be able to laugh at them, knowing full-well that our K62-400s were smoking their brand-new P4-3.0GHz super-screamer systems.

      </RANT>

      --
      BD Phone Home!

      Shameless plug. Like you weren't expecting it.

    2. Re:Interesting topic... by Blkdeath · · Score: 2
      To follow-up with my previous post..

      If programmers all started poring over their code to the degree that they were shaving off bits and bytes around every corner, chances are they'd become so completely familiar with every nook and cranny of their code that duplication of effort would be eliminated (an obvious benefeit), but also that the codebase could shrink and bugs could be easier to zoom in on. A world in which bugs are fixed before they're reported is my idea of computer utopia.

      --
      BD Phone Home!

      Shameless plug. Like you weren't expecting it.

    3. Re:Interesting topic... by topham · · Score: 4, Insightful

      If you ever found a bug in code optimized to that degree you would NOT want to fix it as it could require a complete rewrite from scratch.

    4. Re:Interesting topic... by Blkdeath · · Score: 2
      If you ever found a bug in code optimized to that degree you would NOT want to fix it as it could require a complete rewrite from scratch.
      You sound like Ford Motor Company back when the Pinto was causing {eh-hem} problems. They decided that it would cost less to handle the lawsuits than the recall.
      --
      BD Phone Home!

      Shameless plug. Like you weren't expecting it.

    5. Re:Interesting topic... by topham · · Score: 2

      No, code optimized to the degree shown here is entirly impracticle.

      Good optimized code is a seperate discussion.

    6. Re:Interesting topic... by Trinn · · Score: 1

      I would love to see something like this implemented, but not on the Linux base. Unfortunately such a monolithic system would not lend itself well to this sort of optimization, and more exactly would make bugfixing even more horrendous. My friend and I are kicking around some ideas for a fully modular operating system, with an OO paradigm, every item thus being an object, and distinguished by what interfaces it exported. This would allow extensibility (new version simply exports proper interface), good optimization without losing the whole system in the process and finding debug nearly impossible, easy isolation of problems and application of security policies, and hopefully at least as fast of a core. Our system would be designed around reducing latency, as it is intended to be used in interactive environments where that is the common concern, as well as designed around being usable on a 486/66 - 32MB/ram or failing that at the very least a P1/100 - 32MB/ram

  17. umm.... yeah? by Lxy · · Score: 2, Insightful

    Basically what the other is saying is that by default, C is somewhat bloated (you need to include massive libraries just to use one function). Writing system level calls in assembly can replace the unnecesary bloat of a library that's only being used by one function.

    I remember this trick wehn I was learning x86 assembly. I wrote a hello world program in assembly. Assembled, it came to something like 35 bytes. In C++, it took over 10K.

    Now, also see the statement that he is abandoning portability, because he's using linux-specific system calls. So, in a nutchell, C++ makes big code that's portable, assembly makes tiny code that's static.

    Did I miss something or was this a long winded article about why assembly is better than C++?

    --

    There is no reasonable defense against an idiot with an agenda
    :wq
    1. Re:umm.... yeah? by Leonel · · Score: 4, Interesting
      Did you bother to read it?

      From the article, after the first try in asm:

      Looks like we shaved off a measly twelve bytes. So much for all the extra overhead that C automatically incurs, eh?
    2. Re:umm.... yeah? by mbogosian · · Score: 2, Troll

      Assembled, it came to something like 35 bytes. In C++, it took over 10K.

      Obviously you weren't using the ELF format then:

      There is no getting around the fact that the 45th byte in the file, which specifies the number of entries in the program header table, needs to be non-zero, needs to be present, and needs to be in the 45th position from the start of the ELF header.

      Maybe ELF is just too inefficient. :)

    3. Re:umm.... yeah? by Anonymous Coward · · Score: 1, Informative

      Did you bother to read it?

      That still included the C stdlib.

      From the article, after removing that:

      "Now that's tiny! Almost a fourth the size of the previous version!"

    4. Re:umm.... yeah? by Lxy · · Score: 2

      Yes, but he continues to say that he's using a C library function to END the program, with is how he knocked off 2K+ of space when he wrote it in assembly, forcing incompatibility with othe platforms.

      --

      There is no reasonable defense against an idiot with an agenda
      :wq
    5. Re:umm.... yeah? by rabidcow · · Score: 1

      Under Windows, I've had a DLL go from 36k to 4k just by not linking with the C runtime library. Using native Win32 calls is just more efficient when you don't care about portability. (which unfortunately is not often)

    6. Re:umm.... yeah? by Anonymous Coward · · Score: 0

      Actually, if you drop it to a DOS .com file, you can do it in 24 bytes -- two movs, two interrupt calls (one to print, one to exit), and the text. (If you drop the final EOL characters, you can make it 22, but then it's not identical to the C "Hello, world!\n".)

  18. Correction by ebuck · · Score: 3, Interesting

    Well, someone will point it out soon, so I might as well do it myself.

    nasm is the name of the assembler, not tiny.

    You can make a 45 byte version of the 'true' and 'false' utilities by changing the output to 1 or 0 respectively. Some shells implement these as builtin functions, but it does show a pratical (albeit odd) way to save a few bytes of disk space.

    1. Re:Correction by gorilla · · Score: 2

      You can get a 0 byte version of true. An empty file will execute as a shellscript and return true, and this was the traditional true until after v7 Unix.

  19. Smallest Posible Post by Anonymous Coward · · Score: 5, Funny
    1. Re:Smallest Posible Post by moonbender · · Score: 5, Funny

      Wow, you even saved a byte by mis-spelling "Possible" - awesome!

      --
      Switch back to Slashdot's D1 system.
    2. Re:Smallest Posible Post by Anonymous Coward · · Score: 0
    3. Re:Smallest Posible Post by Anonymous Coward · · Score: 0
    4. Re:Smallest Posible Post by Anonymous Coward · · Score: 0

      It's compression

    5. Re:Smallest Posible Post by archen · · Score: 0, Flamebait

      Maybe he wasn't really saving a byte. I mean it wouldn't seem like a slashdot post if the spelling were entirely correct.

    6. Re:Smallest Posible Post by Czernobog · · Score: 1

      He's using LZ for his compression.
      With LZW it'd be the Smalest Posibl Post

      --
      /. Where the truth
    7. Re:Smallest Posible Post by tealover · · Score: 1


      --
      -- You see, there would be these conclusions that you could jump to
    8. Re:Smallest Posible Post by Anonymous Coward · · Score: 0

      And it wouldn't seem like a slashdot post if you had used the word "correctly" as you should have.

    9. Re:Smallest Posible Post by Sri+Lumpa · · Score: 1


      "Wow, you even saved a byte by mis-spelling "Possible" - awesome!"

      Yeah, but he didn't mispell smallest, thus wasting one byte.

      --
      "The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers." Bill Gates,
    10. Re:Smallest Posible Post by yomegaman · · Score: 0

      Sorry, 'spelling' is a noun so it should be modified by an adjective not an adverb. Back to third grade you go...

      --
      ...wearing a skin-tight topless leather jumpsuit, with cutaway buttocks and transparent crotch panel.
    11. Re:Smallest Posible Post by Anonymous Coward · · Score: 0

      "post if the spelling were entirely correct"

      "And it wouldn't seem like a slashdot post if you had used the word 'correctly' as you should have."

      You think he should have said "if the spelling were entirely correctly." ???

      What a dumbfuck.

    12. Re:Smallest Posible Post by falzer · · Score: 1

      >

      Your thesis is sound.

  20. Bloat...now a worldwide concept! by Masque · · Score: 4, Funny

    This guy clearly doesn't get the point!

    67% of Americans are overweight. They can't account for most of the bites they use. By developing software that is just as bloated, the users feel good about themselves.

    This kind of skinny programming is very insensitive to the fatass society we Americans live in! Hopefully the U.S. Congress hears of this soon, so that they may legislate this kind of software right off the face of the earth.

    Masque, head of the Sensitive Programming Foundation*

    [*A division of Maxtor Corporation; come check out our new 320GB drives, featuring room for tomorrow's applications...today.]

  21. Windows exe by Sivar · · Score: 4, Interesting

    Cas, or StorageReview.com's forums, created a 324 bytes Windows 2000 PE executeable. It completely blew away all of mine, the smallest of which were about ~700 bytes.

    --
    Computer Science is no more about computers than astronomy is about telescopes. --E. W. Dijkstra
    1. Re:Windows exe by Sivar · · Score: 2

      or = of

      --
      Computer Science is no more about computers than astronomy is about telescopes. --E. W. Dijkstra
    2. Re:Windows exe by blibbleblobble · · Score: 1

      Smallest possible MS-Word file?

      Smallest possible HTML file created by Word?

      I'm guessing 60K...

    3. Re:Windows exe by AnyoneEB · · Score: 1
      Smallest possible MS-Word file?
      Find the smallest possible RTF. Multiply by 3. I'm not kidding.
      --
      Centralization breaks the internet.
    4. Re:Windows exe by rnd() · · Score: 2

      Smallest Word 2000 File: 19KB
      Smallest Word HTML File: 1.5KB

      --

      Amazing magic tricks

  22. 2 bytes smaller by Anonymous Coward · · Score: 0

    #!/bin/sh
    ls

    1. Re:2 bytes smaller by sinserve · · Score: 1, Redundant

      #!/bin/sh
      w

  23. justification by mbogosian · · Score: 5, Funny

    every single byte in this executable file can be accounted for and justified

    The author's sanity, however, cannot.

    1. Re:justification by MilleniumUcita · · Score: 1

      Hey, this criticism is unwarranted. The man is definitely not insane. I don't mind an executable of 10 Mb; but I do mind wasting space needlessly.

    2. Re:justification by Ignominious+Cow+Herd · · Score: 1

      I think the goal of the smallest executable was just an excuse for saying "here's something (an executable file) that we normally take a bit for granted. Let's really see what this is all about..."

      Lots of discoveries happen that way.

      --
      Lump lingered last in line for brains, and the ones she got were sorta rotten and insane.
  24. Re:No law on repeat articles (An apology) by ebuck · · Score: 2

    My sincere apologies,

    I read this article months ago, but it was not a Slashdot link. It was a link from another tech news source.

  25. Optimized Executables by aking137 · · Score: 5, Informative

    I think there are quite a few. It's seen as a challenge, and does have practical uses. Have a look at Toms Rootboot disk - it includes a web server, a telnet server, a telnet client, an nfs client, wget, gzip, bzip2, vi, a whole load of network drivers, and a tonne of other stuff, all compressed down onto one floppy disk. Only I've never quite been able to find the source code for any of it despite spending a small amount of time looking - possibly someone would be able to put me right on that one.

    There are also lots of interesting articles on linuxassembly.org.

    Andrew

    1. Re:Optimized Executables by op00to · · Score: 2, Informative

      The problem is that the FILESYSTEM itself cannot allocate a smaller amount of bytes than, say, n. So, if you have a program that is n-1, it still takes up n bytes. So, it's really not all that practical in 99.999999% of uses (that includes boot disks.)

    2. Re:Optimized Executables by Sparr0 · · Score: 5, Informative

      You are incorrect. The filesystem is stored on the disk in a compressed form, it is decompressed to a RAM drive. Every byte DOES count.

    3. Re:Optimized Executables by Fastolfe · · Score: 5, Informative

      Your information is dated. There are smarter filesystems nowadays that can allocate data from more than one file into a single "cluster". ReiserFS is one such filesystem for Linux, but there are surely others.

    4. Re:Optimized Executables by Anonymous Coward · · Score: 0

      Are you sure it includes a web server and a telnet server?? i am afraid you are wrong, it is posible to acomplished this requeriment in a floppy but toms do not do it. It just have other goals.

    5. Re:Optimized Executables by aking137 · · Score: 2, Insightful

      Yes thankyou, I am. I have used both successfully - download the image and try it. They're there, and they do have very real uses in terms of rescuing machines, which is simply to allow one to transfer files across a network. If I remember rightly, the web server executable is significantly less than 1k in size. And why not have a telnetd if you can fit it into a few kB?

      The whole disk has become so useful that it has virtually removed any need for an MS-DOS disk on the network I'm looking after. Running an rm -rf /mnt/c for a multi-gigabyte FAT32 filesystem takes seconds, as opposed to a deltree c:\*.* from a DOS disk, which can take literally hours, for example.

      Andrew

    6. Re:Optimized Executables by Mattcelt · · Score: 1

      It used to be imperative to keep bloat down and executables small and fast when we had XTs and 360k floppies. But even then, some people went to extremes... Anybody remember "jet.com"? 76 bytes, and it was a complete game. I never did figure out how they did that.

    7. Re:Optimized Executables by Anonymous Coward · · Score: 2, Informative

      Ah, yes, I remmember jet. Jet was a fun flight simulator when graphics were at their most primitive. The program was copy protected, so it wasn't easy to just copy the 360k floppy. The 76k you are refering to was just the loader, the full program resided hidden on the rest of the disk that DOS could not see. I had a copy a while back but alas, finally decided to format over it.

      Anyone know where a site is with that program?

    8. Re:Optimized Executables by uchian · · Score: 1

      I never played it, but was it anything like the great card game "52 card pickup?"

      I just had to ask :-)

    9. Re:Optimized Executables by Anonymous Coward · · Score: 0

      No. But 52 card pickup is a lot like my warm, shit encrusted nutsak. Smell the shit! SMELL IT NOW!!!

      I just had to say it.

    10. Re:Optimized Executables by scrytch · · Score: 2

      The problem is that the FILESYSTEM itself cannot allocate a smaller amount of bytes than, say, n. So, if you have a program that is n-1, it still takes up n bytes. So, it's really not all that practical in 99.999999% of uses (that includes boot disks.)

      This is why you stuff them all into one file. Everything in FreeBSD's /stand is a hardlink to the same file (which is just big enough to fit on one floppy). Busybox has the same philosophy.

      --
      I've finally had it: until slashdot gets article moderation, I am not coming back.
  26. Linux zealots. by Anonymous Coward · · Score: 0

    If it's much smaller than 512 bytes, it's a total waste of time.

    1. Re:Linux zealots. by khuber · · Score: 2, Funny
      45 bytes ought to be enough for anybody.

      -Kevin

  27. Not bad... by Captain+Pedantic · · Score: 5, Interesting

    But I'd like to see them get a Breakout clone in 1K

    --

    None are more hopelessly enslaved than those who falsely believe they are free. Johann Wolfgang von Goethe.
    1. Re:Not bad... by Anonymous Coward · · Score: 0

      Thats for a calculator is it not? I remember our ti83 in high school. We had Tetris that we could link together with the transfer cable and play versus. I was the champion of my class. Glory days of a geek.

  28. Even Shorter... by MarvinMouse · · Score: 3, Interesting

    While the program would be completely useless.

    You could make it even shorter by having it return absolutely nothing (Just having it execute and finish.)

    It could be useful to catch when anything starts to modify programs on your computer, because if the "thing" just modifies programs, it will recognize it as a program, and increase the size notably.

    I really like the 45 byte program though, too bad that after you passed 100 bytes, it became totally non-compliant.

    --
    ~ kjrose
    1. Re:Even Shorter... by zsmooth · · Score: 3, Informative

      No, I don't think you can make it any shorter even by removing that call. The program is 45 bytes, and the 45th byte is required to be there (a critical part of the ELF header), or else it won't execute at all.

    2. Re:Even Shorter... by Anonymous Coward · · Score: 0

      correct. note that even at 45 bytes, you are
      actually chopping a 16bit value in half.
      so as a guess, dont try it on big endian systems :)
      .
      Silvio

    3. Re:Even Shorter... by jareds · · Score: 1

      Well, there's a flag in the ELF header to indicate whether the file is big or little endian. Of course, you still couldn't actually run the file on a big endian system, simply because no such system executes x86 machine code, AFAIK.

    4. Re:Even Shorter... by flossie · · Score: 2

      If the file can't get any smaller (and I believe the author, I think he knows what he's talking about!) then I suppose the next question must be, how much extra functionality can be fitted into those 45 bytes. Surely the program can be made to do more than just return 42.

    5. Re:Even Shorter... by stjobe · · Score: 1

      "too bad that after you passed 100 bytes, it became totally non-compliant."

      Though I'm past one hundred little bytes
      I'm feeling very still
      And I think my program knows which way to go
      Tell my wife I love her very much she knows

      (With apologies to Ziggy)

      --
      "Total destruction the only solution" - Bob Marley
  29. No need to be smaller than 512 really... by Anonymous Coward · · Score: 5, Interesting

    Harddrive sizes being what they are now, the smallest sector size I see is 512 bytes. If the file stored in that sector is smaller than 512, it still takes up 512 bytes. Very intersting article however.

    1. Re:No need to be smaller than 512 really... by Russ+Steffen · · Score: 3, Informative

      Unless, of course, you're using ReiserFS with tail packing turned on.

    2. Re:No need to be smaller than 512 really... by Anonymous Coward · · Score: 0

      It depends, e.g. ReiserFS can pack small files together, so you'd still save space.

    3. Re:No need to be smaller than 512 really... by Anonymous Coward · · Score: 0

      Cool, always wanted to know how to pack tail.

    4. Re:No need to be smaller than 512 really... by alexandre · · Score: 1

      ReiserFS as other said, or some steganographic tools that actually use the lost space after your files to hide some other things (like this crazy tiny executable hehe :-)

    5. Re:No need to be smaller than 512 really... by jomagam · · Score: 1

      If it's small enough you can store the file in the inode.

    6. Re:No need to be smaller than 512 really... by the+way,+what're+you · · Score: 5, Funny
      Unless, of course, you're using ReiserFS with tail packing turned on.

      This should really be added to the Linux Gay Conspiracy.

      --
      example.org - powered by Linux!
    7. Re:No need to be smaller than 512 really... by Anonymous Coward · · Score: 0

      Your RAM isnt structured like a Hard drive though. So I dont see how your arguement holds any water.

    8. Re:No need to be smaller than 512 really... by reitoei1971 · · Score: 2, Informative

      true, but a small elf still takes up less memory once loaded from disk. though with 512mb+ in todays systems, people can even afford to run more than one office Xp app.

    9. Re:No need to be smaller than 512 really... by Anonymous Coward · · Score: 0

      Yeah but pretty much all modern OSs use paged virtual memory, page size typically being 4096 bytes on x86. So your argument is utter bullshit.

    10. Re:No need to be smaller than 512 really... by Anonymous Coward · · Score: 0

      Nope. It's also impossible for a running executable to consume less than a page of memory. I don't remember how big pages are in Linux, but I know that they're considerably bigger than 45 bytes.

    11. Re:No need to be smaller than 512 really... by Anonymous Coward · · Score: 0

      But it probably still takes 1 page of RAM. Depending on the page size, it could be 4kB or higher.

      Tom

    12. Re:No need to be smaller than 512 really... by shird · · Score: 2

      Like people have said, many filesystems allow you to store the information in the inode or equivalent. Also, when your transmitting data over a network, or tar/zipping the file up with many others, you will also see the benefits. OR if your storing it in FlashROM on a PDA or something.

      --
      I.O.U One Sig.
    13. Re:No need to be smaller than 512 really... by FlashHamster · · Score: 1
      If the file stored in that sector is smaller than 512, it still takes up 512 bytes.
      Well, no. Reiserfs is capable of packing "tails" of different files together in one block. The ext2 format also allows this, though noone has implemented it yet AFAIK.
    14. Re:No need to be smaller than 512 really... by guusbosman · · Score: 1

      Or, when you're talking about files this small, it's even an option to just print the source and retype it when you need it ;)

      Reminds me of the good-old days when we used to have a ROM-only computer, don't know the brand but it didn't have a diskdrive or harddisk... Everytime we wanted to play a game we had to type it from a booklet.

    15. Re:No need to be smaller than 512 really... by Dr.+A.+van+Code · · Score: 1

      Sectors were also 512 bytes back in the days of 360k floppies. Operating systems, though, generally allocate in blocks (or clusters) that may be more than one sector.

      --
      Good mfences make good neighbors.
  30. Bigger is Sometimes Better by ksw2 · · Score: 5, Informative
    I used to kill myself trying to strip a few lines of code from my programs... in my mind, I was trying to emulate the PDP hackers of the 60s (my heros) by finding the one "Right Thing" for each program.

    Soon I realized that smaller programs are not the end-all goal of programming. If a slightly bigger program is easier to understand for the next person who modifies/maintains it, then that is the new "Right Thing" for that application... and I realized the efficient progamming of the PDP days was a biproduct of necessity more than anything else. It's seldom needed with today's blazing hardware capabilities.

    This isn't to say that many of today's programs are over-bloated, but just to reinforce the trade-off between small and easy to understand.

    1. Re:Bigger is Sometimes Better by Peyna · · Score: 1

      After all, if you really wanted the smallest and best running program out there you would probably code it all in machine code specifically for the system it was going to run on. Of course, it would take you so long to do it, what would the point be? Just take a time machine back to the beginning of the computer and you can code in machine language all day if you want.

      --
      What?
    2. Re:Bigger is Sometimes Better by Fastolfe · · Score: 2

      While I agree with what you're saying, bear in mind that this article is discussing compactness of machine code, not source code. A good compiler/optimizer will produce tight, efficient and compact machine code, even if you have to be a little more verbose in your source code so as to preserve the ability to easily read and maintain it. Nowadays (on Windows especially), even small or trivial functions invariably cause the executable to contain an enormous amount of bloat. The author here is simply making a point (at least at the start of the page) that a lot of this bloat is unnecessary and just needlessly consumes disk space.

    3. Re:Bigger is Sometimes Better by Anonymous Coward · · Score: 0

      There exist tools to optimize SPEED rather than SIZE of executables rather dramatically, or at least there did before Intel started branch optimizations. Does anyone have any publicly available info on this?

    4. Re:Bigger is Sometimes Better by Erik+Hollensbe · · Score: 1

      If you read through what he's really doing, he's eliminating the entire 'killer app' of unix (the c library and unix api) to reduce file size.

      Then, he goes on to compromise the ELF standard by putting his code in unused places in the ELF standard, as used by linux (ELF, IIRC, comes from solaris originally, so it's not something linus invented), in some cases areas that are ignored for intel only, and then relocating to that point in the binary to execute his code.

      90% of the optimizations after moving to assembler rely on the fact that his program is only of a certain size. The only exception to the rule that I noticed is the setting of eax to 1 using xor against it's original value (0).

      I'm sure that there are some things that gcc could pull from this, but this is really just experimentation to see what COULD happen, not what's really usable.

      Notice that the stages where he gets the real improvements are:

      1) When he drops the c library and starts using raw assembler to handle the exit code of the program

      2) When he starts replacing parts of the ELF format with code which is later relocated to by the program header.

      As soon as gcc starts taking the effort of the C library, it loses all portability (which, last I checked, is the real killer feature of gcc, not speed or optimization). I won't even get into the insanity of reducing a program from 200 to 45 bytes by relocating your code into the actual ELF header.

    5. Re:Bigger is Sometimes Better by Anonymous Coward · · Score: 0

      Bigger is Sometimes Better

      That's not what yo mama said when i was doing her last night...

      (Yes, I am an anonymous coward.)

  31. Microsoft. Yes, Microsoft by tomoose · · Score: 4, Insightful

    Reminds me of one of Bill Gates' first programs - Micro-Soft's 1975 Altair BASIC. Unfortuantly the page I wanted to link to has gone, but this is something from the register at the time: http://www.theregister.co.uk/content/4/18949.html

    Finally found a web archive of the page I wanted: http://web.archive.org/web/20011031094552/www.rjh. org.uk/altair/4k/index2.html

    A real pity that standards have slipped so much since then.

    (I refuse to post anonymously even though I have mentioned Microsoft in a thread about Small Exes. So there :p )

  32. Efficiancy in OS programming needed by TibbonZero · · Score: 5, Insightful

    We really need more efficiant programming in OSes today. Look at the system requirements for OSes over the past few years. It's gone crazy. Check out the requirements for NT Workstation 4.0, Windows XP Pro and Windows 2000 Pro.

    Doesn't something seem messed up? What have we really gained since 4.0 that causes 4x the memory, 3x the procecssor, and almost 15x the harddrive space? Is USB and Firewire support really that big? And have you ever tried to run XP on the min system? It doesn't work so well. I remember being able to tweak a system to run Windows 95 on a 386 with 5mb memory and a 45mb harddrive. It wasn't pretty but it could run. Today if you aren't going 1ghz+, then they want to leave you behind.

    They are just using really fast hardware as an excuse for bloating the code.
    Even Linux (redhat moreso) is guilty of this.
    Remember when awesome games could fit on a handful of floppies? I think that could fly today if they tried. Look at the Demo scene. 64k can do alot of graphics. The most awesome games like Betrayal at Krondor were only a few floppies. Sure, if you have big hardware use it, but don't waste it. Programmers are just getting slack and including (literally) everything in the world, and not writing anything for themselves. They aren't looking to optimize stuff, just to kick it out and make money (obviously open source isn't guilty of the money or the fast kickout thing)...

    --
    Tibbon
    tibbon.com
    1. Re:Efficiancy in OS programming needed by Zaiff+Urgulbunger · · Score: 2, Insightful

      It'll go full circle at some point. A kind-of-example, might be PalmOS in so far as it is wildly stripped down and slim when compared with WindowsCE. The problem is that it costs at lot to develop really beautifully engineered code. Some day it'll happen though - like a nice, tight office suite that loads ridulously quickly and does everything you want.

    2. Re:Efficiancy in OS programming needed by coupland · · Score: 5, Insightful

      Unfortunately my take on this situation is a bit more sinister. Your post mentions that NT 5.0 (Windows 2000 Pro) requires 64M of RAM, yet NT 5.1 (Windows XP) requires 128M of RAM. Why the twofold increase for a minor upgrade? Well, consider two things:

      1. Windows XP was released during one of the slowest hardware sales slumps in PC history. All the big players were hoping to see XP spur sales. Not coincidentally, for many people XP required a new PC.
      2. Microsoft can only stand to benefit from these PC sales in the form of OEM licenses.

      Yes I'm cynical but I've always been of the belief that the bloat in XP is engineered, not the simple result of bad programming. To think that the project managers and marketing don't talk about these sorts of things is naive

    3. Re:Efficiancy in OS programming needed by Anonymous Coward · · Score: 0

      Yeah, everything is getting bloated. But with Linux, it isn't that bad if you know what you're doing and you are ok with a different interface (i.e. using all text-mode, a tiny-with-just-a-few-features-window manager/desktop or minimal-just-good-enough-to-show-some-pictures-gra phical-browser ). But dumbing-down interfaces while adding new (usualy useless, redundant) features is prbaly the culprit much of the time.

    4. Re:Efficiancy in OS programming needed by Anonymous Coward · · Score: 0

      linux is bloated? slow? try custon, try icevm.

    5. Re:Efficiancy in OS programming needed by Cyno · · Score: 1

      I think a lot of this has to do with the complexity of our libraries, too. Using KDE or GNOME or OpenGL adds a lot to a staticly linked commercial software package. But I may not know what I'm talking about.
      Compare Doom to Quake 3 or UT2003. The difference in detail and complexity should be obvious, we need more memory and performance because we need to do more with a computer than ever before. And the bloat comes from keeping it dynamic and stable, KISS, etc. At least that's my opinion.

    6. Re:Efficiancy in OS programming needed by Fastolfe · · Score: 4, Insightful

      I think a lot of it is due to pressure to get a product out. Developers are relying exclusively nowadays on high-level languages, even in OS design, and those that write the compilers don't spend as much time on getting good, compact, precise and optimized code out of high-level code. Nobody cares. CPU is cheap, hard disk is cheap. Why should they work to make their stuff efficient when they can just claim their product is so advanced it requires twice the resources.

      Part of it also lies on the shoulders of developers. A lot of developers today are simply programmers that learned C in high school. They have little understanding of machine languages, assembly, or the CPU architectures they're coding for. They know just what the high-level languages look like and one or two ways of accomplishing their goal. What they need to know is how their software design decisions actually get implemented by the assembler and executed by the architecture. Memory efficiency never even crosses their mind. Who wants to pay for programmers that actually know their shit when they can just claim their product is so advanced it now requires four times the resources?

      Perhaps this is another area in which OpenSource software can shine some day...

    7. Re:Efficiancy in OS programming needed by Anonymous Coward · · Score: 0

      You might have a point if the stated system requirements for NT 4.0 weren't complete bullshit.

      While it might have been sorta-kinda true that the original version would boot barely with 16MB, by the time you had SP3+ and the IE4+ shell, the system requirements are no different than Win2000. In fact, Win2000's might even be slightly lower due to better IDE and video drivers.

    8. Re:Efficiancy in OS programming needed by RTMFD · · Score: 1

      If you want to look at it from a purely economic point of view, you get more by taking the dollars you have and spending them on better equipment than you do on the programmer time taken while making code more efficient (using lower level languages, etc.) This is almost like saying "why do we need a copy machine when we can just hire a crapload of scribes to copy all of the machines in the office, we'll save a bundle on toner that way!"

    9. Re:Efficiancy in OS programming needed by timeOday · · Score: 2
      My experience with Linux has been different. Until recently I was running a 486 100 laptop on 48 megs of ram (quite a bit for such an old laptop). I found that newer Linux kernels (2.4 series) actually ran BETTER than the old ones; seemed more responsive. I couldn't use XFree86 4; for some reason it wouldn't work. But 3.x worked fine. And of course fvwm2 is fast on anything. Applications? I mostly used it as a remote desktop (using 802.11b) and in this capacity it could host Mozilla etc. just fine. Ocassionally I needed to go mobile and found that emacs, octave, scheme, etc. etc. worked fine.

      Windows 2000 on a 64 meg 233 mhz laptop, on the other hand, is agony. The hard drive just spins and spins. The top memory hog is explorer.exe, even when I'm not running the web browser. I can't figure it out; Windows NT didn't hog RAM like that.

      Anyways, I'm not saying OSS is inherintly more memory-efficient, just that it's much more modular; you can choose to run a GUI, or not. You can choose Mozilla, or opera or lynx (whereas, as I said, Windows 2000 seems to integrate some part of the browser with the shell (?). If I'm wrong, please tell me how I can make Windows 2000 run better on my 64 meg laptop!)

    10. Re:Efficiancy in OS programming needed by eggstasy · · Score: 2

      Awesome games still fit on a floppy. Bridge-Builder is less than 150k I think and its sequel Pontifex is less than one meg.Both of them are 3D OpenGL games for building bridges. On especially large bridges they slow down my 1333 Tbird like nothing else ever has due to their realistic physics model.
      Go check them out at the company's website, www.chroniclogic.com or a very popular fansite www.bridgebuilder-game.com - Their next game, Pontifex 2, will be 20 megs and feature a Linux version. Can't wait for it to be released!

    11. Re:Efficiancy in OS programming needed by omega_cubed · · Score: 1

      erghhh... hit me if I am blatantly off, but the famed internet explorer program is named IEXPLORE.EXE. The explorer.exe you refer to is the Windows explorer, or otherwise known as the one and only thing that holds the monstrosity together (the GUI, the Windows "shell" as they called it in system.ini). And if I remember correctly, that has been there since the Windows 95 days, when they added this thing called "Explore your computer"/"Windows Explorer" to the system.

      I think with W2K, it depends lots on what your computer is aimed for doing. Right now my 192Mb 600MHz ThinkPad died to Daemon, I am running W2K on a 600MHz 64Mb Dell Inspiron, and have only occasional trouble with slowness. Right now my memory usages are (in order, the top five):
      phoenix.exe with 16208k
      IEXPLORE.exe with 11320k
      wmplayer.exe with 4892k
      explorer.exe with 3744k
      taskmgr.exe with 2336k
      (now why would taskmgr take that much memory is beyond me)

      The only time I can remember this machine being painfully slow is when I wake it up every morning from hibernation, when it tries to spin up, and load everything into memory from disk again.

      However, I do use to run a 166Mhz 64Mb (later 96Mb) Desktop with Windows 2000 at home. My theory is that Microsoft is absolutely correct in the minimum requirements for running the OS. But when they say minimum, they mean OS only. Nothing else. Once you start tagging on stuff like AOL, Microsoft Office, Corel Draw, etc, and try to run them at the same time, the system likes to just hang and ignore you. Ever since I have gotten my sisters hooked on TeX for word processing, and that really improved the memory usage on the desktop system at home.

      So my suggestion is simple. Since you have a close to minimum machine, you should try to only run close to minimum apps. My friend ran Mandrake 8 on his 233Mhz 192Mb ran desktop. And Mozilla slows down X considerably in the pre-1 releases. (It doesn't help with his habit of hosting a NFS search engine, listening to music, browsing the web, while compiling the kernel at the same time q= ). The important thing is choice. You can choose to run simple and memory non-extensive programs in Linux, you also can choose to do so in Windows 2000, for example, you can use Mozilla or lynx in Windows if you choose (and save 10M ram from IEXPLORE), and Microsoft Office has always been less than necessary, and I am sure you can find another Office implementation with a much smaller footprint (or just use TeX like we normal people do q= )

      W
      --
      Werd Smiler

      --
      Engineers also speak PDE, only in a different dialect.
    12. Re:Efficiancy in OS programming needed by gli · · Score: 1

      The law of evolution says those who survive is not the most efficient, but the fittest. The goal of programming is to solve problems. As long as this goal is met, whether a piece of software will survive depends on finding a good trade-off among a number of factors, such as ease of use, efficiency, development time, ease of maintainence and upgrade, etc. Efficiency is just one of the factors that doesn't really deserve more preference than others. The preference of efficiency is more of a historical legacy when hardware was so tight that in order for a program to be acceptable it must be highly efficient. But nowadays this point is less and less valid. I would say for today's PC desktop software, ease of use generally has much higher priority than other factors, and that's why Microsoft still dominates the PC market.

    13. Re:Efficiancy in OS programming needed by Kashif+Shaikh · · Score: 2, Insightful

      Yes I'm cynical but I've always been of the belief that the bloat in XP is engineered, not the simple result of bad programming.

      Woah...isn't "engineering" and "bad programming" synonymous to Microsoft? Look at all the stuff they engineered over the years!

    14. Re:Efficiancy in OS programming needed by Kashif+Shaikh · · Score: 1

      Remember when awesome games could fit on a handful of floppies? I think that could fly today if they tried. Look at the Demo scene. 64k can do alot of graphics. The most awesome games like Betrayal at Krondor were only a few floppies. Someone kick this guy in the balls. It's one thing to say that games these days are using more and more resources that stress your CPU, memory, and I/O(graphics,disk,etc)--which is true. But it's completely stupid to say, how come we can't have good graphics fit into 64K of memory. Is it to say that game engines are becoming crappy? Possibly. But really it's the massive amounts of textures, sound, model vertex info, etc. that take the lion's share of your memory.

    15. Re:Efficiancy in OS programming needed by flossie · · Score: 2
      My theory is that Microsoft is absolutely correct in the minimum requirements for running the OS. But when they say minimum, they mean OS only.

      You may well be right, but what is the point of running an OS if you can't run any applications? The OS is there to support the apps. Not many people buy a computer just to load an OS.

    16. Re:Efficiancy in OS programming needed by Anonymous Coward · · Score: 0

      That would be the theme engine.

      A properly tuned Windows XP runs smaller and faster than Windows 2000 (although somewhat bigger than NT4, as it is much newer).

      I even have a bootable CD which runs a slimmed "Rescue" console - no, not the recovery console, but a fully-featured XP SP1.5 Safe Mode with Networking that never needs to touch the harddisc, has its own registry editor and ntfs/fat filesystem tools and repartitioner, and runs without touching the harddisc at all - no swap, no temp files, nothing - in 48 megabytes of ram (and we expect to cut that to 32). And the team did that without source code, too. It's really a question of how down'n'dirty you're willing to hack things to get them to work...

    17. Re:Efficiancy in OS programming needed by smithmc · · Score: 1

      Unfortunately my take on this situation is a bit more sinister. Your post mentions that NT 5.0 (Windows 2000 Pro) requires 64M of RAM, yet NT 5.1 (Windows XP) requires 128M of RAM. Why the twofold increase for a minor upgrade?

      Why? Because WinNT 5.x really requires 512MB to run smoothly, and MS is taking their time working up the courage to admit it.

      --
      Downmodding is the refuge of the weak. Don't downmod, make a better argument!
    18. Re:Efficiancy in OS programming needed by Anonymous Coward · · Score: 0

      Windows XP requires a faster PC. As a result, a new PC will be sold. Therefore, Microsoft sells more copies of Windows XP.

      What?

      CLAIM FAILED

    19. Re:Efficiancy in OS programming needed by rnd() · · Score: 2
      Some of the other posts below border on the bizarre and discuss conspiracy theories, so I'll reply to yours:

      Think of all of the processing power and lines of code that go into the little gui effects in Windows XP or KDE. Think of the extra clock cycles and bytes of code required to run a ReiserFS filesystem than to run a minix filesystem.

      Some people's ideal would be to have everything written in assembly. In my opinion, languages like Java, LISP, Objective C, and C# allow for much greater efficiency in the programming and design of systems, but at some cost in terms of the overall efficiency of the code. Despite this, Common Lisp and any of the other languages mentioned above can do many things as fast as well-written C, and even faster than the kind of C written by many programmers.

      In order to make higher level languages practical, the hardware has to be capable of more than if it only had to run well-written assembly.

      Of course, some people like to see their menus animated, etc., and that is a residual effect.

      --

      Amazing magic tricks

    20. Re:Efficiancy in OS programming needed by rnd() · · Score: 2
      You are way too cynical for your own good. Next thing you know you'll be sitting in a log cabin somewhere writing a manifesto. But seriously:

      Of course companies like Dell are happy to hear that Microsoft is coming out with a new OS that will require more hardware... they'd be stupid not to.

      Likewise, I'm sure that Linus, the developers of Apache, and anyone who uses Linux is pleased to hear that bigger/better hardware is coming out because it brings Linux one step closer to winning at the enterprise level.

      Sure, Microsoft puts a fair bit of fluff into Windows XP. I'm talking about heavily animated menus, menus that "forget" about programs you haven't used in a while, etc. But don't think for a moment that Windows XP doesn't solve MANY of the problems that exist in Windows 95, 98, and ME. Doing all this and maintaining compatibility does require a lot of code and a fair bit of bloat.

      Yes, if you're upgrading from Windows 98 to Windows XP then you'll likely need a new PC, but for what you're getting it's money well spent. NT5 and newer have been pretty solid operating systems, and running them takes decent hardware. Please don't tell me that you're under the impression that that old machine that's running Windows 98 is going to be able to easily handle the latest RedHat or Mandrake and XFree 4.2?

      --

      Amazing magic tricks

    21. Re:Efficiancy in OS programming needed by Anonymous Coward · · Score: 0
      like a nice, tight office suite that loads ridulously quickly and does everything you want.


      Yeah, her name is Pamela. And as long as her husband doesn't find out, she'll keep doing everything I want.
    22. Re:Efficiancy in OS programming needed by mcrbids · · Score: 2

      Remember when awesome games could fit on a handful of floppies?

      Pull out those floppies, and load the game. You'll see why 4x the RAM isn't so unreasonable! The "old favorites" by today's standards suck.

      --
      I have no problem with your religion until you decide it's reason to deprive others of the truth.
    23. Re:Efficiancy in OS programming needed by coupland · · Score: 2

      Actually, I think you need to be more cynical, to suggest XP bloat wasn't engineered is highly, highly implausible. For this to happen we need to assume that the big-wigs in Redmond got into a room together to discuss a major slump in OEM sales and the following two questions were never asked:

      1. "Could this possibly be related to the massive PC purchase slump affecting everyone in our industry?"

      Also, no one asked:

      2. "I wonder if there's any way we can fix the problem?"

      To suggest that companies have this sort of fatalistic "we're screwed and there's nothing we can do to fix it" mentality is simplistic at best. Do you honestly think companies don't have these discussions?

    24. Re:Efficiancy in OS programming needed by rnd() · · Score: 2
      I still don't buy your argument. If you buy a new PC from an OEM, you get a copy of the latest Microsoft OS included.

      What you really appear to be saying is that you think most consumers are sheep who see an ad for Windows XP and run out and spend their money on a new PC that they don't need.

      Of course Microsoft wants to sell as much software as possible. That's why they keep putting new features and functionality into it. They do sell a lot of software via hardware OEMs, but a lot is sold directly to businesses.

      If all you needed to do to get the additional functionality was pay $150 for a new copy of windows, why would Microsoft be so stupid as to effectively make the cost of having the new features be $150 + the cost of a new pc? This multiplies the price by a factor of 7 to 10 in most cases.

      Sure, Microsoft is glad to have companies like Dell, Gateway, and HP mass producing x86 PCs pre-loaded with Windows... these companies advertise and support the hardware at a much lower profit margin than Microsoft has on its software.

      Your argument just doesn't make economic sense. If I sell software and profit ONLY from software sales, why would I force you to pay for additional products in order to use that software? If the software is salable on its own, then your argument fails. If Microsoft could sell its software to run on bigger/better hardware, then your agument fails again. And if Microsoft sells the software at roughly the same price as the previous version, then your argument fails again.

      --

      Amazing magic tricks

    25. Re:Efficiancy in OS programming needed by coupland · · Score: 2

      >If I sell software and profit ONLY from software sales, why would I force you to pay for additional products in order to use that software? If the software is salable on its own, then your argument fails.

      No, this is in fact the strength of the argument. Picture it like this: you go out and buy Windows XP because you're an average Joe and think it's the only way you can use your new digital camera, and after all, Microsoft is promising you it's faster than all previous versions of Windows. (A whole thread in itself...) You get it home and realize it's slower than snot on your Pentium 400. So what do you do? Either you write off the $150 for the software or you go buy a new computer. When you buy the new computer, guess what? You buy a second copy of XP!

      Now I know what you're thinking, no company can afford to be so contrarian and abusive to users. To knowingly force you to buy two copies of their product. But they can. Microsoft is a monopoly and knows it. They know you can't take your toys and go home. You want a computer? Buy Windows. For the average Joe there is absolutely no choice.

      And lastly, Microsoft profits directly from hardware sales, you can't oversimplify by calling them a software-only company. Because they force every PC to be shipped with an OEM license. Hence hardware sales are part of their bottom line.

    26. Re:Efficiancy in OS programming needed by Hater's+Leaving,+The · · Score: 1

      Doom is still a great game. I don't think its gameplay has really been beaten by other FPSs since. Sure, the graphics aren't as good, but by the time you've got glowing red floaty things firing fireballs at you suspension of disbelief is already engaged, who cares if it's got jaggy edges. 4 floppies.

      THL.

      --
      Keeping /. cynic density high since the fscking Kwhores/trolls arrived.
    27. Re:Efficiancy in OS programming needed by PissedOffGuy · · Score: 1

      you lost all credibility in your first paragraph saying that XP was a minor upgrade. hint: obscure version numbers in the OS dont necessarily correspond to feature sets.

  33. That goes to show those C bigots by Anonymous Coward · · Score: 2, Insightful

    You know -- the bullshitters that say: "Optimizing C compilers write small/better/faster code than hand-tuned assembly."

    Hand-tuned assembler is always faster/smaller/better than C code, except when it comes to portability.

    And this just goes to show that fact again!

    1. Re:That goes to show those C bigots by Waffle+Iron · · Score: 5, Insightful
      Hand-tuned assembler is always faster/smaller/better than C code, except when it comes to portability.

      Maybe in theory. In practice, once your program gets too big to fit it all in your head at once, you're going to run out of the mental energy required to stay ahead of the C compiler (and remain bug-free).

      If you've disassembled the output of a good optimizing compiler lately, you'd see that it usually produces pretty good code. Except for the inner loops of numerical algorithms, I doubt that anyone will consistently be able to produce code that is more than 25% faster than the C compiler.

      The thing is, the compiler is able to spit out this code at thousands of lines per minute all day long. It doesn't get tired. The human programmer is going to get tired of the boredom, and will start creating higher level abstractions in assembly. He'll start using macros. He'll use a simplified parameter passing protocol so that he doesn't have to inline and hand-allocate the registers for every little subroutine call.

      Before long, he's fallen behind, and the C code will run faster overall. And the C program will have taken less time to write, as well.

    2. Re:That goes to show those C bigots by p3d0 · · Score: 2

      Obviously, a human can write any code a compiler can given enough time and effort. I think realistically, what is more important is that time spent on improving compilers will provide more benefit to more software than time spent rewriting that software in asm by hand.

      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
    3. Re:That goes to show those C bigots by pclminion · · Score: 2
      If you've disassembled the output of a good optimizing compiler lately, you'd see that it usually produces pretty good code.

      Indeed. Try looking at the gcc-optimized assembly for the following:

      x ^= y;
      y ^= x;
      x ^= y;

      It may not be immediately obvious, but if you work it out you'll see that this swaps x and y.

      The compiler, of course, figures this out and just uses an XCHG instruction (on x86, at least).

    4. Re:That goes to show those C bigots by jpmorgan · · Score: 2
      Nice troll. I like how you conclude that since the smallest ELF executable is written in assembly, assembly coders are better at writing fast code than optimizing compilers.

      Optimizing C compilers don't produce smaller code, and I don't know anybody who claims they do. They're optimizing for speed, size is rarely a significant concern. Writing fast assembly these days is a lot different from what it used to be, and a lot of speed penalties and gains are very non-obvious and requires a highly detailed understanding of the way the processor is implemented. The guys who write optimisers tend to know these, but in my experience most so called assembly programmers don't (although there are notable exceptions).

  34. On my WinXP machine by Raistlin99 · · Score: 1

    the largest EXEs are the install programs for Counter Strike and Tactical Ops. The largest EXE that has anything to do with Windows is USER.EXE and weighs in at 537K. Just to let you know.

    --
    I/O, I/O, its off to disk I go, with a read and a write, and a bit and a byte, I/O, I/O, I/O, I/O
    1. Re:On my WinXP machine by Anonymous Coward · · Score: 0

      I used to have a 64 meg wine exactuable (statically linked with all debugging enabled.)

  35. I ask out of total ignorance... by afabbro · · Score: 1

    ...wouldn't it be slightly smaller if it returned a number smaller than 42? i.e., 1 or 0 or nothing?

    --
    Advice: on VPS providers
    1. Re:I ask out of total ignorance... by Anonymous Coward · · Score: 0

      The return value is 1 byte, and so it makes no difference. (0-255, 0x00 - 0xff)

    2. Re:I ask out of total ignorance... by Eu4ria · · Score: 1

      If yo read the article the author inticates that there are already programs that return 1 and 0. The programs are 'true' and 'false'. So he just decided to return a different number, probably influenced by Douglas Adams (RIP)

    3. Re:I ask out of total ignorance... by flossie · · Score: 3, Informative

      No. The 45th byte of the resultant program is required to be there as part of the ELF header (Linux won't run the program otherwise). The code which generates the value 42 occurs way before the 45th byte of the program in an unused portion of the header. In fact, the return value could be a couple of bytes longer without changing the length of the overall program.

    4. Re:I ask out of total ignorance... by flossie · · Score: 2
      But 45 bytes still beats true and false on my system (Debian):

      $ wc -c /bin/true
      9704 /bin/true

      That's 9659 wasted bytes!

  36. Smallest possible size by SeanTobin · · Score: 2

    Now, the author has to shrink the cluster size of his hard drive, and make up some new indexing structure that is more efficient so any shrinking of the executable actually matters.... It doesn't help if the executable is 32 bytes or 4096 bytes if you only have 4k clusters, you're still eating the same amount of space.

    --
    Karma: SELECT `karma` FROM `users` WHERE `userid`=138474;
    1. Re:Smallest possible size by mikewas · · Score: 2

      Not when it's executing in memory. I've yet to see RAM with clusters.

      --

      "Glory is fleeting, but obscurity is forever." --Napoleon Bonaparte
    2. Re:Smallest possible size by AtariDatacenter · · Score: 1

      A very good point. I'm also wondering how much memory it is taking. I guess it is the same thing, with page sizes and all (which would vary per platform... don't know how Linux does it or if at allows for adjustable).

    3. Re:Smallest possible size by FredGray · · Score: 2
      Not when it's executing in memory. I've yet to see RAM with clusters.

      Well, they're typically called "pages" in that context: the minimal unit of virtual-to-physical address mapping. On x86 Linux, the page size is 4096 bytes.

    4. Re:Smallest possible size by kscguru · · Score: 2, Informative
      No, but RAM has pages. 4K on x86, as I recall. You can't pull anything smaller out of the kernel - though you could pack it into another process's address space (but that defeats the purpose of a small executable anyway).

      And no, you can't change the page table size, it's hardware-dependent. Most of the other archs seem to have similar or larger pages, too.

      Why do I know this? It's "write your own VM" month in my OS class. Next week we get to start swapping out to disk...

      --

      A witty [sig] proves nothing. --Voltaire

    5. Re:Smallest possible size by blibbleblobble · · Score: 1

      "Now, the author has to shrink the cluster size of his hard drive..."

      It also takes less memory. Imagine a webserver loading a million such programs.

      (okay, not for the return-42 example, but for oprimised programs in general)

    6. Re:Smallest possible size by pdiaz · · Score: 1

      Sure, never heard of memory pages, didn't you?

      --
      Make It Secret . Free JavaScript implementation of AES for your browser
    7. Re:Smallest possible size by Fastolfe · · Score: 1

      ...assuming you're using a file system that only permits a single file's data in one cluster. There are more intelligent file systems out there.

    8. Re:Smallest possible size by SeanTobin · · Score: 2
      ...assuming you're using a file system that only permits a single file's data in one cluster. There are more intelligent file systems out there.
      such as? All the filesystems I know of divide the hard drive into portions and assign one or more of those portions to each file. Even the newer database driven filesystems do this. Weather they are called clusters, or inodes, the result is the same. Of course, I'm only familiar with the more mainstream filesystems... I'd love an example of a filesystem that did something differently.
      --
      Karma: SELECT `karma` FROM `users` WHERE `userid`=138474;
    9. Re:Smallest possible size by jareds · · Score: 1

      It will still use at least one page of RAM, so that would be 4K.

    10. Re:Smallest possible size by jareds · · Score: 1

      ReiserFS doesn't have fixed-size inodes and it can pack a varying number of small inodes into a single block, depending on the actual size of the inodes.

    11. Re:Smallest possible size by Anonymous Coward · · Score: 0

      That's because you have yet to learn anything about modern memory management systems.

  37. Re:Turbo Pascal (com files are different) by Anonymous Coward · · Score: 0

    Com files are different. They don't have any of the overhead of a format like ELF or EXE. It's just raw machine code from the very first byte.

  38. nasm by elykyllek · · Score: 3, Informative

    The nasm assembly compiler site that he mentions in the article seems /.'d, theres a sourgeforge project site instead.

  39. 112 bytes for mandlebrot by Anonymous Coward · · Score: 1, Interesting

    I remember writing a 112 bytes executable (including headers) in 68000 assembly language that could draw mandlebrot fractals. I am pretty sure you can't get it smaller than that (at least on the 68000), I'd done the register coloring dependency graph by hand.
    One of the smallest yet greatest thing I ever wrote.

    1. Re:112 bytes for mandlebrot by Anonymous Coward · · Score: 1, Interesting

      The record for mandelbrot on DOS is 69 bytes, and 175 bytes for Linux (by me, framebuffer). See linuxassemly.org -> asmutils

    2. Re:112 bytes for mandlebrot by Anonymous Coward · · Score: 0

      Have you still got it?

  40. Hmmm by Anonymous Coward · · Score: 0

    I win

  41. Emacs? by exp(pi*sqrt(163)) · · Score: 1

    nt

    --
    Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
  42. Even smaller by ggeens · · Score: 3, Interesting
    :
    w

    The colon on the first line is an older version of the #! line, but only works for sh. And of course, `w' is one character less than `ls'.

    On systems that automatically use /bin/sh on unknown files, the smallest possible shell script is:

    w

    Yes, a single character.

    --
    WWTTD?
    1. Re:Even smaller by cjpez · · Score: 2
      Ah, but then you've gotta take into account the size of the shell running your one-character shell script. On my system, /bin/bash (/bin/sh is typically just a symlink to bash nowadays) is 588340 characters. Plus your shell script is, in turn, executing /usr/bin/w, which in turn on my system is 8932 characters.

      You might say, "that's not fair, it gets run, doesn't it?" Well then try running it pedantically:

      $ /lib/ld-linux.so.2 your_script
      Doesn't work so well anymore, does it? :)
    2. Re:Even smaller by ShavenYak · · Score: 3, Funny

      On systems that automatically use /bin/sh on unknown files, the smallest possible shell script is:

      w
      Yes, a single character.


      Actually, a zero-byte file will work as well. Granted, it doesn't do much. But at least it is guaranteed to be bug-free.

      --

      Hey kids, there's only 5 days left 'til Yak Shaving Day!
  43. Re:Largest? (cheater) by Anonymous Coward · · Score: 0

    It's kind of cheating if you are going to include self executing archives on the list.

  44. nice exercise by master_p · · Score: 1

    but apart from that, it's of little use. No sane programmer will code a big app in this way.

    1. Re:nice exercise by mfnickster · · Score: 1

      Actually, I find it thought-provoking when applied to large app development. Probably because I've been playing with Smalltalk recently.

      The most interesting aspect to me is the modularity of objects, and with dynamic binding you can code them and run them independently of the whole application.

      So, thinking along these lines-- you could start with the smallest executable and add objects as needed. You could have a framework that doesn't need to be "finished" just to run it. Some apps are already doing this by using plug-ins for a lot of their functionality.

      Anyway, it sounds appealing to me!

      - MFN

      --
      "Slow down, Cowboy! It has been 3 years, 7 months and 26 days since you last successfully posted a comment."
  45. Well this IS linux by anonymous+coword · · Score: 1

    We should be working on a new faster, smaller executable format, implement it in to the linux kernel, and update compliers for it. A one or two byte program just MIGHT be possible for linux.

  46. 32 byte run-length decompressor? by Zaiff+Urgulbunger · · Score: 2, Interesting

    I remember years ago writting a run-length decompressor in Z80 asm that was 32 bytes. I think the compressor was 50 something bytes!

    I also recall adding up the clock cycles for all of this to try and find the fastest implementation!

    I'm over it now though!

    I'm just glad to forget those cassette-tape based, hand coded assembler days, but it is kind of a shame to see how bloated code has got. If only I'd had a macro-assembler on my Sinclair ZX Spectrum (Timex something or other in the US) in those days... oh the world could've been mine!!

    1. Re:32 byte run-length decompressor? by smallfries · · Score: 1

      Should've got a copy of Hisoft's Devpac dude, it was clearly the ... oh my god what am I doing actually writing this drivel. Stop, Stop! St

      --
      Slashdot: where don knuth is an idiot because he cant grasp the awesome power of php
    2. Re:32 byte run-length decompressor? by Zaiff+Urgulbunger · · Score: 1

      I'll have to try to resist the temptation to download Devpac from somewhere and run it on an Emulator.... and then key in my assembler. Funny thing is, I've long since thrown out my dead speccy's and zillions of tapes and books and crap bits of hardware (a light-pen I ask you? why?!) but I've *still* got my old hand-written assembler in a folder. Can't throw it out, but can't do anything with it either!

    3. Re:32 byte run-length decompressor? by Anonymous Coward · · Score: 0

      Oh, sure, you laugh now, but the best debugger in the world started it's days as a binary hack of Mon.

  47. Of course shortly thereafter... by 4minus0 · · Score: 3, Funny

    Linus wept.

    linuxdoc.org
    Chapter 11
    Verse 35

    --
    You've got an easy breezy wind at your back...most of the time.
  48. Its slashdotted. by anonymous+coword · · Score: 1

    Could some one put up a mirror (its only 45 bytes after all)

    1. Re:Its slashdotted. by Anonymous Coward · · Score: 0

      OK troll, I'll bite:

      $ hexdump a.out
      0000000 457f 464c 0001 0000 0000 0000 1000 0000
      0000010 0002 0003 002d 0000 1020 0000 0004 0000
      0000020 2ab3 c031 cd40 0080 0034 0020 0001
      000002d

  49. test by Anonymous Coward · · Score: 0

    testing

  50. only 45 by CaptnMArk · · Score: 1

    If he managed to get to 42 bytes the universe would probably end...

    1. Re:only 45 by Anonymous Coward · · Score: 0

      There is a theory which states that if ever anyone runs an executable in 42 bytes, the Universe will instantly disappear and be replaced by something even more bizarre and inexplicable.

      There is another theory which states that this has already happened.

  51. thats nothin by LiENUS · · Score: 1

    pfft thats nothing, i once wrote an application that was 8 bytes, of course its only purpose was to jump to another memmory location and it had no headers or anything .globl start .text

    start:
    mov.l boot2,r0
    jsr @r0

    boot2: .long 0x8C00E000

    1. Re:thats nothin by Anonymous Coward · · Score: 0

      your a lier, RTFA - it is impossible to be less that 45 bytes, as it is a critical part of the ELF header.

    2. Re:thats nothin by LiENUS · · Score: 1

      there were no headers, just raw binary.

  52. isn't this illegal? by DuctTape · · Score: 1
    Um, isn't this illegal to put out under the DMCA? I mean, this will give every script kiddie on the planet the ammunition to put viri and other unpleasantness inside ELF headers. No telling what they'll end up putting in the unused comment header, too.

    Better not answer the door today, Mr. Raiter. Could be Flowers By Irene.

    --
    Is this thing on? Hello?
    1. Re:isn't this illegal? by praxim · · Score: 1

      He didn't exactly have to circumvent any copy protection to do this.

  53. proccessing in today's world by eng69 · · Score: 5, Funny

    The current state of elf proccessors demands an astounding amount of system resources. When combined with dwarf co processor, it provides for unparalleled carnie access.

    1. Re:proccessing in today's world by El_Nofx · · Score: 2

      His first post everybody! Give him a round of applause for nailing a 5.

      --
      It's not the OS it's the user that sucks. If it's user friendly, you get stupider people. - clinko
  54. its not executable size that matters by Capt.+Beyond · · Score: 2, Interesting

    Its not so much the executable size that really matters (when talking about bloat), its the memory consumption of the program that really matters.I could write a very small program size wise that would drain your memory and crash your system, or make it slow down to a crawl.

    --
    -- "Perceptions create reality. By changing your perceptions you change your reality."
    1. Re:its not executable size that matters by Anonymous Coward · · Score: 0

      I think only sum1 with a small executable would say size don't matter.

  55. MenuetOS by jaaron · · Score: 4, Interesting

    On a similar topic, MenuetOS is a full OS written in assembly and fits on a floppy. Yeah, lots of OS's used to fit on floppies, but it's still cool. It's amazing what all you can fit into a small space if you're careful.

    --
    Who said Freedom was Fair?
    1. Re:MenuetOS by burns210 · · Score: 1

      yes, it is a full operating system on a floppy, but now only that, the darn thing has a GUI, too!

    2. Re:MenuetOS by Anonymous Coward · · Score: 0

      MenuetOS reminds me of an old joke.

      Two old ladies are sitting on a park benching,
      listening to clasical music on a transistor radio.
      The first lady says "Do you remember the Menuet?"
      The second lady replies "Heck no. I don't even remember the ones I fucked."

  56. On bloatnesses by Ektanoor · · Score: 4, Insightful

    Well this reminds me the golden days of DOS (not Denial Of Service but Disk Operating System... well, anyway it didn't made a difference). Back then people fought for every bit of code. And assembler was as popular as C or Pascal.

    However, using assembler this way is not the most optimal resource. Frankly this piece of code is only useful if you need some real tiny program and you are running out of space and speed. But, today, 99.99...% of tasks don't need it. The optimal way to use such tricks is to concentrate in tasks that really need "the best and fastest code ever". These are drivers and situations where speed's price costs gold. Usually this is done by injecting the necessary asm directives into C or any other language. Writing everything in pure Assembler is unpractical and the result may become harder to understand than the Rosetta Stone.

    However the article is making a point - how unoptimised are the present compilers. For example, GCC is mostly C in C. It makes it highly portable, but, if anyone decided to repeat Turbo Pascal feat (most of its base code was Assembler), I know that binary code would shrink to the impossible. Right now we may not be feeling this drawback as bloatness still doesn't clog everything. In the future this situation may change if speed and reliability turn to higher priorities.

    Some note for the bloat FUDders: This is not a reason for Linux distros being bloat. First learn to be rational on your needs and don't install everything in one box. Second, learn a little bit of administration, maybe some programming and kick that (mega_kernel) + (some_highly_featured_libs) + (several_unuseful_apps) out of your box. Then you will know that Linux can help fry eggs on your processor with lightning speed. Till then, keep the flame for yourself and read "Why I switched from Mac to Windows".

  57. Zero byte program by Anonymous Coward · · Score: 0

    > echo 42
    42

    Doesn't require any program at all!

  58. 42 bytes? by jhittner · · Score: 1

    SO... mabey 640K is more then anyone will ever need.

  59. you by Anonymous Coward · · Score: 0

    lose

  60. Now that my friends.... by espresso_now · · Score: 0, Offtopic

    Is a hack!

    --
    Of course, and I highly suspect it, I may be talking out of my ass. -oqti
  61. Good start for a virus by Anonymous Coward · · Score: 0
    There is one place where this size is really important. A virus? Every byte counts when your overflowing a buffer to then execute some code you've stuffed in memory.

    I don't think a virus that copied over "windows.exe" into memory would infect many dialup computers, can you say "Too frigen big". ;)

    But something based on this optimized code that maybe did? rm -rf / hmmm...

  62. i love this by sysrequest · · Score: 2, Insightful

    it may not be all TOO practical, since a lot of people try to ensure that their program runs on multiple architectures and platforms, but I also miss the old (DOS) days when the demo scene tried to optimize their intros to fit a half an hour of entertainment into 64k, with full sound blaster support. the registers of the vga cards were abused to no end, lightening fast assembler procedures were optimized either for size, or for speed by unrolling loops, etc.

    while that isn't practical anymore these days, a LOT of code has become very sloppy. More than once have i stumbled over some college kids c app that was supposed to demonstrate linked lists, and instead, it was using one class with an array.

    programming is an art, like acting. many try and are good enough for some purposes, but only a selected few are masters. sounds pretty damn philosophical, don't read too much into it :)

  63. Could be used to make "true" smaller. by hey · · Score: 3, Funny

    On Red Hat 8.0 I get:

    $ wc -c /bin/true
    9752 /bin/true

    That's thousands of extra bytes - eek.

    1. Re:Could be used to make "true" smaller. by anonymous+coword · · Score: 1

      On Mandake 9.0 I get : $ wc -c /bin/true 9784 /bin/true That's 32 bytes larger. Its slowly getting bigger and bigger.

    2. Re:Could be used to make "true" smaller. by octalc0de · · Score: 1

      (rh-7.3)

      $ wc -c /bin/true
      9704 /bin/true


      It's getting bigger! Soon it'll be up to 20,000 bytes! (estimate: around RedHat 19.0)

    3. Re:Could be used to make "true" smaller. by DMDx86 · · Score: 1

      Heh.. I'm on an Alpha CPU, so its even worse
      (RISC vs CISC, blah blah)

      [dmdx86@dmdtech dmdx86]$ wc -c /bin/true
      14336 /bin/true

    4. Re:Could be used to make "true" smaller. by Anonymous Coward · · Score: 0
      Take this:
      $ wc -c /bin/true
      8956 /bin/true
    5. Re:Could be used to make "true" smaller. by Jeremy+Erwin · · Score: 2

      I seem to recall that GNU true responds to the "--help" flag.

      On MacOSX:
      wc -c /usr/bin/true
      9572 /usr/bin/true

    6. Re:Could be used to make "true" smaller. by Carl+Drougge · · Score: 1

      The BSDs seem to be better at this than Linux-distros.. In FreeBSD I get:

      marvin@book% wc -c /usr/bin/true
      2976 /usr/bin/true

      And in OpenBSD I get:

      drougge@bob% wc -c /usr/bin/true
      79 /usr/bin/true

      And that's OpenBSD/sparc64 too.. (Which doesn't matter one bit since it's a actually shell-script, but still..)

    7. Re:Could be used to make "true" smaller. by Anonymous Coward · · Score: 0

      For a good laugh, look at the contents of /bin/true
      on Solaris. I'd post it here, but a viewing will
      make the reason for my silence obvious.

  64. People are missing the point by Kenneth+Stephen · · Score: 5, Insightful

    Looking through the comments here I see two main threads : (1) Squeezing out the last few overhead in a program leads to hard to understand / maintain program and thus is not worth the effort. (2) Whats the big deal anyway in this era of 100 GB disks and 2GHz processors?

    While both these criticisms are valid, they miss the point. Firstly, it wasnt the objective of the author to squeeze the last few bytes out of that program to save resources. He was just putting his hard-earned knowledge to use. He was doing it because he could! This is the same motivation for people who climb mountains : because the mountain is there, and because they can climb it. Indeed, if the author were seriously looking into saving resources, he'd hardly be wasting his time on a trivial program, would he?

    Secondly, one of the authors intentions was to demonstrate the limits to which austerity could be taken to. Certainly, this was a trivial program - but the same principles could be used to shrink larger non-trivial programs, and it those cases, the savings could possibly be larger. Of course, it those cases, the largest savings would come from a good optimizing compiler rather than crunching the headers together. More importantly, the author has exposed whole new ideas and lines of possibilities to programmers.

    --

    There is no such thing as luck. Luck is nothing but an absence of bad luck.

  65. Two useful programs by Anonymous Coward · · Score: 0

    strip upx They work wonders.

  66. Excellent troll! by PurpleFloyd · · Score: 4, Insightful
    Linux software is horribly bloated, like even "ls" is above 30k
    ls is probably statically linked (all necessary libs reside within the executable), so it will function in almost any circumstance where the executable itself is not corrupted. Would you really want to try to repair a broken system without ls? Most critical utilites and shells are available in statically-linked forms (if not, you can do it yourself). While executable size is an important consideration, it isn't the only one. I would rather have a set of basic programs (like ls) that work even if all the lib directories are toasted, than to save a few K here and there, and have a system that could never pull itself back up if broken.
    --

    That's it. I'm no longer part of Team Sanity.
    1. Re:Excellent troll! by vranash · · Score: 1, Insightful

      Actually dude, last time I fscked up my libc install it turned out it, cp, mv, and most of the other utilities were NOT. In fact, just compiling a Hello World! program with dynamic linking takes up 5K, and something around I believe 275k statically linked, so indeed Linux's binaries do appear quite bloated, at least on the lower end (2.95.3 vs 3.2 sees a difference in larger executables, I've seem ~10% change either smaller or larger depending on the program being compiled)

    2. Re:Excellent troll! by DeeKayWon · · Score: 5, Informative
      Funny. My /bin/ls (Debian unstable) is nearly 60k, yet is dynamically linked, and is even stripped.

      % ls -l /bin/ls
      -rwxr-xr-x 1 root root 59592 Oct 8 20:17 /bin/ls*

      % ldd /bin/ls
      librt.so.1 => /lib/librt.so.1 (0x40022000)
      libc.so.6 => /lib/libc.so.6 (0x40034000)
      libpthread.so.0 => /lib/libpthread.so.0 (0x40147000)
      /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

      % file /bin/ls
      /bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.0, dynamically linked (uses shared libs), stripped
    3. Re:Excellent troll! by Anonymous Coward · · Score: 0

      pthread for ls? *doh*

    4. Re:Excellent troll! by cvore · · Score: 1

      A 1017 bytes version can be found on http://www.muppetlabs.com/~breadbox/software/tiny/ :-)

    5. Re:Excellent troll! by looxix · · Score: 1

      ls is probably statically linked Certainly not, a "return 42;" statically linked with glibc-2.2.3 and maximally stripped is more tha 300Kb.

    6. Re:Excellent troll! by rplacd · · Score: 2, Interesting

      > Would you really want to try to repair a broken system without ls?

      I've had to -- echo * works well enough, sometimes. Some Linux install disks give you a shell, but few utilities other than mount, mknod, cat, etc. Now, if they gave us ed I wouldn't have to "cat >> /mnt/etc/fstab" and the like.

      If you search the FreeBSD freebsd-hackers mailing list, you'll even find a "more" command implemented with shell builtins (at least, I don't remember it using cat). It's too long to remember, though.

    7. Re:Excellent troll! by Dahamma · · Score: 2, Insightful
      Can't believe this was modded up to 5!

      The first post called Linux software bloated (oh come on, glibc is VERY bloated - try using at uclibc or dietlibc - they don't have 100% of glibc's functionality, but for embedded systems it's amazing how much space they save) and it's a troll?? Then he makes a statement that starts with "probably" and turns out to be wrong - Debian and RedHat 'ls' definitely link with several libs. I won't say "probably", but who wants to bet on how many of the other major distros do as well?

      Ok, to put something less whiny in my post - if you're worried about having a functional set of utils for emergency use, install busybox. For ~800k statically linked you get a ton of utils in a multicall binary, along with a shell. Available from the RedHat install CDs, in fact.

    8. Re:Excellent troll! by Anonymous Coward · · Score: 0

      Funny, I've had to do work on corrupted partitions without the "luxury" of ls. It is called

      echo *

    9. Re:Excellent troll! by ShavenYak · · Score: 3, Funny

      Is that why it took Deep Thought so long to execute it?

      --

      Hey kids, there's only 5 days left 'til Yak Shaving Day!
    10. Re:Excellent troll! by Thrakkerzog · · Score: 1

      try echo *

      just in case you ever happen to lose ls!

    11. Re:Excellent troll! by serial+frame · · Score: 1

      ls' large size is somewhat justified. Implementing ls, one would have to include code for parsing symbolic file modes (which is a considerable amount), terminal handling code (how else will your files be sorted in columns without a little knowledge of your terminal?)

      Then again...it's not so justified; you're probably looking at GNU ls. At compile time, it internally links in libfetish.a (which contains tons of code unrelated to what ls does), and libintl.a (which isn't always needed, either).

      Blame GNU!

      --

      -
      And the Angel said unto me, "These are the cries of the carrots! The cries of the carrots!"
    12. Re:Excellent troll! by Anonymous Coward · · Score: 0

      no need for ls since you have echo /*, also it only relies on a running shell :)

    13. Re:Excellent troll! by onallama · · Score: 1

      Don't be so sure -- I don't know about other distributions, but in RedHat at least, just about everything is dynamically linked. So long as your system comes up far enough to start a statically linked shell, "echo *" can fill in for ls in a pinch (yes, I've had to do this), but I definitely prefer the BSD practice of statically linking the contents of /bin and /sbin.

    14. Re:Excellent troll! by Tony+Hoyle · · Score: 2

      Repair a broken filesystem without ls?

      echo *

    15. Re:Excellent troll! by Tony+Hoyle · · Score: 2

      > Some Linux install disks give you a shell, but
      > few utilities other than mount, mknod, cat, etc.
      > Now, if they gave us ed I wouldn't have to "cat
      > >> /mnt/etc/fstab" and the like.

      Boot knoppix - you get a fully installed KDE desktop... (OK overkill I know).

    16. Re:Excellent troll! by Tet · · Score: 3, Interesting
      I've had to -- echo * works well enough, sometimes. Some Linux install disks give you a shell, but few utilities other than mount, mknod, cat, etc. Now, if they gave us ed I wouldn't have to "cat >> /mnt/etc/fstab" and the like.

      For probably the ultimate description of recovering from a screwed system without access to the normal tools, see Al Viro's inhuman heroics here.

      --
      "The invisible and the non-existent look very much alike." -- Delos B. McKown
    17. Re:Excellent troll! by FooBarWidget · · Score: 2

      ls does more than simply listing some files! Try ls --help. It supports sorting (by name, size, time, etc.), coloring, display sizes in different formats, display control, recursive listing, show/hide backup/hidden files, etc. etc. The 30 KB is completely justified when you look at all the features! This is the Unix philosophy: do only one thing, but do it [b]as well as you can[/b].

      Really... 30 KB is "bloat"? Hello? What's 30 KB compared to 80 GB? Everquest, which takes more than 1 GB on your harddisk, now THAT's bloat!

    18. Re:Excellent troll! by Tomble · · Score: 1
      Yow, that's terrifying- I wish I knew Linux's internals that well.

      I think the closest I got to one of these situations was when I was upgrading to glibc a few years back, and managed to screw the process up leaving my system without any libc (I renamed the original one* ). But after much panicking I found that ldconfig at least was statically linked, and sure enough it was able to restore all the symlinks, bringing the system back to how it had been originally (I was then able to do the upgrade properly).

      That was clearly not even in the same solar system as what he (Al Viro) had to deal with, but I suppose he is a kernel developer, isn't he??

      (*-Yes, I know it was lame of me to have done that, I should have payed closer attention to the instructions that said to cp it. We all make mistakes...)

      --
      Be careful! New moon tonight.
    19. Re:Excellent troll! by Hater's+Leaving,+The · · Score: 1

      Just press TAB twice to see all the files, no need for this bloated 'echo' nonsense! :-)
      It even _pages_ the output if there's more than a screenful of files

      THL.

      --
      Keeping /. cynic density high since the fscking Kwhores/trolls arrived.
    20. Re:Excellent troll! by main() · · Score: 1

      > Would you really want to try to repair a broken system without ls?

      Pah! You pansy!

      % echo * ... does the job nicely 8-)

      Si

    21. Re:Excellent troll! by vidarh · · Score: 2

      Of course if you're running bash or another shell with tab expansion, all you really need is to type a character or two and press tab twice.

  67. It doesn't save any disk space by Gerry+Gleason · · Score: 5, Insightful
    Below the filesystem size quantum, you don't save anything anymore. You can't allocate less than a page of memory either.

    Beyond some point, the article is really just silliness, interesting or not. Below 512 bytes, your not going to save anything on any system. Ok, there are filesystems that compress things further for squeezing into flash memory and such, so maybe there are some marginally useful applications, but still the header overlapping is a bit much to be worth considering.

    1. Re:It doesn't save any disk space by p3d0 · · Score: 5, Informative
      Consider:
      1. If you compress these things onto a floppy, every byte counts.
      2. Some filesystems like ReiserFS use tail packing to put multiple files (or file tails) into a single block.
      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
    2. Re:It doesn't save any disk space by rmdyer · · Score: 0, Offtopic

      For all those who never understood what the true nature of the Windows registry is about this thread emphasizes the point.

      The Registry was created for the purpose of storing and retrieving local OS and application configuration data in a convienient and highly organized way. In this manner the registry is simply seen as a local database that the OS has direct access to. An operating system process database so to speak.

      On the list of registry requirements is speed. The registry is optimized for extremely high speed reads as well as writes. It was discovered early on that storing small amounts of information such as Bytes, Words, Strings, and such directly on the file system in separate files was a problem. Opening, reading, and closing files requires many I/O operations which eats up CPU, and can be taxing on the hardware subsystems. Hard drive caching and file caching can prevent some of the problems caused but do not really provide an adequate solution.

      Another issue is that small data elements don't make effective use of the allocated disk space. Especially in the early days with small hard drives this was a BIG issue. You certainly don't want to open a file, save a byte, and close the file. You might end up using a whole sector. Depending on which filesystem type you used, you could lose almost half your disk just by storing small files. With text files the problem is even worse. You end up opening the file, parsing out the data with routines, then converting it to the data type you need. By nature, text representations of the data values will be larger, wasting valuable disk space.

      As we have seen with network database access, a database access protocol optimized for high speed reads is important. The LDAP specification addresses some of these concerns. As well with the registry, we need the ability to store and retrieve data fast with minimal space cost. Microsoft decided to create a set of files called HIVEs that are essentially open from the moment the OS boots. The OS caches these HIVEs in memory. The OS as well as applications have access to the HIVEs through a special set of high speed access APIs. All the APIs need for access to a HIVE is its global handle value.

      The HIVEs are organized hierarchically similar to a file system. This makes a registry HIVE exactly like a "file system on top of a file system". In this case since a HIVE is stored on the real file system as a single contiguous block and always open, it makes disk space efficient and I/O fast. Its just a specialized mini file system database for configuration data.

      Key names in the HIVEs are folders. The keys contain registry values which contain the actual data. The values are typed so as to also maximize speed. There are user, software, and system data HIVEs. HIVEs can be mounted or unmounted, and symlinks can be created from one key to another. Registry keys can be protected with the same ACL protection mechanism that NTFS uses.

      If you want to see how fast the registry is in action just download the regmon.exe probe from www.sysinternals.com and watch what happens when you do anything in Windows. The amazing dependencies that make themselves apparent by watching regmon can easily show you that doing I/O out to disk would cause everything to slow to a crawl, as well as put more pressure on your already loaded disk I/O system.

      Registry key values are NOT made to store large amounts of data. You aren't supposed to store entire files as value data. Indeed, that would make what the registry was made for pointless. One of the problems is that many application programmers either don't understand how to use the registry correctly, or just use it for the wrong purpose. The current registry is BIG. The information stored in the registry has gotten out of hand. Even Microsoft can't stop storing useless information in there. It is easy to say that the registry might become corrupted, but this also happens with file systems themselves. You do occasionally have to run a file system check. Ever lost a binary database file before?

      Data in the registy can be easily back'ed up using the regedit tool that comes with the OS. You simply export what you need to a text file. The text file can then be re-imported later when needed. If you want to backup a whole HIVE file such as SOFTWARE you can do that too. Many backup utilities will do exactly that. It is even possible to backup the HIVEs without being in the OS. Just boot to another OS and copy the files off the disk (assuming you can read and write to NTFS). I really don't see the problem with registry backups. And hey, in the end, the registy is just a simple set of files stored on the filesystem just like any other files in *nix.

      Since the registry API is in effect and abstraction layer, Microsoft could re-write the back-end completely. What about a network registry? We could relocate the files out onto a network server and the applications wouldn't know. Microsoft could encrypt the data, compress it, whatever. I don't know what Microsoft's future plans are for the registry interface. Any of these things would make access slower so I expect that the design will stay the way it is for now.

      We all have fast and big hard drives these days so the registry does seem kind of pointless. But if we were all using slow small drives we would really appreciate the technical merits of the registry. Even more so, users of a registry can now enjoy that their data is being store both effectively and efficiently. Linux would do well to adapt to some kind of OS database for its configuration settings and local accounts even if it isn't regsitry like. But if you want to continue to store a 64 BIT value in a text file as "0xFFFFFFFFFFFFFFFF" be my guest. (BTW, this is the same problem I have with HTTP, inefficient as hell!)

    3. Re:It doesn't save any disk space by imbezol · · Score: 1

      If you had many of these optimized programs though, you could distribute them in a very compressed .tar.gz regardless of whether they would take up a minimally smaller amount of drive space once installed.

    4. Re:It doesn't save any disk space by mirabilos · · Score: 2

      Try romfs then. I built a GNU/Linux distro in 2000
      which used romfs and ext2fs (only because xiafs is
      orphaned) natively and could be installed into a
      ext2fs partition or a loopback-root image on, e.g.
      a FAT partition.

      Maybe I'll upload it one time.

      --
      My Karma isn't excellent, damn it! (And /. still does not get UTF-8 right in 2012. Wow.)
    5. Re:It doesn't save any disk space by p3d0 · · Score: 1

      Sorry, what was your point?

      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
    6. Re:It doesn't save any disk space by Anonymous Coward · · Score: 0

      Although, if you've optimised it properly the file won't compress as there will be no redundant information. You could still tar several tiny files together into one larger file.

  68. 4K Demos by Wraithlyn · · Score: 5, Interesting

    Some of the 4K demos I've seen written for ASM competitions completely blow my mind... check out this one, it's basically a flythrough of the first level of Descent, with texture mapping, source lighting, animated lava and recharger field, a MIDI soundtrack, etc... all in 4095 bytes!!!

    Here is Sanction's home page, it contains a couple more very impressive 4K demos.

    --
    "Mind, as manifested by the capacity to make choices, is to some extent present in every electron." -Freeman Dyson
    1. Re:4K Demos by Ektanoor · · Score: 3, Informative

      The Demo scene had always beat the usual coders. Not long ago we had a national festival with guys coming all over from Russia. Some demos, mainly Amiga and Spectrum, were impressive. Some 3D effects were shown on machines that lack any types of acceleration. And these things ran nearly with the same speeds we frequently saw in some powerful Pentiums. Besides, the PC demo presented things shrinked to the impossible with a speed, sound, space and color effect that beated many popular games.

      I wonder the speed and the effects some Doom III would have if it was written mainly in Asm...

    2. Re:4K Demos by Wraithlyn · · Score: 3, Interesting

      Do you remember Future Crew? And the legendary Second Reality demo of '93? (Available here, but can be hard to run properly on modern systems) Apparently many of those guys are now working at Remedy... which may explain why Max Payne is such a graphically beautiful game... I wouldn't be surprised in the slightest if the Max FX engine employs some nice ASM routines. Also, check out their Final Reality benchmark, the final "cityscape flythrough" is a homage to a nearly identical (albeit flat shaded) sequence in Second Reality. Cool shit.

      --
      "Mind, as manifested by the capacity to make choices, is to some extent present in every electron." -Freeman Dyson
    3. Re:4K Demos by /dev/trash · · Score: 2, Insightful
      I wonder the speed and the effects some Doom III would have if it was written mainly in Asm...

      I wonder if we'd even HAVE Doom III now if it was written in asm.

    4. Re:4K Demos by Anonymous Coward · · Score: 0

      well, we don't HAVE it NOW, do we ? ;)

    5. Re:4K Demos by davew2040 · · Score: 1

      My guess is that Doom 3 relies very heavily upon the features of the hardware acceleration, rather than on the specifics of the engine. Though writing pixel and vertex shaders is pretty asm-like these days, with the exception of that, hardware accelerated effects and software effects written in asm just don't mix. I could be mistaken.

    6. Re:4K Demos by scrytch · · Score: 2

      > Apparently many of those guys are now working at Remedy

      First thing I thought was "damn, I can't think of a bigger mismatch than demoscene coders working for Remedy Corp" ... yah I think in HTML :)

      --
      I've finally had it: until slashdot gets article moderation, I am not coming back.
    7. Re:4K Demos by Broccolist · · Score: 2
      I wonder the speed and the effects some Doom III would have if it was written mainly in Asm...

      It would just take a lot longer to write. The reason demo efficiency blows the socks off anything in games is because demos are specifically designed to render a single scene and nothing else, not because demo coders are that much better at optimization than game coders (they are often the same people). What makes the difference is the various hacks demo programmers can pull off because they only have to worry about a single situation.

      Anyway, with the advent of 3d accelerators, the whole scene has become rather meaningless --- the bottleneck of Doom 3 will be your GPU, not the efficiency of the x86 asm.

  69. aka iefbr14? by Anonymous Coward · · Score: 0

    You don't get shorter than that golden oldie...

  70. What about the Visual Studio .NET compiler? by Jugalator · · Score: 5, Interesting
    Stand-alone console EXE (Release Build):
    #include "stdafx.h"

    int _tmain(int argc, _TCHAR* argv[])
    {
    return 42;
    }
    Size: 20,992 bytes

    To be compared with the non-optimized gcc version at 3,998 bytes. :-)

    I wonder how small you can make a Windows EXE..
    --
    Beware: In C++, your friends can see your privates!
    1. Re:What about the Visual Studio .NET compiler? by Jugalator · · Score: 5, Interesting

      Hm... I stripped the code from stdio.h, replaced _TCHAR* with char* so the stdafx.h doesn't really do much at all. Then turned on size optimizations and turned off boundary checks etc in the compiler. Still exactly 20992 bytes. Huh?? Browsed the exe and there's full text messages like "ooh something corrupted the state of this program and it cannot safely continue". Which is actually a great addition by Microsoft, but can't you remove such things? :-)

      But I guess the .NET compiler has its lower limits where bloat get called feature, just surprising that it seems to compile at the minimum size by default... Or perhaps it use some kind of silly padding so even if there's less code, the physical size isn't reduced.

      --
      Beware: In C++, your friends can see your privates!
    2. Re:What about the Visual Studio .NET compiler? by Anonymous Coward · · Score: 0

      You can make a Windows executable that's 1024 bytes using C and VC++. I think you have to use -opt:nowin98 with at least VC++ 6.

      See this article.
      http://www.microsoft.com/msj/defaulttop. asp?page=/ msj/archive/s569.htm
      http://www.microsoft.com/msj /code1993to1997/MSJOCT 96.EXE

      Here's another sample.
      ftp://ftp.wdj.com/pub/1998/jun98.zip
      Loo k in Techtips.zip/Pehrson.zip

    3. Re:What about the Visual Studio .NET compiler? by rplacd · · Score: 1

      Using Mono, I compiled this:

      class test {
      static int Main(string[] args) {
      return 42;
      }
      }

      I got:

      % mcs test.cs
      [00:000] - FindMembers timer (used 0 times)
      [00:003] - TypeContainer.FindMembers timer (used 23 times)
      [00:014] - MemberLookup timer (used 2 times)
      [00:000] - CachedLookup timer (used 1 times)
      [00:031] - Cache init (used 2 times)
      [00:001] - Misc timer (used 1 times)
      0 - Find members
      2 - Member cache
      0 - Misc counter
      Compilation succeeded
      % ls -l test.exe
      -rw-r--r-- 1 fn wheel 2048 Oct 20 00:07 test.exe
      % mint test.exe
      % echo $?
      42
      %

      Now, technically, this test.exe (which is, in reality, a binary of sorts) should run on Windows as well, as long as you have the .Net infrastructure in place.

    4. Re:What about the Visual Studio .NET compiler? by Anonymous Coward · · Score: 0
    5. Re:What about the Visual Studio .NET compiler? by seattle2napa · · Score: 1, Informative
      Change this to not include anything, change main to "int main()", and the compile like this:

      cl ft.cpp /O2 /link /opt:ref /entry:main

      1024 bytes - the linker always pads to the next page.

      If you look at the .text section, it's 16 bytes.

    6. Re:What about the Visual Studio .NET compiler? by djmurdoch · · Score: 2

      I wonder how small you can make a Windows EXE.

      Windows supports 3 or 4 different formats of .EXEs. The oldest format (what used to be .COM programs in DOS) lets you write that program in 5 bytes, B8 2A 4C CD 21. (Maybe less, my DOS programming skills are a little rusty.)

    7. Re:What about the Visual Studio .NET compiler? by jhonsrid · · Score: 1

      The same code compiled with Visual C++ v6 with /O1 set comes out at 36,864 bytes.

      (!)

    8. Re:What about the Visual Studio .NET compiler? by Dr.+A.+van+Code · · Score: 1

      $ cat Test.java
      public class Test {
      public static void main(String[] args) {
      System.exit(42);
      }
      }
      $ jikes -O Test.java
      $ java Test
      $ echo $?
      42
      $ ls -l Test.class
      -rwxrwxrwx 1 Dave None 312 Nov 1 08:56 Test.class

      2048 bytes vs. 312, but you can't run the .class file directly. I assume you can just type "test" and it'll find the .NET runtime itself, or would you have to type "mint test" there, too?

      (The java .class file is a binary *of sorts*, for sufficiently lax values of "of sorts.")

      --
      Good mfences make good neighbors.
  71. No one will ever need more than 640K anyway... by Nick+Driver · · Score: 1, Redundant

    ... so said our illustrious nemesis.

    1. Re:No one will ever need more than 640K anyway... by seattle2napa · · Score: 0
      If you're referring to the illustrious Mr. Gates, that's a myth.

      See this:

      http://www.urbanlegends.com/celebrities/bill.gates /gates_memory.html

  72. 45 bytes??? Wow... by WWWWolf · · Score: 1

    ...but I coded a program to display "Hello World!" in assembly, including its own routine to display the text, and it's 45 bytes too, and I'm just an assembly newbie. Of course, this is for Commodore 64, an architecture that only needs a two-byte program header (load address)... =)

    PCs these days need way huge file headers... but I suppose it's worth it. =)

  73. WRONG by anonymous+coword · · Score: 1, Troll

    wc -c /bin/echo
    12024 echo

    12 kilobytes just to write a program to write text to the screen. Boy, you linux zealots must love shelling out for those 320 gb hard drives.

    1. Re:WRONG by guile*fr · · Score: 1

      eerrrr... this is not linux this is GNU... even true & false have --version & --help

  74. Any program can be written using one less byte by shoppa · · Score: 3, Funny
    It's a well known fact that
    Any program can have at least one reduncdant byte removed or optimized away and still function

    In fact, just apply this fact iteratively and you'll find that any program can be written in zero bytes!

    1. Re:Any program can be written using one less byte by Vann_v2 · · Score: 1

      Only if you don't know what redundant means...

    2. Re:Any program can be written using one less byte by Anonymous Coward · · Score: 2, Funny

      furthermore, it is well known that any program will inevitably have at least one bug.

      hence, we can deduce that *all programs can be reduced to a single byte... which won't work!*

    3. Re:Any program can be written using one less byte by Eythian · · Score: 2, Funny

      Any program can have at least one reduncdant byte removed or optimized away and still function

      Actually, I believe it is this:

      Axioms:

      1. Every program can be shrunk by at least one intsruction.
      2. There is always one more bug.

      From this, we can conclude that any program can be written as one byte that doesn't work.

  75. Not really.... by octalc0de · · Score: 1

    You wasted two bytes! Looking at the HTML source, your message reads: . You can save two bytes by using this code:

    Remember to get rid of your whitespace! :)

  76. Krap! by octalc0de · · Score: 1

    Ok, what I MEANT to say was

    You wasted two bytes! Looking at the HTML source, your message reads: "<b> <i> </i></b>". You can save two bytes by using this code: "<b><i></i></b>"!

    I'll use preview next time, I promise! ;)

  77. the assembler bit error by Anonymous Coward · · Score: 0

    ...Apparently when compiling tiny.s assemler doesn't like the
    ; tiny.s
    bit, but compiles without it with the error message:
    tiny.s:0: Warning: end of file not at end of a line; newline inserted

    Anyone's got any clues?

  78. Scene it by illuminatedwax · · Score: 1

    I think I've actually seen this a couple years earlier. There's actually a site, http://www.scene.org that will have contests to see who can make the best demo squeezed into 64k. There's tons of these available in the archives; here's an example.

    --
    Did you ever notice that *nix doesn't even cover Linux?
  79. Going for massively off-topic here but... by Graspee_Leemoor · · Score: 1

    "Ah, kamisama! Ore no atama ni ono ga arimasu yo!."

    This is not a criticism or "correction", but I am genuinally interested because I am learning Japanese:

    Shouldn't it be "Ore no atama ni wa ono ga arimasu yo!"

    And does it mean "Oh, God! There really is an axe in my head!" (or "There IS an axe in my head!" - I'm having trouble translating the "yo" without knowing the context).

    Ah, come to think of it, it isn't a quote from "Battle Royale" is it ? I cracked up when that guy had an axe sticking in his head and the hero just goes "Daijobu desu ka?" ("Are you all right?").

    graspee

    1. Re:Going for massively off-topic here but... by red_dragon · · Score: 1

      You're right, it does mean "Oh, God! There is an axe in my head!". Actually, it's more like "There is an axe in my head, I tell you!", due to the presence of the "yo" sentence particle.

      I don't think it'd make much sense to follow a particle with another ("ni" and "wa"). My Japanese is pretty craplousy, however, so don't quote me on that.

      The phrase comes from some website I found at random, which had "Oh, my God! There is an axe in my head!" translated into many different languages. And I was bored, so I found it amusing.

      --
      In Soviet Russia, Jesus asks: "What Would You Do?"
    2. Re:Going for massively off-topic here but... by Graspee_Leemoor · · Score: 1

      It's just that in a Japanese grammar book I have it gives the example:

      "watashi no heya ni wa sutereo ga arimasu"

      for

      "There is a stereo in my room".

      So- who knows.

      eep- my karma will take a hit from this offtopic exchange- now I will have to funny and insightful for ages...

      graspee

    3. Re:Going for massively off-topic here but... by Anonymous Coward · · Score: 0

      When I was working on a project in Japan, we had a run of bad luck. My Japanese colleague shook his head and said a few words. I asked him to translate to english and he said "There are bees on our faces, and now it's raining." It broke me up.

      So how would you say "There's an axe in my head and now it's raining."?

      BTW, what *was* the original topic?

    4. Re:Going for massively off-topic here but... by Nexx · · Score: 2, Informative

      "Ah, kamisama! Ore no atama ni ono ga arimasu yo!" is quite correct. To my ears, the use of "wa" makes the rhythm of the sentence quite lethargic. Though it may not be correct textbook Japanese (the use of the word "yo" already makes it conversational, and thus, some leeway in grammar is allowed), between peers, this usage will be quite acceptable.

      Yes, I do speak Japanese fluently :-P

    5. Re:Going for massively off-topic here but... by Graspee_Leemoor · · Score: 1

      Thanks! It's great when I can get information from fluent speakers of Japanese!

      graspee

    6. Re:Going for massively off-topic here but... by grainofsand · · Score: 1

      Actually, I think:

      "Ore no atama ni ono ga sasateruyo"

      is better for spoken.

      --
      A dream is good. A plan is better.
  80. 624 homepage (exe compressor linux) by newr00tic · · Score: 1


    http://sed.free.fr/624/

    --
    A horse can't be sick, you know, even if he wants to.
  81. A great site concerning this theme by cvore · · Score: 2, Interesting

    www.linuxassembly.org/ - Go there, its free and fun :-)

  82. This is outdated by int0x80h · · Score: 1

    I stumbled on this paper years ago at linuxassembly.org get with the times slashdot!

  83. asmutils does a good portion of this by cgleba · · Score: 5, Informative

    http://linuxassembly.org/asmutils.html

    Check it out, download it and assemble it.
    They create the smalles set of binaries for the basic linux tools that I have found and they employ a good portion of the stuff mentioned in this paper.

    They make busybox look bloated by comparison.

    Another neat trick is to use the ld options "-Wl, gc-sections" when linking a static binary -- it tries to weed out all the unused portions of the libraries it links against.

    The last trick I usually use is to link against uClibc or dietlibc rather then glibc. Makes a noticeable difference. RedHat has been working on a program called "newlib" which is supposed to do the same thing as uClibc or dietlibc but better (for embedded stuff).

  84. auuugh! by quarter · · Score: 3, Funny

    where's your spoiler alert?!!?!?

  85. smallest executable: cero bytes by Anonymous Coward · · Score: 1, Interesting
    Yes, if in Linux (maybe other *nix) you create a file with cero bytes (touch foo) and give it the execution permissions, you can execute it without error nor warning. It is not an elf executable and
    after executing it you obtain: nothing (as you guess), but it is a funny completness property of system (null operator).


    I saw this in one of the first

    International Obfuscated C Code Contests.

  86. Tiny Programs that Suck Memory by duck_prime · · Score: 2, Funny
    [...] I could write a very small program size wise that would drain your memory and crash your system, or make it slow down to a crawl.
    Dammit Gates, I *told* you to stop posting here!
  87. My priorities by sjbe · · Score: 2
    This is what I want in a program in rank order. Please note that this is speaking from the standpoint of someone working/programming primarily with general purpose computers, not embedded system, supercomputers, etc. Nor is this an exhaustive list, it's just generally what I want to see.
    1. Functional. If if the program doesn't do what it is supposed to do, nothing else matters.
    2. Reliable. The program should do what it is supposed to do predictably and without crashing.
    3. Easy to use & easy to learn. Kind of a tie, depending on what I'm doing and how much I use the program. I should not have to memorize a huge command set. (though if appropriate it should be an option) Blind navigation spaces should be avoided whenever practical but available if appropriate.
    4. Maintainable. If the programmers can't fix problems or update things, it is unlikely to remain useful. As an end user this is not something I'll see except as the program evolves. Being maintainable for the programmer should NEVER overshadow the importance of a good user interface. A bad interface wastes my time. However, if the program is maintainable, it is likely that problems can be addressed so this maintainability is very important.
    5. Speed. Performs requested functions quickly. Obviously desireable, but not at the expense of the above.
    6. Minimal resources. Uses as little computer resources as appropriate, given the other constraints. I don't really care how small a program is if the system it is running on can handle it and it doesn't interfere with my work.

    Tiny, compact code is neat but I don't care about it. Folks here complain about bloat constantly but unless a program's size is actively interfering with your ability to do work and the program's functionality (and I don't mean taking an extra 2 seconds to load) who really cares? If it won't run on your machine, that is one thing. If it's just big, there are probably more important things to worry about. For example I don't really care that Mozilla is big compared to some other browsers. My machine can handle that and it's speed is adequate to my needs. I do care that the program is functional, reliable, easy to use and maintainable, which fortunately it is.
    1. Re:My priorities by p3d0 · · Score: 2
      Tiny, compact code is neat but I don't care about it.
      Then don't read the article, genius. The author is shrinking executables because it's fun and he's learning something, not because he thinks it's the best software engineering approach.
      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
  88. Imagine by Anonymous Coward · · Score: 0

    This article was vastly interesting.

    Imagine paying a large number of highly trained developers to work out an operating system for a modern x86 from machine code alone.

    Staggering thought, isn't it?

  89. Size by suprchargd · · Score: 1

    Its not the size that counts.

    --


    "The most sucessful operating system is not one who can eliminate its competitors, but live with them."
  90. Small size != More efficient by yorgasor · · Score: 5, Insightful

    Just because a program or executable file is smaller, doesn't necessarily mean it's more efficient. For instance, some compiler optimizations actually produce larger executables. If you unroll a loop, it actually generates code for each iteration of the loop, but saves time because it's faster to keep going forward than to branch backwards to run through the code again.

    Similarly, you can have inline functions that insert the inline function directly into the function calling it. Every function that calls an inline function would get a copy of it, which produces larger code, but saves a lot of time since it doesn't need to push the arguments on the stack, branch to the new function, and return with the value.

    Finally, the biggest speed gains you can get are generally algorithmic in nature. You can do a bubble sort with just a few lines of code. It's a lot simpler code and smaller than the larger and more complicated quick sort or merge sort. I know which one I'd rather wait for with a million items to sort.

    So remember, just because something is bigger, doesn't mean it's more bloated, and just because something is smaller doesn't mean it's faster or more efficient.

    --
    Looking for a computer support specialist for your small business? Check out
  91. The largest? by Anonymous Coward · · Score: 0

    Um, no. It is actually mydick.exe.

    At least, that's what your mother said last night.

  92. Funny you bring this up by Anonymous Coward · · Score: 0

    I recently attempted putting RedHat 7.0 onto a 133 MHZ pentium with 32 mb ram (toshiba laptop). The setup/installer informed me I do not have enough ram to continue.

  93. -1: Obvious by p3d0 · · Score: 1

    Lighten up, man.

    --
    Patrick Doyle
    I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
  94. Re:You disgust me... for different reasons by Anonymous Coward · · Score: 0

    "Reclaim America"?? More like "Conquer America for conservative religious bigots!"

  95. MOD PARENT UP +5 FUNNY by Anonymous Coward · · Score: 0

    that made me spill my coffee !!

  96. Yes, yes. We all know Frodo was a hobbit. . . by kfg · · Score: 3, Funny

    not an elf.

    Rumors of his being a fairy persist, however.

    KFG

  97. Kids don't try this at home :-) by Antity · · Score: 5, Interesting

    The first few examples are quite noteworthy, but when the author starts to put code inside the ELF header, it gets really ugly..

    Saying that these bytes are "only padding anyway for future extensions" doesn't feel that good. :-)

    This remembers me of early attempts on AmigaOS to shorten and fasten executables where people could be sure that all available Amigas would only use the lower 24 bits of 32 bit address registers since the machines could only address 24 bits physically. So they put application data into the upper 8 bits of registers. Worked fine.

    Then came newer machines which really used the full set of 32 address lines and all those dirty programs crashed without obvious reason..

    The author says "if we leave compatibility behind.." but what he's doing is not only leaving inter-OS compatibility behind - what he creates isn't even an ELF executable anymore. It's just something that happens to work with this special Linux version.

    So since this isn't even an ELF executable any more, there's no reason not just to write "exit 42" in bash (which would be an amazing 8 bytes in size *g*).

    Don't misunderstand me, I really like those hacks. But I myself will never, ever again code something that is prone to break in the future just because I didn't follow standards.

    One could say that this is what programming is about. :-) No offence meant.

    --
    42. Easy. What is 32 + 8 + 2?
  98. Job Security by vena · · Score: 2, Funny

    the real reason to obfuscate through efficiency! :)

  99. Saturday, saturday, saturday! Race race! by yerricde · · Score: 2

    (context for mods) let's see... ELF... elves... races in fantasy and science fiction:

    No. Trolls

    Look at that troll. Isn't it Qt?

    are completely different creatures from hobbits and elves.

    let's see... among (semi) intelligent roughly-humanoid races, the fantasy multiverse has at least humans, dwarves, elves, hobbits, ents, weebles, smurfs, cyclopes, gnomes (pronounced g; 90 cm tall), gnomes (silent g; 15 cm tall), trolls, orcs, merfolk, selkies, marsh-wiggles, nerdlucks, jawas, tuskens, wookiees, ewoks, teeks, borrowers, morlocks, and eloi.

    Saturday, Saturday, Saturday! Watch the Race Race at the Motor Speedway!

    Be there.


    --
    define MAX_CHRISTS 5
    --
    Will I retire or break 10K?
  100. 16 bytes by yerricde · · Score: 1

    40k? luxury! try 256 bytes ;)

    256 bytes? luxury! farbrausch has a 16-byte DOS demo.

    --
    Will I retire or break 10K?
    1. Re:16 bytes by irc.goatse.cx+troll · · Score: 1

      Yeah? well thats 15 too many, i can make this tight demo that looks like a pixel in one byte:
      .

      --
      Pain lasts, kid. Its how you know you're alive. Sometimes I think this growing up thing is just pain management-TheMaxx
  101. 26 bytes by bcrowell · · Score: 4, Funny
    Yeah, and now here's a thumb in the eye for all those C bigots and all those assembler bigots:

    $ cat >a.pl
    #!/usr/bin/perl
    exit(42);

    $ chmod +x a.pl
    $ ./a.pl
    $ echo $?
    42
    $ ls -l a.pl
    -rwxr-xr-x 1 bcrowell bcrowell 26 Oct 19 12:41 a.pl

    Only takes up 26 bytes on my hard disk!

    1. Re:26 bytes by Anonymous Coward · · Score: 0

      -rwxr-xr-x 1 root bin 708124 Oct 6 12:56 perl5.6.1

      Sure...

    2. Re:26 bytes by Citizen+of+Earth · · Score: 2

      $ ls -l a.pl
      -rwxr-xr-x 1 bcrowell bcrowell 26 Oct 19 12:41 a.pl


      $ ls -l /usr/bin/perl
      -rwxr-xr-x 2 root 13798 Sep 2 00:16 /usr/bin/perl
      $ ldd /usr/bin/perl
      libperl.so => /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/ libperl.so (0x40014000)
      libnsl.so.1 => /lib/libnsl.so.1 (0x4013f000)
      libdl.so.2 => /lib/libdl.so.2 (0x40154000)
      libm.so.6 => /lib/i686/libm.so.6 (0x40157000)
      libpthread.so.0 => /lib/i686/libpthread.so.0 (0x40179000)
      libc.so.6 => /lib/i686/libc.so.6 (0x42000000)
      libcrypt.so.1 => /lib/libcrypt.so.1 (0x401a9000)
      libutil.so.1 => /lib/libutil.so.1 (0x401d7000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
      $ ls -l /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/ libperl.so
      -r-xr-xr-x 1 root 1213788 Sep 2 00:14 /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/ libperl.so

    3. Re:26 bytes by Anonymous Coward · · Score: 0

      Yeah and Perl itself takes..?

    4. Re:26 bytes by bcrowell · · Score: 1
      Sure, but you need a lot of infrastructure to be able to run the ELF binary as well. The guy who wrote the story was using bash, which is half a meg, plus of course we all need some kind of Linux distribution in the background. Actually I'm really impressed that bash and Perl are as small as they are -- amazing considering that what they do is comparable in complexity to Word or Mozilla, which are an order of magnitude bigger.

      Anyway, I meant this thread mostly as a joke, and I'm glad it got modded funny. What was cool about the article was that it was a fun way to learn about an arcane subject.

      There's also a serious point to be made, which is that initial bloat is different from incremental bloat. Putting Perl or bash on your system is an initial bloat, but then software built on top of them is less bloated than if you reinvented the wheel and hand-coded everything. The Java libraries are an even more extreme example.

  102. Re:You disgust me... for different reasons by whereiswaldo · · Score: 0, Flamebait

    Well, you know, opinions are like assholes... everybody has one.

  103. Embedded systems need efficiency by yerricde · · Score: 4, Interesting

    CPU is cheap, hard disk is cheap.

    Maybe on PCs, but not on embedded systems, handheld systems, or game consoles. The Game Boy Advance, for instance, has only 384 KB of RAM, and all but 32 KB are 16-bit bus width with muchos wait states. Many microcontrollers inside such things as microwave ovens are as powerful as an Atari 2600 VCS, with 128 bytes of RAM and about 12 bytes of VRAM (if that).

    --
    Will I retire or break 10K?
  104. That's nothing by 0x0d0a · · Score: 2

    The author concludes, 'every single byte in this executable file can be accounted for and justified. How many executables have you created lately that you can say that about?'

    Heck, Microsoft fits that profile. Every byte accounted for? "One enormous pile of garbage."

  105. code the hexadecimal values by hand by screwthemoderators · · Score: 1

    "get out the binary editor and code the hexadecimal values by hand" I'm not sure if this is really doable, even as a fun, pointless little exercise. Have any /.ers tried this or even done a little binary coding? That would really impress me! Leave out any stories about "We used to do that all the time" Just show us an example

  106. I remember this by X-Nc · · Score: 2

    I saw this years ago. Sometime in the late 90's. It's very interesting and cool stuff, thouhg.

    --
    --
    If I actually could spell I'd have spelled it right in the first place.
  107. Yeah, sure by rauhest · · Score: 1

    The whole point of the paper was drawing newbie hackers' attention to that mysterious number, 42.

  108. Mine is smaller by eyal_bd · · Score: 1

    #!/bin/sh exit 42 $ ./kuku ; echo $? 42 $ wc -m kuku 18 kuku 18 bytes !!

  109. a word from the elves by reitoei1971 · · Score: 1

    Rather than hunting down the smallest elf, we would prefer you execute the largest elf. Doing so would help reduce our horrible obesity problem. Secondly, we damand humane executions, ie lethal injection. your proposed methods seem more like electrocution which was outlawed in the Really Tiny Creature War Crimes pact of 1982 along with inadvertantly stepping on us. Did you ever think about who's going to make your next generation .13 micron processors if you kill us?

  110. 35? by Anonymous Coward · · Score: 0

    How could you spend 35 bytes?

    C:\tmp>debug
    -a 100
    168D:0100 mov ah,9
    168D:0102 mov dx,108
    168D:0105 int 21
    168D:0107 ret
    168D:0108 db 'Hello World!$'
    168D:0115
    -r cx
    :15
    -n hello.com
    -w
    -q

  111. DOS not Linux by Anonymous Coward · · Score: 0

    (1) Returning a number is not exactly a good choice testing executable size. It's a start, but the program doesn't really _do_ anything.

    (2) The author of this comment may very well have not been talking about Linux. DOS .com files are extremely compact by comparison as they do not have any OS overhead - .com files are raw memory dumps that are loaded at a pre-determined offset into a 16-bit 64k segment and are executed directly.

    As another comment above stated, the 'RET' instruction (1 byte) is the smallest possible DOS .com program - as opposed to 45 bytes for Linux ELF executables (because you have to actually call a system function to exit).

    1. Re:DOS not Linux by Anonymous Coward · · Score: 0
      As another comment above stated, the 'RET' instruction (1 byte) is the smallest possible DOS .com program - as opposed to 45 bytes for Linux ELF executables (because you have to actually call a system function to exit).
      It's a bit more complicated than that. Linux has to:
      • Check to see that it's an executable
      • Check to see that it's an executable for the right platform (both OS and processor)
      • Find the address of the starting point
      DOS does none of these things. As a result, if you feed DOS a COM file with anything other than a DOS program, it will seriously fuck up, while Linux will just have an error message.
  112. ELFIO by Anonymous Coward · · Score: 1, Informative
    Interested in creating of ELF files may wish to look at a Sourceforge project called ELFIO:
    • http://sourceforge.net/projects/elfio/

    A "Hello world" program generated with this API takes only 267 bytes.
    • http://elfio.sourceforge.net/c66.htm
  113. To Think.. by Lord+Bitman · · Score: 1

    Before it took 8 Million years and a computer the size of a city to get the same answer. Now we can do it all with 45 bytes.

    --
    -- 'The' Lord and Master Bitman On High, Master Of All
    1. Re:To Think.. by Anonymous Coward · · Score: 0

      mod parent up dumbass mods, its a good joke.

      HINT: HHGTTG

    2. Re:To Think.. by Lord+Bitman · · Score: 1

      You know, posting as AC a "Mod Parent Up" message doesnt help anybody.

      --
      -- 'The' Lord and Master Bitman On High, Master Of All
  114. OT: Re:What about the Visual Studio .NET compiler? by WhaDaYaKnow · · Score: 5, Informative
    Yeah, look at this example for the printf implementation:
    extern "C" int __cdecl printf(const char * format, ...)
    {
    char szBuff[1024];
    int retValue;
    DWORD cbWritten;
    va_list argptr;

    va_start( argptr, format );
    retValue = wvsprintf( szBuff, format, argptr );
    va_end( argptr );

    WriteFile( GetStdHandle(STD_OUTPUT_HANDLE), szBuff, retValue,
    &cbWritten, 0 );

    return retValue;
    }
    Gosh, I wonder how come M$ has so many problems with secoority. 1024 bytes on the stack, without overrun checking. Wonderful stuff indeed.

    You may say, yeah but how often will you printf more than 1024 bytes? Exactly,- practically never. Which is why this sort of crap is not showing up in testing and DOES show up when people are trying to crack it.
  115. Several things by Sycraft-fu · · Score: 3, Informative

    1) The increase in OS requirements is partially due to the increase in OS functions. XP provides a lot more eye candy than NT, which needs more processor power to handle. You may not think it's a good idea, but most people like it.

    2) The increase in OS requirements is mainly due to an increase in software requirements as a whole. An OS is worthless if you can't run anything on it, so you need to set your requirements with software in mind. MS made this mistake with Windows 95. Yes, technically IT would run with 4MB of ram, but that wasn't enough to load anything else. XP's stated minimum isn't the actual minimum, but a practical one wheny ou account for applications.

    3) As others have mentioned, compact code comes at the price of maintainability. Sure, I can write a program in 100% assembly, and then if I'm realyl good tweak the machine code to make sure it is as efficient as possable. Now try and maintain that. This is hard enough if it's a tiny app, but if it is something large like, say, Mozilla even the orignal programmer would find matenence very difficult and anyone else would find it almost impossable.

    4) Along those line, portability requires that you code in a higher level language, and often that you make some changes that increase your code size. If you do everything in optimised assembly, well it's a one platform thing. I can gaurentee that you have to do a massive rewrite of an assembly Windows app if you want to make it run on x86 Linux just because of the API differences. If you are talking another hardware platform, then it's a total and complete rewrite.

    5) Your 64k demo thing I'm assuming is refering to the now infamous Farbrausch demos. It is simply stunning what they can get done in 64k BUT it comes at a huge price. First there is the memory usage, look at your task manager sometime when one of those is running, they use like 80MB. Because of their tiny disk usage they can to decompress to memory. Second their compatibility is horrable, their newer one FR22 works properly on my sytstem at work, but not at home, the only big difference being at home a have a geForce 4 at work I have a GeForce 3. Finally, these thigns are only made possable by the "bloated" Windows framework with things like DirectX to simplfy low level access.

    6) Most people see little point in trying to make things run well on a 386 when you can get an entire system running at over 1ghz for about $500.

    1. Re:Several things by Anonymous Coward · · Score: 0

      The Farbrausch work is very impressive, and the compatibility is pretty good in the finals (which you should try if you're having issues with .poemtoahorse - also, check your DirectX version is up to scratch and the video card drivers aren't hosed, which is MUCH more likely).

      The memory usage is because they want to increase compatibility, and because of that they can't use entirely procedural textures. DirectX usage is again, because of the high heterogeneity of the PC, necessary to abstract what would otherwise be low-level, to-the-metal operations which would break compatibility. The sound is more impressive to me, that's quite a decent little softsynth they have going, sort of a cross between Buzz and the Rob Hubbard engine.

      That said, 64KB is huge for a tiny demo. I've seen 4KB megademos with 16 screens and music - I've seen 160-bytetros with complex 3d shapes, procedural textures and bumpmapping, and I've seen this on a 8MHz 68000, and had to disassemble it to check it wasn't cheating.

      The point is, people do those things for a challenge. And so it is with the smallest executable (an article I saw a year ago, incidentally - I knew Slashdot was slow, but geez).

      It's important to realise that this is scene stuff, really. They aren't trying to code massive databases, or create the world's best web browser, or a rock-solid workhorse office suite - or even a free operating system (though of course a few of them do stretch to that ambition from time to time, hehe).

      And PC's really are getting bigger all the time - vastly bigger. This isn't an excuse for sloppy code, but it is an excuse not to have to squeeze every last byte or clock cycle, because that doesn't matter anymore (unless you're coding an interrupt routine or a very tight inner loop). As long as your coding doesn't completely suck, and you don't use stupid O(2^N) algorithms when there are perfectly good O(n lg n) ones, I daresay you're okay for most stuff, unless you have a specific reason to go small (coding a bootsector, loader or something like that).

  116. Small demos aht the like... by the_arrow · · Score: 2, Interesting

    I remember in the "good old days" (tm) on the Amiga, when some (well, quite a lot actually :) people managed to make small intros with sine-scrolling multi-colored text in less than 512 bytes, all done in the bootblock which also had a loader for whatever game/demo was on the disk.

    --
    / The Arrow
    "How lovely you are. So lovely in my straightjacket..." - Nny
  117. hand-tuned vs. compiler by jreiser · · Score: 1
    Better programmers (in any language) typically create and manage appropriate layers of abstraction so that the entire program can be kept in ones head all at the same time. Sometimes the art is in the number of layers (few or many), sometimes it's in refactoring the layers, sometimes it's in the impedance matching between layers, including the layer between the program and the real-world.

    The good human can recognize when the algorithm should be tweaked. For example, gzip_x86 decompresses 5% to 45% faster than gzip by focusing on the negative number of bits remaining, and allocating the registers accordingly. A person can ask enough questions to determine that incrementing both sides of a less than preserves the relationship (and then apply transitivity), while the careful compiler is stuck with the possibility of overflow.

    Humans also can have a wider range of adaptation to external constraints, for example small space limits on boot loaders. And no compiler known to me has ever on its own initiative recognized and used dynamic code (runtime code generation) where appropriate.

  118. create executables? by Anonymous Coward · · Score: 0

    What's that? Doesn't everyone use rpms? :)

  119. Smallest possible DOS executable by sc0rpi0n · · Score: 1

    echo -en '\xcd\x20' > void.com

    This will only call the DOS .com file exit function returning with an exitcode of 0.

    in assembly:
    int 0x20

    Smallest possible DOS executable that could be somehow usefull:

    echo -en '\xcd\x05\xcd\x20' > prtscr.com

    This will also call int 5, the print screen interrupt handler.

  120. Re:You disgust me... for different reasons by Anonymous Coward · · Score: 0

    Flaimbait? I was only taking the flamebait the AC poster left. Hilarious.

  121. It's possible by ThinkingGuy · · Score: 1

    I'm running Redhat 7.2 on a 486DX with 32MB of RAM (It's a router/firewall). The trick is to use the text-based installation rather than the GUI.

  122. Now thats what *I* love!! by linuxghoul · · Score: 1

    6 years back i wrote a 96 BYTE machine code program under DOS, using nothing but "debug" (machine code, as in i hand assembled my assembly), which calculated factorials of numbers upto abt 32000...i still give it a go when i am bored, under bochs :)

    i count tht as the most beautifull of my code

    ghoul2

    --
    Sigura Non Grata
  123. Wired 1995 by lonedfx · · Score: 2, Informative

    Wired 1995 Surprize coding compo :

    Write the smallest possible .com program that does the following :
    1, Input a number from the keyboard, call it N
    2, Go in mode 13 (vga), draw N 3x3 squares without the central pixel (N * 8 pixels to draw), no square should be adjascent to another.
    3, Wait for Enter
    4, Exit

    Results were

    1: Walken/Impact Studios, 48 bytes
    1: (ex aequo) Paranoia, 48 bytes
    2: KLF, 51 bytes

    For info, Walken's version was drawing the squares at different positions every time his program was ran (don't ask me how) :-)

    Our own attempt (aegis) yielded 52 bytes, but we were disqualified because we did not support the key "0" :-)

    ahh... fun...

    lone, dfx.

  124. Elf Up by Ratbert42 · · Score: 1
  125. Huh? by Hard_Code · · Score: 1

    Ok, I have a stupid question. Why is GCC not optimizing out things like this? For instance, why does the size drop from 1340 to 372 by simply not using the stdlib? What exactly is it that is adding ~1000 bytes? Is that *ALL* unnecessary initialization overhead? Is it calling into a precompiled library object or is it just including the source for exit()? If it is just including the source for exit(), how can this end up larger than just manually including the instructions? The only thing I can think of is "unnecessary" initializations

    --

    It's 10 PM. Do you know if you're un-American?
    1. Re:Huh? by flossie · · Score: 1

      exit() does all the clearing up for main. You may have noticed early in the article where the author by-passed main, eliminating the need for exit. If main was still used, I think that exit would have had to do more than just call _exit.

  126. bash beats perl (18 bytes) by flossie · · Score: 2

    $ cat>a.sh
    #!/bin/sh
    exit 42
    $ chmod +x a.sh
    $ ./a.sh ; echo $?
    42
    $ wc -c a.sh
    18 a.sh

    1. Re:bash beats perl (18 bytes) by FooBarWidget · · Score: 2

      Even smaller:
      $ cat>b.sh
      exit 42
      $ sh ./b.sh; echo $?
      42
      $ wc -c b.sh
      7 b.sh


      Who needs #!/bin.sh?

    2. Re:bash beats perl (18 bytes) by Anonymous Coward · · Score: 0

      Oh Yeah?
      0 bytes!

      $ perl -e 'exit 42'
      $ ls
      . ..

      !

  127. Self-contained Linux on a floppy! by Anonymous Coward · · Score: 0
    But what about "Tom's floppy which has a root filesystem and is also bootable"?

    I love it. This is a one-floppy Linux distribution which contains all the power tools you really need to demolish any computer.

    When I feel sadistic, I'll boot up some co-worker's Windoze box with it, and they arrive facing an "ls" listing and an "# " prompt. Panic usually follows.

  128. nasm? yuchhhhh! :) by Xtifr · · Score: 1

    And why the hell you'd want to install some wonky assembler when binutils already includes a perfectly decent one, I don't know. The Debian nasm package says "Size: 1344826". I thought the goal here was to REDUCE bloat, not increase it! :)

    People who are too lazy to learn the STANDARD assembly syntax for their system should stick to C (or BASIC), imo. :)

  129. Re:OT: Re:What about the Visual Studio .NET compil by Australian+werewolf · · Score: 1

    Where exactly did you pull this from? My VC.NET compiler does not have use this printf.

    There is a big difference between example code and the code they actually use, you know.

  130. Re:nasm? yuchhhhh! :) by flossie · · Score: 1

    I've no strong opinions regarding assembler syntax, but using a large assembler doesn't equate to bloat. You don't generally need to distribute the assembler along with the executable.

  131. But wait a minute... by soulctcher · · Score: 2, Funny

    ...nobody has yet said whether the smallest elf is executable or not? I would imagine that unless he's a water bear, we're probably still going to be able to execute him.

  132. Re:code the hexadecimal values by hand by Anonymous Coward · · Score: 0

    45 bytes is not that difficult to code manually. Emacs+hexl-mode+nasm -l will show you most of what you need.

  133. What about emacs executables ? by Billly+Gates · · Score: 3, Funny
    Its a much better os. I just wish I had a good editor on it.

  134. Re:justification -- Security? by zappy5000 · · Score: 1

    So I'll just place my trojan horse code into that extra space that you are currently wasting by aligning all your programs to 4KB disk pages.

    If I understand correctly, there is NO standard for padding unused disk files with RET / NOP calls AFTER a block has been used once, so your virus scanner will never bother to look past the end of block (EOB) marker!

    To make this even more nasty, I'll spread my mischief across multiple files in a .ZIP or .ARJ file. That way, you'll just think I was sloppy, not malicious!!

    --
    Zappy5000
  135. Use embutils, then! (was: Re:Excellent troll!) by Fefe · · Score: 1

    I wrote a fearly full-featured ls for embutils (http://www.fefe.de/embutils/); it has large file support and even does colors.

    $ ls -l /opt/diet/bin/ls
    -rwxr-xr-x 1 root root 17256 Aug 31 17:22 /opt/diet/bin/ls
    $ file /opt/diet/bin/ls /opt/diet/bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped
    $

    It's this small because of the diet libc, of course (http://www.fefe.de/dietlibc/).

  136. Re:You disgust me... for different reasons by Anonymous Coward · · Score: 0

    Yes- comparing somebody with an asshole is pretty much always flamebait.

  137. Re:You disgust me... for different reasons by Anonymous Coward · · Score: 0

    LOL - nuff said.

  138. Off Topic by Gerry+Gleason · · Score: 1, Offtopic

    What has this got to do with anything being discussed? The registry is a useless crock, and it has nothing to do with understanding anything about an ELF executable.

    1. Re:Off Topic by Anonymous Coward · · Score: 0

      Umm, unless I missed something they were talking about disk space usage in relation to the program size usage of said. This directly relates to space savings of data in general by using well thoughout techniques of optimization of data structures. This is on-topic, although only generally so.

      P.

  139. To really impress someone... by Lord+Custos · · Score: 1

    they'll have to write a functioning program thats only 1 byte long.

  140. Re:You disgust me... for different reasons by Anonymous Coward · · Score: 0

    That wasn't flamebait, it was more like "+2 informative."

    "Reclaim America" is a not-so-thinly-veiled attempt to impose a narrow minority view on the entire country. You can't reclaim something you never had!

    Seriously, if you think "Reclaim America" is a positive force for our nation, you probably also think "The Handmaid's Tale" is a utopian novel.

  141. executable elf?? by Anonymous Coward · · Score: 0

    This may solve the overcrowded prison problem at the north pole.

  142. old DOS COM files by Anonymous Coward · · Score: 0

    I hate to mention it, but old DOS COM files can be MUCH smaller :-)

    I even participated in a contest to build a 2 player game under 256 bytes! (mine was 189 bytes long).

  143. Mac OS 1.0 by macjohn · · Score: 1

    I fired up the old 512K the other day. You stick in a 400K floppy that's got the entire OS, including 8 fonts, MacWrite 1.0 - which still does about 90% of what people use WORD for, and it's got room for a few documents.

    Boots in 3.5 seconds too!

    I've read that Herzfeld and the others played exactly the kind of tricks in this article to get the original MacOS and a program to run on 128K of Ram.

    --
    --Hi. I'm in Portland and it's raining. This appears to be a permanent condition.
  144. MenuetOS disk also fits by Anonymous Coward · · Score: 0

    right in your ass - just like a toaster!

    Bob: Ass Toast never tasted so good.
    Bill: That's not toast silly - it's MenuetOS!

  145. O'Reilly True In Nutshell book by truth_revealed · · Score: 2, Funny

    This one went around the internet a thousand times already, but in case you haven't seen it:

    True in a Nutshell

    1. Re:O'Reilly True In Nutshell book by Anonymous Coward · · Score: 0

      Very funny, the author of that page,
      Mike Taylor seems to have a
      good
      handle balancing parents and other pursuits

  146. Re:justification -- Security? by Anonymous Coward · · Score: 0

    What fucking EOB marker? There's no such thing on a disk. Filesizes are stored in their goddamned directory entries.

  147. 256b by Anonymous Coward · · Score: 0

    There's a site [256b.com] that is dedicated for demos and intros under 256 bytes large--or small, that is.

  148. 88 byte cross-platform Linux x86 ELF/DOS .COM by Anonymous Coward · · Score: 0

    It's not the smallest, but it will do:
    echo 41841322028793493475277483847914334950692156421229 80990198124070670434221461126054012716884237789403 54374658995543008294292443701415731177681723440925 09864981039984833129500995832063412513786368235058 112064522788P | dc > small.com

    Note, however, that the method used to pack those extra bytes no longer works in Linux 2.4.19, and maybe slightly earlier.

  149. make it even smaller by prockcore · · Score: 2

    Make it even smaller by doing this:

    cp /usr/bin/perl /p

    and editing your shabang to be #!/p

  150. Re:OT: Re:What about the Visual Studio .NET compil by WhaDaYaKnow · · Score: 1

    Sorry, I know it's sometimes not to straight forward to get to the parent post on /. so I should have included a quote.

    Please note though that I started with OT (Off Topic)...

    Basically I replied to a post that said:
    Try libctiny:

    http://msdn.microsoft.com/msdnmag/issues/01/01/h oo d/default.aspx [microsoft.com]

  151. Re:No law on repeat articles (An apology) by Anonymous Coward · · Score: 0

    It has been posted here before. Lot more than a year ago mind.

  152. Tiny (MS-)DOS attack by Anonymous Coward · · Score: 0

    My favourite is a 4-byte DOS .com file which performs a, well, DOS attack, on the computer if it's a bad Pentium. Here it is:

    F00FC7C8

    Run it, and it freezes your Pentium. Enjoy.

  153. Common misconception by vlad_petric · · Score: 2
    Small code != fast code !!

    While it's true that quite a few optimizations not only improve the runtime but also reduce the code size, this is not generally true. An important optimization, for instance, is loop unrolling - which more than doubles the codesize of a loop. Its purpose is to reduce the number of branches, as jumps in superscalar out-of-order processors are performance killers.

    Small executables are important for machines where the program is stored in flash (like microcontrollers). The compilers for those architectures are optimized to produce small code (as a matter of fact some of them are gcc-based). When storage is cheap, program size is rather irrelevant (keep in mind that OSs do paging, they only keep a working set of the program in memory).

    The Raven.

    --

    The Raven

  154. Misguided minimalism by Junks+Jerzey · · Score: 2

    While nostalgic, this kind of minimalism is misplaced in modern operating systems. When you write an application, even a small application, think of everything that goes on behind the scenes:

    1. Using a single function in shared library brings in the entire library.
    2. You're at the mercy of the code in shared libraries and drivers. Even if you write code in hand-optimized assembly language, what's the point when you have to call the OS or a driver in order to do graphics and I/O?
    3. There's a relatively large cluster size under most filesystems, so saving a few bytes or even a few K can often be irrelevant.
    4. Even simple things like memory access can cause interrupts during which the virtual memory system intervenes.

    All the posts about "returning to the days of performance" and all that rubbish are completely off the mark.

  155. 256 bytes should be enuff... by Sam+the+Nemesis · · Score: 1
    Check out www.256b.com.

    These guys have windows executables having size of 256 bytes ! And believe me, those programs generate amazing graphics.

  156. Re:nasm? yuchhhhh! :) by vidarh · · Score: 2

    The point was that if you have binutils installed, you already have gas, and practically anyone using a Linux box for development will have bintuils installed, so why bother with nasm?

  157. 0 bytes, I win! by Anonymous Coward · · Score: 0

    Mine takes 0 bytes:

    $ perl -e 'exit(42)'; echo $?
    42
    $
    :)

    -$|{

  158. squeeze out bloat by Anonymous Coward · · Score: 0


    Sorry for the late post on the issue, but I did not see any mention of binary rewriting developments that have yielded significant code size reductions based upon whole program size optimizations: squeeze++++, a proof-of-concept program compactor

    These guys are obtaining 33%-70% size reductions on alpha platforms.

  159. Smallest Elf Found Executed by Anonymous Coward · · Score: 0

    Only 2" tall, dead under a toadstool. One bullet wound to the head at close range. Yuck!

  160. Give us a break by Anonymous Coward · · Score: 0

    I resent the whole programmers are getting lazy argument, back in the good old days making programs for a 48k spectrum it's easy and important to be as efficient as possible. However nowadays projects generally run into tens of thousands of lines of code, and have to run on various platforms. I'm in games so thats PC, PS2, GC and XBOX now I'm sorry but something has to give and I agree with the new school of thought that (and I'm paraphrasing here) something like 5 percent of your code runs 90 percent of the time and thats where you should concentrate your efforts. Coupled with the law of diminishing returns like that seen in the article size down by 1/2 then 1/4 then 1/8 etc. means it's better to profile carefully and go for the big wins then move on. Not that these skills aren't useful alot of the people who made games for the snes are now enjoying doing the same for the GBA.

    God only knows why Bill thought 640k would be enough for anyone though I'm betting windows 1.0 took up more than that !!!

  161. _ by iamacat · · Score: 1
  162. Imagine... by Anonymous Coward · · Score: 0

    A beowulf cluster of these things!

  163. A compiler developer begs to differ... by Doug+Merritt · · Score: 2
    those that write the compilers don't spend as much time on getting good, compact, precise and optimized code out of high-level code. Nobody cares.

    Speaking as a compiler developer, who as a contractor has done major compiler work in recent years for HP, Microsoft, SGI, etc, I strongly disagree.

    The speed of generated code is very important to hardware vendors (because it is essential to the speed of their hardware), to software developers (because the easiest way to get faster code is with zero effort -- buy a compiler that generates better code), and to compiler developers because they sell to the other two camps. (Or often, are also one of the other camps.)

    Sure, we all know that programmers in general don't care about speed of generated code the way we did back when it was truly critical to literally count every cpu cycle burned. But don't blame us compiler guys -- we're the good guys!

    On the other hand, you've a more legitimate complaint in talking about no one caring about the size of generated code. If you check the literature, you'll find that the almost the only famous reference on the subject of compilers minimizing code size was the landmark Bliss compiler, circa 1970.

    It's almost never been a concern. (I know there have always been exceptions to that, but I can't remember any exceptions that were famous, whereas issues of code speed are extremely famous.)

    --
    Professional Wild-Eyed Visionary
  164. MOD PARENT UP by Anonymous Coward · · Score: 0

    nice.

  165. OLD NEWS by Anonymous Coward · · Score: 0

    This is OLD. I was using this back in 1999 for my own ELF learning purposes. Get a clue slashbie.